This is how I set up a bash script to run rsync to back up the docker’s volume and compress it with sudo crontab
.
#!/bin/bash
date=$(date +%Y%m%d-%H.%M.%S)
home=/home/temp
# Stop Rocket.Chat container
docker-compose -f /var/www/rocket.chat/docker-compose.yml stop rocketchat
# Run rsync data folder
rsync -a /var/www/rocket.chat/data/ $home/rocketchat_data.bkp.$date && \
# Restart Rocket.Chat container
docker-compose -f /var/www/rocket.chat/docker-compose.yml up -d rocketchat
# Archive and zip the folder with max compression rate
tar -I 'gzip -9' -cvf $home/rocketchat_data.bkp.$date.tar.gz $home/rocketchat_data.bkp.$date/ && \
# Remove the folder
rm -r $home/rocketchat_data.bkp.$date && \
# Move the archive file inside another folder
mv $home/rocketchat_data.bkp.$date.tar.gz $home/rocketchat_data.bkp && \
# Upload the archive to Tardigrade.io
$home/uplink cp $home/rocketchat_data.bkp/rocketchat_data.bkp.$date.tar.gz sj://rocket.chat
# Remove archive files more than 60 days old
find $home/rocketchat_data.bkp/* -mtime +60 -exec rm -rf {} \;
This script removes anything but tar.gz
files to save up data usage on your hard drive.
For me it uploads (only) ~300 MB daily to Tardigrade, and since two months it has costed me only under a dollar. Uploading is fast, data should be reliable (I haven’t tested downloading yet)…
The great experience with Tardigrade so far. SNOs and the development team, please keep up the nice work