Backing up and restoring the deployment server

While there are many techniques for backing up and restoring servers, the following procedure backs up the minimal set of data needed for a successful recovery.

How you choose to back up the deployment server data varies depending on how you deployed the deployment server and the backup and recovery strategy and infrastructure of your organization. Regardless of the technique that is chosen, it is important to test both your backup and restore processes.

Backing up the deployment server

  1. Make a directory to copy the backup data. This directory can be anything that you choose, but you must ensure that it has enough disk space to hold the backup data. The commands in this document use the following directory:
    mkdir /tmp/backup
  2. If you changed the Chef server configuration files, you must back up your changes. IBM Cloud Manager with OpenStack sets these values during installation; therefore, no changes are typically required. If you used a response file for installation, you must backup the response file and keep it with your backups so it can be used to reinstall IBM Cloud Manager with OpenStack.
    cp ~/cmwo_install.rsp /tmp/backup
  3. Back up the certificates of the webserver.
    mkdir /tmp/backup/etc
    cp -a /etc/opscode /tmp/backup/etc/opscode
  4. Back up the bookshelf data.
    mkdir /tmp/backup/opt
    cp -a /var/opt/opscode /tmp/backup/opt/opscode
  5. Back up the postgres database. The pg_dump command produces a consistent backup even if the server processes are running.
    mkdir /tmp/backup/database
    
    su - opscode-pgsql    
    pg_dump -c opscode_chef > /tmp/chefserver.sql
    exit
    
    cp /tmp/chefserver.sql /tmp/backup/database
  6. Back up your topology, node attribute, and encrypted data bag, secret key files. By default, these files are in your /root/your-deployment-name directory.
    cp -a /root/icm/clouds/your-deployment-name  /tmp/backup/
  7. Back up the /root/.chef/knife.rb file.
    cp /root/.chef/knife.rb /tmp/backup
  8. Back up the server SSL certificate.
    cp /root/.chef/os-software-management.pem /tmp/backup
  9. If you are using identity files rather than passwords, back up identity files of the node. The location depends on your configuration. When you deployed the node, you needed to specify either the node's password or identity file in your topology files. Check your topology files to see whether you used identity files and find their locations.
  10. If you customized the file-repo or the yum-repo, back up those changes.
  11. Compress the /tmp/backup directory and store in a safe location.
    zip -r backup /tmp/backup

Restoring the deployment server

Start with a clean system and do the following:
  1. Retrieve your backup archive file that you want to restore and extract it to /tmp/backup.
    unzip backup.zip
  2. Install IBM Cloud Manager with OpenStack. Use the response file if you used one during the initial installation.
  3. Apply any IBM Cloud Manager with OpenStack fix packs.
  4. Apply any file-repo or yum-repo changes that were made or restore those changes from the backup archive file.
  5. Restore the postgres database.
    su - opscode-pgsql
    psql -U opscode-pgsql opscode_chef < /tmp/backup/database/chefserver.sql
    exit
  6. Stop the server processes.
    chef-server-ctl stop
  7. Restore the bookshelf data.
    rm -rf /etc/opscode
    cp -a /tmp/backup/etc/opscode /etc/opscode
  8. Restore chef configuration data.
    rm -rf /var/opt/opscode
    cp -a /tmp/backup/opt/opscode /var/opt/opscode
    rm -f /root/.chef/trusted_certs/your_server_hostname.crt
    cp -a /var/opt/opscode/nginx/ca/backup_server_hostname.crt /root/.chef/trusted_certs
  9. Restore the knife.rb file.
    cp -a /tmp/backup/knife.rb /root/.chef/
  10. Restore the certificate of the webserver.
    cp -a /tmp/backup/os-software-management.pem /root/.chef
  11. Restore your topology, node attribute, and data bag encryption, secret key files.
    cp -a /tmp/backup/your-deployment-name /root/icm/clouds/your-deployment-name
  12. If you are using identity files rather than passwords, restore the identity files of the node. The location depends on your configuration.
  13. Restart the chef server.
    chef-server-ctl start
  14. Reindex the chef server.
    sed -i 's|https://127.0.0.1|https://127.0.0.1:14443|g' /opt/opscode/embedded/service/opscode-erchef/bin/reindex-opc-organization
    chef-server-ctl reindex ibm

Your deployment server restore is now complete.