Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

Migrating a Canopy instance's data and files from one server to another

NOTE THAT THESE ACTIONS WILL DELETE ALL DATA ON THE TARGET SERVER

Exporting on source server(as root):

  1. Stop Canopy: 

    systemctl stop canopy canopy-celery

    Note for older versions(3.0) of Canopy one would use `supervisord` instead of `systemd`

  2. Create DB dump: 

    canopy-manage dumpdata --all -o db.json
  3. Archive uploaded files: 

    tar -zcvf canopy_files.tgz /var/opt/checksec/canopy
  4. Start daemons again if required. 

    systemctl start canopy canopy-celery
  5. Copy db.json and canopy_files.tgz to Server B

Importing on target server(as root):

  1. Stop Canopy: 

    systemctl stop canopy canopy-celery
  2. If database structure is outdated or non-existent then configure a production DB: 

    canopy-manage setupdb --prod --drop-tables
  3. Delete data in DB: 

    canopy-manage flush
  4. Remove remaining remnants that are autogenerated: 

    echo -e 'truncate table django_prbac_role cascade;\ntruncate table django_content_type cascade;\n' | SKIP_PRBAC_CHECKS=1 canopy-manage dbshell
  5. Load db.json: 

    SKIP_PRBAC_CHECKS=1 canopy-manage loaddata db.json
  6. Extract Canopy files: 

    tar -xvf canopy_files.tgz -C /
  7. Set ownership of files: 

    chown -R canopy: /var/opt/checksec/canopy
  8. Start Canopy: 

    systemctl start canopy canopy-celery


If any issues are encounter with steps 3 or 4 then replace them with the following:

Run: SKIP_PRBAC_CHECKS=1 canopy-manage shell_plus

Paste:
from django.apps import apps
for model in apps.get_models(): model.objects.all().delete()

ctrl-d to exit the shell
  • No labels