Copy/Backup/Restore instance data and files

This guide is for performing a backup of and restoration of a Canopy instance. Be it for recovery purposes or migration to a new server.

Exporting/Backup on the source server (as root):

  1. Stop Canopy services:

    root@source:~# systemctl stop canopy canopy-celery
  2. Create a database dump:

    root@source:~# canopy-manage dumpdata --all -o /tmp/canopy_db.json
  3. Archive configuration and data files:

    root@source:~# tar -zcvf /tmp/canopy_files.tgz /etc/canopy /var/opt/checksec/canopy
  4. Start the services again if this is only a backup. For migrations it’s best to leave them stopped so that the dataset doesn’t diverge due to usage:

    root@source:~# systemctl start canopy canopy-celery
  5. For backup purposes store /tmp/canopy_db.json and /tmp/canopy_files.tgz in a safe place.

    For migration, copy /tmp/canopy_db.json and /tmp/canopy_files.tgz to the target server’s /tmp/ directory.


The use of the /tmp/ directory is important as canopy-manage always runs as the canopy user and won’t be able to access the same directories as the root user. Any directory that the canopy user has access to can be used.

Importing/Restoring on the target server (as root):


These steps should be performed on a clean server as some of the steps will delete existing Canopy data. If the target server already has a Canopy installation then its data directory (/var/opt/checksec/canopy) should be removed (or moved).

  1. If installed, remove any installed Canopy package:

    root@target:~# apt remove canopy
    root@target:~# yum remove canopy
  2. Install the same version of Canopy as the source server. Some additional steps may be required, please see our Installation guide. The DB initialisation and superuser creation steps should be skipped:

    root@target:~# apt install canopy.deb  # and some installation more steps
    root@target:~# yum install canopy.rpm  # and some installation more steps
  3. Stop Canopy services:

    root@target:~# systemctl stop canopy canopy-celery
  4. Extract Canopy configuration and data files:

    root@target:~# tar -xvf /tmp/canopy_files.tgz -C /
  5. Verify/Edit /etc/canopy/canopy.ini to ensure it’s valid for the target server.

  6. Create and import the DB dump:

    root@target:~# canopy-manage setupdb --delete-all --fixture /tmp/canopy_db.json
  7. Run post installation script:

    root@target:~# canopy-manage postinstall
  8. Start Canopy services:

    root@target:~# systemctl start canopy canopy-celery

Now you can login to the new server and verify that the data is there.


If for some reason the file and directory ownerships are incorrect, they can be reset using (as root):

chown -Rh root:canopy /etc/canopy
chown -Rh canopy: /var/opt/checksec/canopy
chmod -R uog-rwxXst,u=rwX,g=rX /var/opt/checksec/canopy /etc/canopy