Backups
In this article
There is two ways to backup Kantree:
- backup the whole installation
- backup a single team
Backuping the whole installation
These need to be backed up to properly recover an instance:
- the database
- the uploaded files (the
/uploadsvolume, unless you use S3) - your configuration:
config.yml, the.envfile anddocker-compose.yml - the
credential_encryption_keys: stored credentials cannot be read without them (see Secret keys)
The commands below are run in the directory of docker-compose.yml and use the database kantree and the user kantree: replace them with the values of your installation.
Backuping the database
Use standard postgresql tools to do so. Example with pg_dump:
$ docker compose exec postgres pg_dump -U kantree -Fc kantree > kantree.dump
Backuping uploaded files
Copy the content of the /uploads volume:
$ docker compose cp app:/uploads ./uploads-backup
Restoring your installation
- Stop Kantree:
docker compose stop app - Restore the database:
docker compose exec -T postgres pg_restore -U kantree -d kantree --clean --no-owner < kantree.dump - Restore uploaded files:
docker compose cp ./uploads-backup/. app:/uploads - Give the files to the user of the container:
docker compose run --rm --user root --entrypoint chown app -R 65532:65532 /uploads - Clear the redis database:
docker compose exec redis redis-cli flushall - Restart Kantree:
docker compose start app
Backuping a single organization
Via the admin panel
From the admin area of an organization, click the “Export” button. This will generate an archive with all the data of this team.
To restore it, go to the “Organizations” section of the Kantree admin area then “Add a new org” and select “Import from file”
From the CLI
Export the organization:
$ docker compose run --rm app export-org ORG_ID_OR_SLUG
When using the above command, the generated archive is uploaded to the storage defined in your config (upload folder, S3, …).
You can use the --out-dir=/path/to/dir option to specify in which directory to store the generated archive. This directory is in the container: use a mounted volume to keep the archive.
To restore the organization, the archive must be readable in the container:
$ docker compose run --rm -v /path/to/archive.tar.gz:/tmp/archive.tar.gz app import-org /tmp/archive.tar.gz
(Use --help for additional options)
Backuping individual workspaces (projects)
This can be done only using CLI.
$ docker compose run --rm app export-project PROJECT_ID_OR_SLUG
When using the above command, the generated archive is uploaded to the storage defined in your config (upload folder, S3, …).
You can use the --out-dir=/path/to/dir option to specify in which directory to store the generated archive.
To restore the project:
$ docker compose run --rm -v /path/to/archive.tar.gz:/tmp/archive.tar.gz app import-project /tmp/archive.tar.gz TEAM_ID_OR_SLUG
(Use --help for additional options)