Backup and disaster recovery - cloudfoundry-community/cf-docs-contrib GitHub Wiki
This page documents good practices for backup and disaster recovery of production Cloud Foundry clusters.
AWS, bosh-bootstrap & bosh-cloudfoundry
Assumptions:
- Inception-server via cloudfoundry-community/inception-server
- BOSH via cloudfoundry-community/bosh-bootstrap
- Cloud Foundry via cloudfoundry-community/bosh-cloudfoundry
- Deployed to AWS
Inception-server
Backup procedure
- Make an AWS AMI from the inception server
- Make a backup of [your workstation]::
~/.inception-server
Recovery procedure
- Launch a new instance from your backup AWS AMI
- Restore the backup of [your workstation]::
~/.inception-server - Reassign the elastic IP (as specified in
~/.inception_server/settings.yml
MicroBOSH
Backup procedure
- Make sure you are taking regular snapshots of the persistent EBS volume attached to your MicroBOSH
- You can find the vol id using
inception_server$ grep disk_cid ~/.microbosh/deployments/bosh-deployments.yml
- You can find the vol id using
bosh backupmakes a.tgzof MicroBOSH director to the persistent disk of the MicroBOSH. That said, there is no documented way to restore this.
Recovery procedure
Recover terminated MicroBosh on AWS
-
Assumptions
- Persistent EBS volume for terminated MicroBosh is still around
bosh-deployments.ymlfor terminated MicroBosh in git is up-to-datemicro_bosh.ymlfor terminated MicroBosh in git is up-to-date
-
cd path/to/deployments(directory containing your bosh-deployments.yml file) -
In
bosh-deployments.ymlfor terminated MicroBosh- Take note of its ami (e.g. ami-12345)
- Take note of its persistent disk's volume-id (e.g. vol-111111)
-
mv bosh-deployments.yml bosh-deployments-old.yml -
Deploy a new MicroBosh
be bosh micro deploy ami-12345- Take note of the new persistent disk's volume-id (e.g. vol-222222)
-
On the new MicroBosh
sudo -imonit stop allwatch monit summary- Wait until jobs are no longer being monitored
sv stop agentmount- Take note of device for
/var/vcap/store(e.g./dev/xvdf1, which corresponds to/dev/sdfin the AWS console) umount /var/vcap/store
-
In the AWS console
- Detach the new persistent EBS volume (vol-222222 from new
bosh-deployments.yml) from the new MicroBosh instance - Attach old persistent EBS volume (vol-111111 from old
bosh-deployments.yml) to the new MicroBosh instance, use the same device as new persistent volume (e.g./dev/sdf)
- Detach the new persistent EBS volume (vol-222222 from new
-
Back on the new MicroBosh
sudo -ised -i 's/vol-222222/vol-111111/' /var/vcap/bosh/settings.jsonsv start agentwatch monit summary
-
sed -i 's/vol-222222/vol-111111/' bosh-deployments.yml -
rm bosh-deployments-old.yml -
git commit -
git push -
In the AWS console, delete the unused EBS volume
vol-222222