Commit cfa93dc8 authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen Committed by Petter Goksøyr Åsen
Browse files

DEICH-5666 croncile: backup and restore routine

parent e498d635
# Cronicle
Cronicle is a scheduler for all the periodic jobs that the various components in the system needs to run. This includes backup of databases, and all the different tasks that Koha must perform routinely.
## Backup and restore of Cronicle configuration data
A cronicle-job is set up to take a daily backup of Cronicles configuration. This includes all the jobs and the shcedule, but does not include the output of the historical job runs.
The backup is just a single text file, and is stored in the same place as MariaDB and Virtuoso backups are stored.
To perform a restore, the backuped file must be put in to the mounted data volume at a designated location, so that cronicle will import it on next restart of the container.
To fetch the latest cronicle backup and restore config run the following (se deployment-config repo for environment variables):
> docker stop cronicle # cronicle MUST be stopped before restore
> docker run --rm --network bridge -v ${SSH_PRIVATE_KEY_MOUNT}:ro -v ${SSH_PUBLIC_KEY_MOUNT}:ro -v deichman_cronic
le_data:/cronicle-data instrumentisto/rsync-ssh rsync -e "ssh -o StrictHostKeyChecking=no" -azPv --delete --progress
--info=progress2 --copy-unsafe-links datafetch@${DATAFETCH_HOST}:$backup_dir /cronicle-data/restore
> docker start cronicle
\ No newline at end of file
......@@ -37,5 +37,13 @@ then
touch $DATA_DIR/.setup_done
# Import backup if it exists
if [ -f /data/restore/config.txt ]
echo "restoring config from backup"
/opt/cronicle/bin/ import /data/restore/config.txt
rm /data/restore/config.txt
# Run cronicle
/usr/local/bin/node "$LIB_DIR/main.js"
\ No newline at end of file
set -e
cd /backups
DATE=`date +%Y%m%d%H%M%S`
mkdir -p $DIR_NAME
echo "exporting cronicle config to $DIR_NAME/config.txt"
/opt/cronicle/bin/ export /backups/$DIR_NAME/config.txt --verbose
chown -R 1000:1000 /backups/$DIR_NAME
echo " { \"chain_data\": { \"dirname\": \"$DIR_NAME\"}}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment