{"id":23542384,"url":"https://github.com/neo9/mongodb-backups","last_synced_at":"2025-10-26T14:35:29.349Z","repository":{"id":46958440,"uuid":"196590865","full_name":"neo9/mongodb-backups","owner":"neo9","description":"Backup MongoDB dumps to S3 or GCS","archived":false,"fork":false,"pushed_at":"2025-02-25T21:46:35.000Z","size":229,"stargazers_count":5,"open_issues_count":2,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-23T22:02:47.754Z","etag":null,"topics":["aws-s3","backup","docker","kubernetes","mongodb","mongodb-backups"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neo9.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2019-07-12T14:12:41.000Z","updated_at":"2025-02-25T21:46:38.000Z","dependencies_parsed_at":"2025-01-23T09:20:15.151Z","dependency_job_id":"8ebafd7b-f1d4-4906-916a-be49cf15e449","html_url":"https://github.com/neo9/mongodb-backups","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/neo9/mongodb-backups","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fmongodb-backups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fmongodb-backups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fmongodb-backups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fmongodb-backups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neo9","download_url":"https://codeload.github.com/neo9/mongodb-backups/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo9%2Fmongodb-backups/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270422586,"owners_count":24580829,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aws-s3","backup","docker","kubernetes","mongodb","mongodb-backups"],"created_at":"2024-12-26T06:11:48.168Z","updated_at":"2025-10-26T14:35:29.342Z","avatar_url":"https://github.com/neo9.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDB backup\n\n[![Build Status](https://travis-ci.org/neo9/mongodb-backups.svg?branch=master)](https://travis-ci.org/neo9/mongodb-backups)\n\n\nCreate MongoDB snapshots to an encrypted S3 bucket.\nHandle snapshot restoration from backup.\nCan be easily monitored by Prometheus.\n\n[Docker repository](https://hub.docker.com/r/neo9sas/mongodb-backups)\n\n## Usage\n\n```bash\n# Launch server \u0026 scheduler\n./mongodb-backups --config ./config.yaml\n# List backup\n./mongodb-backups --config ./config.yaml --list\n# Restore specific backup\n./mongodb-backups --config ./config.yaml --restore [id] --args '--drop'\n# Restore last backup\n./mongodb-backups --config ./config.yaml --restore-last --args '--drop'\n# Arbitrary dump\n./mongodb-backups --config ./config.yaml --dump\n```\n\nParameters:\n\n- `--config`: Config path. Default `./config.yaml`\n- `--list`: list backups\n- `--restore`: Restore specific backup from snapshot\n- `--restore-last`: Restore last backup from snaphost\n- `--args`: MongoDB restore additional arguments\n\n## Config file\n\n- `name`: backup name\n- `schedule`: cronjob schedule. Example: `0 * * * *`\n- `retention`: max retention. Example: `2d`, `1w`, `1M`, `720h`\n- `timeout`: mongodb dump timeout\n- `tmpPath`: path to store tempory backup before s3 upload\n- `mongodb`:\n    - `host`: MongoDB host (ignored if `MONGO_URI` is set)\n    - `port`: MongoDB port (ignored if `MONGO_URI` is set)\n- `bucket` (fill only one option):\n    - `s3`:\n        - `name`: bucket name\n        - `region`: bucket region\n  - `gs`:\n      - `name`: bucket name\n  - `minio`:\n      - `name`: bucket name\n      - `host`: bucket hostname (and port if required)\n      - `region`: (optional) bucket region\n      - `ssl`: (optional) Enable SSL\n\nExample:\n\n```yaml\nname: integration\nretention: 1w\nschedule: '0 0 * * *'\ntimeout: 15m\ntmpPath: /tmp\nmongodb:\n  host: localhost\n  port: 27017\n# host and port can be omitted when MONGO_URI environment variable is provided\ncreateDump:\n  maxRetries: 3\n  retryDelay: 60\nbucket:\n  s3:\n    name: bucket-name\n    region: eu-west-1\n```\n\nExample of instant backup start :\n\n```yaml\nkubectl apply -f ./k8s/backup.yaml\n# then watch status\nwatch kubectl -n tools get jobs\n```\n\n## Prometheus metrics\n\n- `mongodb_backups_scheduler_backup_total`: Total number of backups (status: success / error)\n- `mongodb_backups_scheduler_retention_total`: Total number of successful retention cleanup (status: success / error)\n- `mongodb_backups_scheduler_bucket_snapshot_count`: Current number of snapshots in the bucket\n- `mongodb_backups_scheduler_snapshot_size`: Last snapshot size in bytes\n- `mongodb_backups_scheduler_snapshot_latency`: Last snapshot duration in seconds\n- `mongodb_backups_scheduler_last_successful_snaphot`: Last successful snapshot timestamp\n\nAll metrics have the label `name` equals to the config `name` key.\n\n## Environment variables\n\n### Global\n\n- `MONGODB_USER`: MongoDB user\n- `MONGODB_PASSWORD`: MongoDB password\n- `MONGODB_AUTH_ARGS`: MongoDB additional authentication arguments\n- `MONGO_URI`: MongoDB connection string URI (overrides host, port, user and password)\n\n### AWS\n\n- `AWS_ACCESS_KEY_ID`: AWS access key ID (optional)\n- `AWS_SECRET_ACCESS_KEY`: AWS secret access key (optional)\n\nWhen running in Kubernetes with a service account that has the appropriate\nbucket permissions (for example IAM Roles for Service Accounts), the\napplication automatically uses the service account credentials and these\nvariables are not required.\n\n### Minio\n\n- `MINIO_ACCESS_KEY_ID`: Minio secret key ID\n- `MINIO_SECRET_ACCESS_KEY`: Minio secret access key\n\n## AWS\n\nS3 policy example:\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Sid\": \"0\",\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:PutObject\",\n        \"s3:GetObject\",\n        \"s3:ListObject\",\n        \"s3:DeleteObject\"\n      ],\n      \"Resource\": [\n        \"arn:aws:s3:::my-bucket-name\",\n        \"arn:aws:s3:::my-bucket-name/*\"\n      ]\n    }\n  ]\n}\n```\n\n## Development\n\nThe changelog is generated by [git-chglog](https://github.com/git-chglog/git-chglog)\n\nYou must follow the given commit syntax: `\u003citem\u003e: \u003cdescription\u003e`\n\nGenerate the changelog:\n```sh\ngit-chglog -o CHANGELOG.md\n```\n\n### Run\n\n```bash\n# With Go\ngo run ./cmd --config config.yaml\n\n# With Docker\ndocker build -t n9-backup .\ndocker run --rm -v /tmp/config:/tmp/config n9-backup mongodb-backups --config /tmp/config/config.yaml\n\n#With Docker compose\ndocker-compose -f docker-compose.yaml up \ndocker exec n9-backup-dev mongodb-backups --config ./home/config.yaml\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo9%2Fmongodb-backups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo9%2Fmongodb-backups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo9%2Fmongodb-backups/lists"}