4.11. Backup & Restore

4.11.1. About Backups

Since suSSHi Chef uses the standard PostgreSQL database, a backup of the database can of course be done with all backup methods available for this database. This strongly depends on the requirements, the setup and personal preferences or the company strategy.

In addition, the suSSHi Chef container offers a built-in simple backup solution that can be triggered by a corresponding call to the container. There are three methods available for this purpose:

backup

Creates a current backup.

list-backups

Displays the backups available for the installed software version.

restore-backup

Recover the database from the specified backup.

Since the backup is done inside the container, a corresponding persistent volume must first be mapped into the container so that the backup data is located outside the container.

docker-compose.yml
volumes:
  - /data/susshi-chef-backup:/opt/wasabi/susshi-chef/backups

4.11.2. Commands

There are multiple ways to call the methods listed above. We will look at two of them:

Method 1 - Exec into a running suSSHi Chef container

This is the preferred method since it does not require to run another server, which may conflict in resources and the existing container already runs with the right environment variables to reach the database. Please ensure you have started the suSSHi Chef container with a persistent volume mapped to /opt/wasabi/susshi-chef/backups as described above.

  1. List existing backups

    $ docker-compose exec susshi-chef list-backups
    
  2. Create backup

    $ docker-compose exec susshi-chef backup
    
  3. Restore backup

    $ docker-compose exec susshi-chef restore-backup <name>
    

Method 2 - Run a new container with docker

Another method is to start a new container for the backup, which will be automatically removed and deleted from the system after the operation.

However, one problem with this method is that this suSSHi Chef container also needs the database credentials to create the backup, so the ENV variables must also be passed. The easiest way to do this is to refer to the ENV file used.

Note

In this example, we use docker and not docker-compose!

$ docker run --rm --env-file <env-file> -v <persistent_volume>:/opt/wasabi/susshi-chef/backups <image-path> backup|list-backups|restore-backups