Skip to content

Backups

Graham Garner edited this page Nov 3, 2019 · 9 revisions

Because containers can easily be rebuilt from docker hub we only have to back up the data in the "volumes" directory.

Influxdb

~/IOTstack/scripts/backup_influxdb.sh does a database snapshot and stores it in ~/IOTstack/backups/influxdb/db . This can be restored with the help a script (that I still need to write)

Docker backups

The script ~/IOTstack/scripts/docker_backup.sh performs the master backup for the stack.

This script can be placed in a cron job to backup on a schedule. Edit the crontab withcrontab -e Then add 0 23 * * * ~/IOTstack/scripts/docker_backup.sh >/dev/null 2>&1 to have a backup every night at 23:00.

This script cheats by copying the volume folder live. The correct way would be to stop the stack first then copy the volumes and restart. The cheating method shouldn't be a problem unless you have fast changing data like in influxdb. This is why the script makes a database export of influxdb and ignores its volume.

Dropbox integration

To enable the the 'docker_backups.sh' file and uncomment the lines in front of the Dropbox-Uploader command.

Restoring a backup

The "volumes" directory contains all the persistent data necessary to recreate the container. The docker-compose.yml and the environment files are optional as they can be regenerated with the menu. Simply copy the volumes directory into the IOTstack directory, Rebuild the stack and start.

Clone this wiki locally