-
Notifications
You must be signed in to change notification settings - Fork 582
Backups
Because containers can easily be rebuilt from docker hub we only have to back up the data in the "volumes" directory.
This a great utility to easily upload data from your PI to the cloud. https://magpi.raspberrypi.org/articles/dropbox-raspberry-pi. I can be installed from the Menu under Miscellaneous.
~/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)
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.
To enable the cloud backups edit ./scripts/docker_backups.sh
file and uncomment the lines in front of the Dropbox-Uploader command.
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.