{"id":17766116,"url":"https://github.com/thedevelop3r/mongodb-backup-s3","last_synced_at":"2025-04-01T14:48:44.675Z","repository":{"id":170925583,"uuid":"647195490","full_name":"Thedevelop3r/mongodb-backup-s3","owner":"Thedevelop3r","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-30T10:09:06.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T09:33:03.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thedevelop3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-30T09:04:10.000Z","updated_at":"2023-05-30T09:04:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"7bb009ae-a646-4bb3-acb5-edba821e01d9","html_url":"https://github.com/Thedevelop3r/mongodb-backup-s3","commit_stats":null,"previous_names":["thedevelop3r/mongodb-backup-s3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thedevelop3r%2Fmongodb-backup-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thedevelop3r%2Fmongodb-backup-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thedevelop3r%2Fmongodb-backup-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thedevelop3r%2Fmongodb-backup-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thedevelop3r","download_url":"https://codeload.github.com/Thedevelop3r/mongodb-backup-s3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246659938,"owners_count":20813333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T20:23:38.214Z","updated_at":"2025-04-01T14:48:44.644Z","avatar_url":"https://github.com/Thedevelop3r.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongodb-backup-s3\n\nThis image runs mongodump to backup data using cronjob to an s3 bucket\n\n## Usage:\n\n```\ndocker run -d \\\n  --env AWS_ACCESS_KEY_ID=awsaccesskeyid \\\n  --env AWS_SECRET_ACCESS_KEY=awssecretaccesskey \\\n  --env BUCKET=s3bucket\n  --env MONGODB_HOST=mongodb.host \\\n  --env MONGODB_PORT=27017 \\\n  --env MONGODB_USER=admin \\\n  --env MONGODB_PASS=password \\\n  halvves/mongodb-backup-s3\n```\n\nIf you link `halvves/mongodb-backup-s3` to a mongodb container with an alias named mongodb, this image will try to auto load the `host`, `port`, `user`, `pass` if possible. Like this:\n\n```\ndocker run -d \\\n  --env AWS_ACCESS_KEY_ID=myaccesskeyid \\\n  --env AWS_SECRET_ACCESS_KEY=mysecretaccesskey \\\n  --env BUCKET=mybucketname \\\n  --env BACKUP_FOLDER=a/sub/folder/path/ \\\n  --env INIT_BACKUP=true \\\n  --link my_mongo_db:mongodb \\\n  halvves/mongodb-backup-s3\n```\n\nAdd to a docker-compose.yml to enhance your robotic army:\n\nFor automated backups\n```\nmongodbbackup:\n  image: 'halvves/mongodb-backup-s3:latest'\n  links:\n    - mongodb\n  environment:\n    - AWS_ACCESS_KEY_ID=myaccesskeyid\n    - AWS_SECRET_ACCESS_KEY=mysecretaccesskey\n    - BUCKET=my-s3-bucket\n    - BACKUP_FOLDER=prod/db/\n  restart: always\n```\n\nOr use `INIT_RESTORE` with `DISABLE_CRON` for seeding/restoring/starting a db (great for a fresh instance or a dev machine)\n```\nmongodbbackup:\n  image: 'halvves/mongodb-backup-s3:latest'\n  links:\n    - mongodb\n  environment:\n    - AWS_ACCESS_KEY_ID=myaccesskeyid\n    - AWS_SECRET_ACCESS_KEY=mysecretaccesskey\n    - BUCKET=my-s3-bucket\n    - BACKUP_FOLDER=prod/db/\n    - INIT_RESTORE=true\n    - DISABLE_CRON=true\n```\n\n## Parameters\n\n`AWS_ACCESS_KEY_ID` - your aws access key id (for your s3 bucket)\n\n`AWS_SECRET_ACCESS_KEY`: - your aws secret access key (for your s3 bucket)\n\n`BUCKET`: - your s3 bucket\n\n`BACKUP_FOLDER`: - name of folder or path to put backups (eg `myapp/db_backups/`). defaults to root of bucket.\n\n`MONGODB_HOST` - the host/ip of your mongodb database\n\n`MONGODB_PORT` - the port number of your mongodb database\n\n`MONGODB_USER` - the username of your mongodb database. If MONGODB_USER is empty while MONGODB_PASS is not, the image will use admin as the default username\n\n`MONGODB_PASS` - the password of your mongodb database\n\n`MONGODB_DB` - the database name to dump. If not specified, it will dump all the databases\n\n`EXTRA_OPTS` - any extra options to pass to mongodump command\n\n`CRON_TIME` - the interval of cron job to run mongodump. `0 3 * * *` by default, which is every day at 03:00hrs.\n\n`TZ` - timezone. default: `US/Eastern`\n\n`CRON_TZ` - cron timezone. default: `US/Eastern`\n\n`INIT_BACKUP` - if set, create a backup when the container launched\n\n`INIT_RESTORE` - if set, restore from latest when container is launched\n\n`DISABLE_CRON` - if set, it will skip setting up automated backups. good for when you want to use this container to seed a dev environment.\n\n## Restore from a backup\n\nTo see the list of backups, you can run:\n```\ndocker exec mongodb-backup-s3 /listbackups.sh\n```\n\nTo restore database from a certain backup, simply run (pass in just the timestamp part of the filename):\n\n```\ndocker exec mongodb-backup-s3 /restore.sh 20170406T155812\n```\n\nTo restore latest just:\n```\ndocker exec mongodb-backup-s3 /restore.sh\n```\n\n## Acknowledgements\n\n  * forked from [futurist](https://github.com/futurist)'s fork of [tutumcloud/mongodb-backup](https://github.com/tutumcloud/mongodb-backup)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedevelop3r%2Fmongodb-backup-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedevelop3r%2Fmongodb-backup-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedevelop3r%2Fmongodb-backup-s3/lists"}