I am not familiar with either Docker or mongodb so basically I don’t know anything here at all and am all confused (also the instruction there is not quite sufficient… it does not explain how to create a backup).
What I would like to know is:
How to create a mongodb database backup inside these Docker containers (run a mongodb dump?)
How to set up to upload the backup periodically (write a cron?)
This is actually not quite related with Tardigrade itself… still I believe an instruction would help others too in this time, which also benefits SNOs as a result. Fund is already secured for my case.
We are working on an integration with the MongoDB Ops Manager product to back up to the Tardigrade service. We will be providing details in the next few weeks.
And I checked it exactly in the docker.
You also can link the docker container with modgoDB connector to the docker conatiner with MongoDB to have a direct connection to it.
Here is a Dockerfile for connector
FROM golang:1.14
RUN git clone https://github.com/utropicmedia/storj-mongodb && \
cd storj-mongodb && \
go get github.com/utropicmedia/storj-mongodb
COPY ./db_property.json ./config/
COPY ./storj_config.json ./config/
ENTRYPOINT ["storj-mongodb"]
CMD ["-h"]
I noticed that it should work to run rsync the mounted volumes for persistent data storage and tar with gzip option, and then upload the tar.gz archive file with uplink. This way you would not have to connect storj with the docker container on which MongoDB runs, and be able to restore the database simply by downloading the archive with uplink and extracting it.
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