I tried to deploy Meteor App
on DigitalOcean
.
And I would to auto backup my db to free cloud hosting.
Please help me.
Free mongodb hosting would probably be very limited. You may run mongo locally on DO server.
Let me know if you’re interested to host mongo at the same server as your app I can provide some useful links.
- Official Linux installation docs
- Installation on Ubuntu article by DO - Debian has pretty similar steps
- Official Mongo Docs for DO
- Meteor specific - OpLog tutorial and some extra tweaks for OpLog
Speaking of backup - I’ve upcoming tutorial for basic Linux + MongoDB backup to private GitHub repository. I can drop you a link once it’s ready if you’re interested.
Thanks again, I will try via your link.
Hmm, a private GitHub repository sounds like a pretty good idea. I’ve been backing up to Google Drive, with “folder versioning”, I think I’m going to switch to that!
I’ve set up a cronjob that does this every day:
cd /home/bq/GoogleDrive/mongodump
rm -rf yesterday
mv latest yesterday
mongodump -o latest
It’s not that great though, because if the error is not noticed for two days, the backup will have been overwritten, and I would have to rely on Google Drive’s file versioning, which is not guaranteed.
It’d be about as easy to set up a push to GitHub though. Just mongodump into a git repository and then commit all and push.
I use gitlab
for free private.
So could I auto backup mongodb to this?
Now I use digitalOcean and Linode
for deployment.
I set up github backup for myself now Here’s a guide:
1. Install git lfs, so that you can have files larger than 100 MB
2. Create a repository on github and clone it to your server.
3. In the repository directory, do the following:
git lfs track "*.bson"
git add .gitattributes
4. Write a shell script like this:
cd /home/bq
mongodump -o backup
cd backup
git add .
date=`date +'%A %d %B'`
git commit -m "$date"
git push
(backup is the name i chose for my repository, it can be whatever)
5. Test executing it manually to confirm that everything works.
6. Add the script to a daily cron job (google how to do that if you don’t know)
Btw, you only get 1 gb free LFS storage, then you have to pay $5 / month for up to 50 gb
very thanks, I will try soon
But I use Docker
.
Have the same solve?
Hope it’s not too late, I’m finally collected all our experience with automated backups into this Tutorial