On-Prem: Backup guide

You'll find all the information about "Backups" for the On-Premises version in this article.  

Create a backup

In your .env file, you’ll find the parameter BACKUP_CRON. Using the cron pattern, you can set when the automatic backup should be performed. By default, the backup is launched daily at 03:30 a.m. (server time).

Create a manual backup

You can access our Backup Service via a REST API using port 8083. It’s recommended to use tools such as Postman for this to manage the requests more easily. Below you’ll find the requests with CURL, which you can execute directly on the Haiilo host.

curl -u '<COYO_MANAGEMENT_USER>':'<COYO_MANAGEMENT_PASSWORD>' \
-X "PUT" https://<COYO_BACKEND_URL>:8083/api/backups

Backup Status

curl -u '<COYO_MANAGEMENT_USER>':'<COYO_MANAGEMENT_PASSWORD>' \
-x "GET" https://<COYO_BACKEND_URL>:8083/api/backups
Note: 
You can also see the last execution date here (<BACKUP_CREATION_DATETIME>)

Restore from any backup

To restore a backup, it's important to stop all containers apart from coyo-db, coyo-mongo, coyo-backup, coyo-lb and coyo-s3 (since version 35). The easiest and cleanest way to do this is by first shutting down all Haiilo containers on the Haiilo host. To do this, execute our stop script in the Haiilo Home directory:
./stop.sh
Then launch the containers stated above:
docker-compose -f docker-compose.yml up -d \
--no-deps --remove-orphans \
coyo-db \
coyo-mongo \
coyo-backup \
coyo-lb \
coyo-s3
All of the containers that need to be online for the backup are now launched and you can start the backup restore process.
Example of launching with CURL:
curl -u '<COYO_MANAGEMENT_USER>':'<COYO_MANAGEMENT_PASSWORD>' \
-X "PUT" https://<COYO_BACKEND_URL>:8083/api/backups/restore?ref=<BACKUP_CREATION_DATETIME>
Note: 
The format of <BACKUP_CREATION_DATETIME> must be as follows \"YYYY-MM-DDTHH:MM:SS\" (e.g. \"2019-02-18T08:35:29\")\n
If you want to restore an older backup, you can look in the directory <COYO_DATA_STORAGE>/backup/database on the Haiilo host. The folder names there contain the backup creation datetime in the format YYYYMMDD_HHMMSS. This format must be changed as described above.
The database directory might look something like this:
root@coyo-host:/home/coyo cd coyo-data/backup/database/
root@coyo-host:/home/coyo/coyo-data/backup/database ll
total 424
drwxr-xr-x 105 root root 4096 Oct 26 12:42 ./
drwxr-xr-x 5 root root 4096 Jul 6 03:30 ../
drwxr-xr-x 2 root root 4096 Jul 6 03:30 20180706_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 7 03:30 20180707_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 8 03:30 20180708_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 9 03:30 20180709_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 11 03:30 20180711_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 12 03:30 20180712_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 13 03:30 20180713_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 14 03:30 20180714_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 15 03:30 20180715_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 16 03:30 20180716_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 17 03:30 20180717_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 18 03:30 20180718_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 19 03:30 20180719_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 20 03:30 20180720_033000_coyo/
drwxr-xr-x 2 root root 4096 Jul 21 03:30 20180721_033000_coyo/

Note: 

If you need to revert to an earlier Haiilo version in the course of an update, for example because there was a problem with the update, please note that the container versions must be used at the level of the previous Haiilo version. 

The restore time depends on the amount of data. As an example: Restoring the backup (database + file store) of around 80GB takes approx. one hour. In addition, all of the indexes need to be updated following a backup restore.

Backup log

To monitor the status of the restore, you can observe the backup log either in Kibana or directly on the Haiilo host. 
This can be found at <COYO_DATA_STORAGE>/backup/logs/coyo-backup.log. If the restore has been completed successfully, you can stop all of the containers again using the stop script and restart all of the containers with the start script. Please be aware that the restore should match the Haiilo version. Otherwise, the restore will be migrated to the new version from the backend when it’s launched or, if you’ve launched an older version, errors could occur.
After a backup has been restored, all of the indexes need to be updated to synchronize the status of the database according to ElasticSearch. If this isn’t the case, errors and malfunctions can occur. To update the indexes, execute the following API calls:
curl -u '<COYO_MANAGEMENT_USER>':'<COYO_MANAGEMENT_PASSWORD>' \
-X POST https://<COYO_BACKEND_URL>/manage/backend/index/refresh \
-H 'Content-Type: application/json' \
-d '{}'
 
To see whether re-indexing is complete, you can check the status of the reload:
curl -u '<COYO_MANAGEMENT_USER>':'<COYO_MANAGEMENT_PASSWORD>' \
-X GET https://<COYO_BACKEND_URL>/manage/backend/index/status

Deactivate a backup

While it's technically possible to switch off the backup, we advise against completely deactivating the backup as if your server or the server of your hosting provider suffers a hardware failure, there's no way to restore your current data.

To deactivate a backup, you can simply comment on the Haiilo backup container from the start script.

Delete old backups

One full dump per day can be found in the directory coyo-data/backup/database. The corresponding days can be removed if you like.
Note: 
However, please don’t delete anything in the directory coyo-data/backup/filestore!

Was this article helpful?