During a recent project, a client wanted to do a blue/green deployment by switching from one Acquia Cloud instance to another. One of the biggest concerns was the transfer of about 230 GB of files. Here are the simple steps that were taken to make this happen.
- Log into your destination server. Create an SSH key. I recommend ~/.ssh/.
- Take note of your username, application instance, and environment.
Sub your values for the placeholders:
rsync -rltDvPhn --exclude={'folder1','tmp','cache'} --progress -e "ssh -i /home/[USERNAME]/.ssh/id_rsa" [USERNAME].[ENV]@[TARGET_SERVER].prod.hosting.acquia.com:/var/www/html/[USERNAME].[ENV]/docroot/sites/default/files/* /var/www/html/[USERNAME].[ENV]/docroot/sites/default/file/
- I ran rsync with the
-n
to do a dry-run first. Remove it when ready to sync. Here is a sample of a simple script to put it all together:
#!/bin/bash date > /home/[USERNAME]/prod/files/rsync.log rsync -rltDvPhn --exclude={'folder1','tmp','cache'} --progress -e "ssh -i /home/[USERNAME]/.ssh/id_rsa" [USERNAME].[ENV]@[TARGET_SERVER].prod.hosting.acquia.com:/var/www/html/[USERNAME].[ENV]/docroot/sites/default/files/* /var/www/html/[USERNAME].[ENV]/docroot/sites/default/file/ >> /home/[USERNAME]/prod/files/rsync.log date >> /home/[USERNAME]/prod/files/rsync.log
- Finally, I recommend running it as a background process
nohup ~/prod/files/my-rsync.sh > ~/prod/files/rsync.log &
It took about 6 hours for the initial transfer and somewhere between 30-60 mins to do subsequently updates.
Additional Resources:
- https://docs.acquia.com/cloud-platform/manage/files/transfer-files/rsync/
Comments