-
Notifications
You must be signed in to change notification settings - Fork 39
Data backup
This guide explains how to backup UCRM manually or how to migrate UCRM to another machine.
UCRM data is stored in two locations:
- /home/ucrm/data - images, pdf invoices, enctyption key
- /home/ucrm/postgres - postgres database - all other ucrm entities such as clients, payments, etc..
Note that if you want to migrate UCRM to another machine you need to migrate both data and postgres folder because some sensitive data stored in you posrgres database are encrypted using the key stored in /home/ucrm/data/ucrm/data/encryption/crypto.key This key is created once you set up either mailer password (in Settings > General > System > Mailer) or a device password (in Network > Devices) and you must always migrate your database together with this key.
Note that backuping/migrating database can be also processed in UCRM app which may be easier for most users. See Settings > Tools > Database backup. Using this tool you can backup and restore the database instead of moving /home/ucrm/postgres folder.
For data backup, you must first pause the running containers. Go to directory, where your docker-compose.yml is located (probably /home/ucrm
). Then archive the data and save it somewhere safe and finally unpause the containers.
# go to your UCRM home directory
cd /home/ucrm
#pause running containers
docker-compose pause
# pack the data directory
sudo tar -cvjSf ucrm-data.tar.bz2 data
# optionally, pack the postgres directory
sudo tar -cvjSf ucrm-postgres.tar.bz2 postgres
# unpause running containers
docker-compose unpause
This set of commands will create separate archives for UCRM data (e.g. invoice PDFs) and database. Then you can move it to another machine or archive.