Created
March 3, 2016 21:10
-
-
Save pablitoc/53ba1bc9ebce66c1d8d9 to your computer and use it in GitHub Desktop.
mongo_backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#ENV Variables | |
MONGO_HOST= | |
MONGO_PORT= | |
MONGO_DB_NAME= | |
MONGO_USERNAME= | |
MONGO_PASSWORD= | |
APP_PATH= | |
APP_NAME= | |
mongodump --host $MONGO_HOST --port $MONGO_PORT --db $MONGO_DB_NAME -u $MONGO_USERNAME -p $MONGO_PASSWORD --out '$APP_PATH'/dbbackups/backup_$(date +\%Y\%m\%d) && cd '$APP_PATH'/dbbackups && tar -zcf backup_$(date +\%Y\%m\%d).tar.gz backup_$(date +\%Y\%m\%d)/$APP_NAME | |
AWS S3 sync '$APP_PATH'/dbbackups/backup_$(date +\%Y\%m\%d).tar.gz s3://mongo_backups/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@pjkelly this is what I have so far. So I have been looking around and also reading Composes documentation Compose Backup Documentation and it looks like they are not flexible with their backup schedules. But they offer points as to how to create your own. So I went with it and was able to create this little script that can run as a cron job on a worker server. It is still a work in progress but at least you can see what is going on here.