{"id":19237149,"url":"https://github.com/extalionlab/docker-backup","last_synced_at":"2026-01-25T19:35:38.298Z","repository":{"id":129303088,"uuid":"383413100","full_name":"eXtalionLab/docker-backup","owner":"eXtalionLab","description":"Make a backup of your docker-compose stack","archived":false,"fork":false,"pushed_at":"2024-06-25T18:47:03.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T17:09:27.992Z","etag":null,"topics":["backup","borg","docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eXtalionLab.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":"2021-07-06T09:28:37.000Z","updated_at":"2024-06-25T18:47:06.000Z","dependencies_parsed_at":"2024-11-09T16:27:26.378Z","dependency_job_id":"32ec0b82-88fe-4f73-8005-dbbfcd9a20d6","html_url":"https://github.com/eXtalionLab/docker-backup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eXtalionLab/docker-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fdocker-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fdocker-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fdocker-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fdocker-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eXtalionLab","download_url":"https://codeload.github.com/eXtalionLab/docker-backup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eXtalionLab%2Fdocker-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28757363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["backup","borg","docker","docker-compose"],"created_at":"2024-11-09T16:25:00.178Z","updated_at":"2026-01-25T19:35:38.268Z","avatar_url":"https://github.com/eXtalionLab.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-backup\n\nMake a backup of your `docker-compose` stack. It's simple, init\n[BorgBackup](https://www.borgbackup.org/) repository, dump database, \"build\" a\ncommand to create a files backup and do it.\n\n---\n\n- [Install](#install)\n\t- [Requirements](#requirements)\n- [Backup](#backup)\n\t- [Init](#init)\n\t- [Run](#run)\n\t- [Restore](#restore)\n- [Example](#example)\n\n## Install\n\nJust clone this repository\n\n```bash\nclone git@github.com:eXtalionLab/docker-backup.git .\n```\n\nand create a link to the script **docker-backup**\n\n```bash\nsudo ln -sr docker-backup/docker-backup /usr/local/bin/docker-backup\n```\n\n### Requirements\n\n**BorgBackup** has to be\n[installed](https://borgbackup.readthedocs.io/en/stable/installation.html) on\nlocal machine!\n\n## Backup\n\n### Init\n\nGoto directory with the app that you want to backup and run:\n\n```bash\ndocker-backup install\n```\n\nIt will create a new file **.docker-backup.dist**:\n\n```bash\n###\u003e config ###\nbackupDir='backups'\ndockerDbServiceName='db'\n# Use local image to skip download\ndockerImgToBackupVolumes='alpine'\ndockerVolumesDir='docker_volumes'\n# Allow types: custom, mariadb, mongo, mysql, postgresql\ndbType='mysql'\nenvFile='.env'\n###\u003c config ###\n\n###\u003e files/volumes to backup ###\nfilesToBackup=( \\\n  \"${envFile}\" \\\n)\nfilesToExclude=()\n# Remember to prefix volumes with docker-compose project name\nvolumesToBackup=()\n###\u003c files/volumes to backup ###\n\n###\u003e borg ###\nexport BORG_REPO='backups/app'\nexport BORG_PASSPHRASE='Change_me!'\n###\u003c borg ###\n```\n\n| Config name | Type | Default value | Description |\n|--|--|--|--|\n| backupDir | `string` | `backups` | It's a directory where backup logs will be stored. |\n| dockerDbServiceName | `string` | `db` | It's a name of your `docker-compose` database service. |\n| dockerImgToBackupVolumes | `string` | `alpine` | You can put here your image name just to skip download new one. |\n| dockerVolumesDir | `string` | `docker_volumes` | Where to temporary store a files from `docker` volumes. |\n| dbType | `string` | `mysql` | What kind of database are you using? Allow types are: `custom`, `mariadb`, `mongo`, `mysql`, `postgresql`. |\n| envFile | `string` | `.env` | File from where we will read data to connect to database. For `mariadb`/`mysql` we require `MYSQL_DATABASE`, `MYSQL_PASSWORD`, `MYSQL_USER`. For `mongo` we require `MONGO_DATABASE`, `MONGO_USER`, `MONGO_PASSWORD`. For `postgresql` we require `POSTGRES_DB`, `POSTGRES_USER`. |\n| filesToBackup | `array` | `[ ${envFile} ]` | Files/directories to backup. |\n| filesToExclue | `array` | `[]` | Files/directories to exclude from backup. Eg. `var`, `cache`, `*.log`. |\n| volumesToBackup | `array` | `[]` | Volumes to backup. Remember to prefix them with project name |\n| BORG_REPO | `string` | `backups/app` | Where to store a backup. It can be a local directory or remote path via `ssh`. |\n| BORG_PASSPHRASE | `string` | `Change_me!` | Password to protect a backup. |\n\nFile **.docker-backup.dist** is good as a template. See example\n[here](https://github.com/eXtalionLab/prestashop_docker/blob/master/.docker-backup.dist)\nfor Prestashop. After that in specific project you should create a\n**.docker-backup** (`cp .docker-backup.dist .docker-backup`) file, \"fix\" an\nadmin directory name and `BORG_*` config.\n\nRead more about `BORG_*` config\n[here](https://borgbackup.readthedocs.io/en/stable/usage/general.html#environment-variables).\n\n### Run\n\nWhen you're done with **.docker-backup[.dist]** file(s) just run:\n\n```bash\ndocker-backup run\n```\n\nand wait for a result.\n\n### Restore\n\nHow to restore borg's backup you can read\n[here](https://borgbackup.readthedocs.io/en/stable/quickstart.html#restoring-a-backup).\n\nYou should shutdown `docker-compose` stack before restore a backup:\n\n```bash\ndocker compose down [-v]\n```\n\nThe basic option is to run:\n\n```bash\nsource .docker-backup[.dist]\nborg list\n# Choose which backup to restore\nborg extract ::${backup_to_restore} -p\n```\n\nThen start up your stack and wait when database will be ready:\n\n```bash\ndocker compose up [-d]\n```\n\nIf you have any volumes, it's time to restore them:\n\n```bash\ndocker-backup restore_volumes\n```\n\n## Example\n\nGoto an [example/](example/README.md) directory to see how to use\n`docker-backup`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextalionlab%2Fdocker-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextalionlab%2Fdocker-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextalionlab%2Fdocker-backup/lists"}