{"id":13492965,"url":"https://github.com/christophetd/duplicacy-autobackup","last_synced_at":"2026-04-02T02:43:44.338Z","repository":{"id":31939295,"uuid":"130188459","full_name":"christophetd/duplicacy-autobackup","owner":"christophetd","description":":floppy_disk: Painless automated backups to multiple storage providers with Docker and duplicacy.","archived":false,"fork":false,"pushed_at":"2022-11-06T05:13:08.000Z","size":55,"stargazers_count":248,"open_issues_count":4,"forks_count":42,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-02T09:08:04.569Z","etag":null,"topics":["automated-backup","azure","backblaze-b2","backup","docker","duplicacy","hubic","s3"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/christophetd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-19T09:03:07.000Z","updated_at":"2025-03-25T17:58:55.000Z","dependencies_parsed_at":"2023-01-14T20:09:48.763Z","dependency_job_id":null,"html_url":"https://github.com/christophetd/duplicacy-autobackup","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophetd%2Fduplicacy-autobackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophetd%2Fduplicacy-autobackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophetd%2Fduplicacy-autobackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophetd%2Fduplicacy-autobackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christophetd","download_url":"https://codeload.github.com/christophetd/duplicacy-autobackup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027411,"owners_count":21035594,"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":["automated-backup","azure","backblaze-b2","backup","docker","duplicacy","hubic","s3"],"created_at":"2024-07-31T19:01:10.890Z","updated_at":"2026-04-02T02:43:44.305Z","avatar_url":"https://github.com/christophetd.png","language":"Shell","funding_links":[],"categories":["Shell","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# Duplicacy Autobackup\n\n![build status](https://github.com/christophetd/duplicacy-autobackup/actions/workflows/.github/workflows/test-integration.yml/badge.svg)\n![latest version](https://img.shields.io/github/v/release/christophetd/duplicacy-autobackup)\n\nDuplicacy Autobackup is a Docker image to easily perform automated backups. It uses [duplicacy](https://github.com/gilbertchen/duplicacy) under the hood, and therefore supports:\n\n- Multiple storage backends: S3, Backblaze B2, Hubic, Dropbox, SFTP...\n- Client-side encryption\n- Deduplication\n- Multi-versioning\n- ... and more generally, all the features that duplicacy has.\n\n## Usage\n\nThe following environment variables can be used to configure the backup strategy.\n\n- `BACKUP_NAME`: The name of your backup (should be unique, e.g. `prod-db-backups`)\n- `BACKUP_ENCRYPTION_KEY`: An optional passphrase to encrypt your backups with before they are stored remotely.\n- `BACKUP_SCHEDULE`: Cron-like string to define the frequency at which backups should be made (e.g. `0 2 * * *` for `Every day at 2am`). Note that this string should be indicated in the UTC timezone.\n- `BACKUP_LOCATION`: [Duplicacy URI](https://github.com/gilbertchen/duplicacy/wiki/Storage-Backends) of where to store the backups.\n    - S3: `s3://region@amazon.com/bucket/path/to/storage`\n    - Backblaze B2: `b2://my-bucket/`\n    - ...\n\nAdditionally, the directory you want to backup must be mounted to `/data` on the container.\n\nYou need to provide credentials for the storage provider your of your choice using the following environment variables:\n\n- AWS S3: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY`\n- Backblaze B2: `B2_ID` and `B2_KEY`\n- Dropbox: `DROPBOX_TOKEN`\n- Azure: `AZURE_KEY`\n- Google Cloud Datastore: `GCD_TOKEN`\n- SSH/SFTP: `SSH_PASSWORD` or `SSH_KEY_FILE`*\n- Hubic: `HUBIC_TOKEN_FILE`*\n- Google Cloud Storage: `GCS_TOKEN_FILE`*\n- Onedrive: `ONEDRIVE_TOKEN_FILE`*\n- Onedrive Business: `ONEDRIVE_BUSINESS_TOKEN_FILE`*\n- Wasabi: `WASABI_KEY` and `WASABI_SECRET`\n\n*Environment variables marked with an asterix point to files. Those files must be mounted in the container so that they can be accessed from inside it*.\n\nIf you want to execute an out of schedule backup, you can do so by running the script `/app/backup.sh` inside the container :\n\n``` \n$ docker exec duplicacy-autobackup /app/duplicacy-autobackup.sh backup\n```\n\n## Example\n\nBackup `/var/lib/mysql` to the S3 bucket `xtof-db-backups` in the AWS region `eu-west-1` every night at 2:00am, and encrypt them with the passphrase `correct horse battery staple`:\n\n```bash\n$ docker run -d --name duplicacy-autobackup \\\n    -v /var/lib/mysql:/data \\\n    -e BACKUP_NAME='prod-db-backups' \\\n    -e BACKUP_LOCATION='s3://eu-west-1@amazon.com/xtof-db-backups' \\\n    -e BACKUP_SCHEDULE='0 2 * * *' \\\n    -e BACKUP_ENCRYPTION_KEY='correct horse battery staple' \\\n    -e AWS_ACCESS_KEY_ID='AKIA...' \\\n    -e AWS_SECRET_KEY='...' \\\n    ghcr.io/christophetd/duplicacy-autobackup:v1.4.0\n```\n\n## Viewing and restoring backups\n\nBackups are useless if you don't make sure they work. This shows the procedure to list files, versions, and restore a duplicacy backup made using duplicacy-autobackup.\n\n- Install Duplicacy: download the latest Duplicacy binary from its [Github page](https://github.com/gilbertchen/duplicacy/releases), and put it in your path\n\n- `cd` to a directory where you'll restore your files, e.g. `/tmp/restore`\n\n- Run `duplicacy init backup_name backup_location`, where `backup_name` and `backup_location` correspond to the `BACKUP_NAME` and `BACKUP_LOCATION` environment variables of your setup.\n    - **If you used client-side encryption, add the `-encrypt` flag**: `duplicacy init -encrypt backup_name backup_location`\n\n  You will get a prompt asking for your storage provider's credentials, and, if applicable, your encryption key:\n\n  ```\n  Enter S3 Access Key ID: *****\n  Enter S3 Secret Access Key: *************\n  Enter storage password for s3://eu-west-1@amazon.com/xtof-db-backups:*******************\n  The storage 's3://eu-west-1@amazon.com/xtof-db-backups' has already been initialized\n  Compression level: 100\n  Average chunk size: 4194304\n  Maximum chunk size: 16777216\n  Minimum chunk size: 1048576\n  Chunk seed: fc7e56fb91f8f66b01ba033ec6f7b128bcb3420c66a31468a4f3541407d569bd\n  /tmp/restore will be backed up to s3://eu-west-1@amazon.com/xtof-db-backups with id db-backups\n  ```\n\n- To list the versions of your backups, run:\n\n  ```\n  $ duplicacy list\n  Storage set to s3://eu-west-1@amazon.com/xtof-db-backups\n  Enter storage password:*******************\n  Snapshot db-backups revision 1 created at 2018-04-19 09:47 -hash\n  Snapshot db-backups revision 2 created at 2018-04-19 09:48 \n  Snapshot db-backups revision 3 created at 2018-04-19 09:49 \n  ```\n\n- To view the files of a particular revision, run:\n\n  ```bash\n  $ duplicacy list -files -r 2  # 2 is the revision number\n  ```\n\n- To restore in the current directory all the files matching `*.txt` of the revision 2 of the backup, run:\n\n  ```bash\n  $ duplicacy restore -r 2 '*.txt'\n  ```\n\n- To restore in the current directory the whole revision 2 of your backup, run:\n\n  ```\n  $ duplicacy restore -ignore-owner -r 2\n  ```\n\nMore: see [Duplicacy's documentation](https://github.com/gilbertchen/duplicacy/wiki).\n\n## Other options\n\nYou can have duplicacy-autobackup run a script before and after the backup process by mounting scripts on `/scripts/pre-backup.sh` and `/scripts/post-backup.sh`. For instance if you're backing up a MySQL database, this script can involve doing a `mysqldump` into `/data/mydb.sql`. If `pre-backup.sh` exits with a non-zero status code, the backup will not be performed until the next scheduled backup.\n\nUse the following environment variables if you want to customize duplicacy's behavior.\n\n- `BACKUP_IMMEDIATELY` (`yes`/`no`): indicates if a backup should be performed immediately after the container is started. Equivalent to launching the container and then running `docker exec duplicacy-autobackup /app/duplicacy-autobackup.sh backup`. By default, `no`.\n- `DUPLICACY_INIT_OPTIONS`: options passed to `duplicacy init` the first time a backup is made. By default, `-encrypt` if `BACKUP_ENCRYPTION_KEY` is not empty.\n- `DUPLICACY_BACKUP_OPTIONS`: options passed to `duplicacy backup` when a backup is performed. By default: `-threads 4 -stats`. **If you are backing up a hard drive (and not a SSD), it is recommended to use `-threads 1 -stats` instead** (see [here](https://duplicacy.com/issue?id=5670666258874368) for more details).\n\n### Pruning old backups\n\nDuplicacy offers an option to [prune](https://forum.duplicacy.com/t/prune-command-details/1005) old backups. By default, duplicacy-autobackup does _not_ perform any pruning. However, you can set the environment variables `DUPLICACY_PRUNE_OPTIONS` and `PRUNE_SCHEDULE` to perform automatic pruning. As an example, setting:\n\n```\nDUPLICACY_PRUNE_OPTIONS='-keep 0:360 -keep 30:180 -keep 7:30'\nPRUNE_SCHEDULE='0 0 * * *'\n```\n\nMeans that:\n- Every day at midnight, the pruning process runs\n- When the pruning process runs...\n   - Any backup older than 1 year is deleted from the remote storage\n   - Only 1 backup per 30 days is kept for backups between 180 days and 360 days old\n   - Only 1 backup per 7 days is kept for backups between 7 days and 180 days old\n   - 1 backup per day is kept for backups between 0 day and 7 days old\n\n\n See the [prune command details](https://forum.duplicacy.com/t/prune-command-details/1005) for further details.\n\n\n## Choosing the Duplicacy version\n\nWhen building the container, you can choose the Duplicacy version that will be used in the container image. The build argument `DUPLICACY_VERSION` is available for that purpose, e.g.:\n\n```\ndocker build --build-arg DUPLICACY_VERSION=2.1.0 -t christophetd/duplicacy-autobackup .\n```\n\n## Disclaimer\n\nThis project uses [Duplicacy](https://github.com/gilbertchen/duplicacy), which is free for personal use but requires [purchasing a licence](https://duplicacy.com/buy.html) for non-trial commercial use. See the detailed terms [here](https://github.com/gilbertchen/duplicacy/blob/master/LICENSE.md).\n\n## Contact\n\nFeel free to [open an issue](https://github.com/christophetd/duplicacy-autobackup/issues/new) for any suggestion or bug. You can also tweet [@christophetd](https://twitter.com/christophetd).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophetd%2Fduplicacy-autobackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophetd%2Fduplicacy-autobackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophetd%2Fduplicacy-autobackup/lists"}