Here you can find all information about "Backup" for the COYO Enterprise Version.
How do I create a backup and how does the restore work?
In your .env file you will find the parameter BACKUP_CRON. With a cron pattern you can set there when the automatic backup should be executed. By default the backup is started daily at 03:30 (server time).
Creating a manual backup
You can access our backup service via a REST API on port 8083. It is recommended to use tools like Postman to manage the queries more easily. Below you will find the calls with CURL, which you can execute directly on the COYO 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
Hint:
Here you can also see the last execution date (<BACKUP_CREATION_DATETIME>)
Restore from any backup
To import a backup it is important to stop all containers except coyo-db, coyo-mongo, coyo-backup and coyo-lb. The easiest and cleanest way to do this is to first shut down all COYO containers on the COYO host. Run our stop script in the COYO Home directory:
./stop.sh
Then start the above mentioned containers:
docker-compose -f docker-compose.yml up -d \
--no-deps --remove-orphans \
coyo-db \
coyo-mongo \
coyo-backup \
coyo-lb
Now all containers that need to be online for a backup start and you can start the backup restore.
Example for starting with CURL:
curl -u '<COYO_MANAGEMENT_USER>': '<COYO_MANAGEMENT_PASSWORD>'. \
-X "PUT" https://<COYO_BACKEND_URL>:8083/api/backups/restore?ref=<BACKUP_CREATION_DATETIME>
Hint:
The format of <BACKUP_CREATION_DATETIME> must be as follows "YYYY-MM-DDTHH:MM:SS
If you want to restore an older backup, you can look in the directory <COYO_DATA_STORAGE>/backup/database on the COYO host. The folder names there contain the backup creation datetime in the format YYYYMMDD_HHMMSS. This format has to be adapted as described above.
The database directory could look 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/
Backup log
To monitor the status of the restore, you can watch the backup log either in Kibana or directly on the COYO host.
This can be found at <COYO_DATA_STORAGE>/backup/logs/coyo-backup.log. If the restore was successful, you can use the stop script to shut down all containers and the start script to restart all containers. Please make sure that the restore should match the COYO version. Otherwise the restore will be migrated to the new version when you start it from the backend or if you started an older version, there might be errors.
After a backup is imported, all indexes must be updated to synchronize the state of the database to ElasticSearch. If this is not done, errors and malfunctions may 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/index/refresh \
-H 'Content-Type: application/json' \
-d '{}'
To see if the 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/index/status
Can the backup be disabled?
Yes, it is technically possible to deactivate the backup. To do so, you can simply comment the COYO backup container from the start script.