Moving V2 Data to the Host Machine's Disk
Introduction
If we deploy a new production system into a virtual machine (s. V2CapistranoDeployment), than the new system's shared/var/data directory is linked to the host machine's disk. The capistrano task deploy:setup_ext_dirs does the work. However older systems haven't this link setup, they need to set is manually.
Moving the Data Manually
Note, that the capistrano task deploy:setup_ext_dirs creates also a link to have all system on the same virtual machine a common bundle directory, so we will set it also. We need to perform the following steps, assumed that we want to do it for the v2.softxs.ch-jk5 system:
# On the v2 system (ssh -C -p20110 v2@v2.softxs.ch) cd ~/rails/v2p0-jk5-app/shared rm backup/* log/*.bz2 # clean up a little bit rsync -a bundle/ ../../bundle/ # copy the gems used to the common bundle directory rm -rf bundle # remove local bundle directory if the rsync above was successfull mv var var.back # move var to a backup directory # Create the necessary links running capistrano on the deployment system: vi app/v2p0/site/proto/instance/v2.softxs.ch-jk5/deploy.rb set :servpath, "v2.softxs.ch" set :relpath, "v2p0-jk5" cap -s app=v2p0 -s site=proto -s instance=v2.softxs.ch-jk5 deploy:setup_ext_dirs # On the v2 system again cd ~/rails/v2p0-jk5-app/shared rsync -a var.back/ var/ # copy data to the new directory, linked to the host's data diorectory rm -rf var.back # remove the backup if the rsync above was successfull