{"id":19624976,"url":"https://github.com/williarin/secure-mysql-backups","last_synced_at":"2026-02-18T16:00:57.342Z","repository":{"id":45093679,"uuid":"444803121","full_name":"williarin/secure-mysql-backups","owner":"williarin","description":"Long-term retention for secure MySQL backups","archived":false,"fork":false,"pushed_at":"2022-08-10T15:05:11.000Z","size":30,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T12:52:53.521Z","etag":null,"topics":["backup","docker","docker-image","long-term-backup","mariadb","mysql"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/williarin/secure-mysql-backups","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/williarin.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}},"created_at":"2022-01-05T12:54:26.000Z","updated_at":"2025-06-19T05:44:20.000Z","dependencies_parsed_at":"2022-09-04T16:11:18.526Z","dependency_job_id":null,"html_url":"https://github.com/williarin/secure-mysql-backups","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/williarin/secure-mysql-backups","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williarin%2Fsecure-mysql-backups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williarin%2Fsecure-mysql-backups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williarin%2Fsecure-mysql-backups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williarin%2Fsecure-mysql-backups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williarin","download_url":"https://codeload.github.com/williarin/secure-mysql-backups/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williarin%2Fsecure-mysql-backups/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29585441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T13:56:48.962Z","status":"ssl_error","status_checked_at":"2026-02-18T13:54:34.145Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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","docker","docker-image","long-term-backup","mariadb","mysql"],"created_at":"2024-11-11T11:39:40.558Z","updated_at":"2026-02-18T16:00:57.322Z","avatar_url":"https://github.com/williarin.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Long-term retention for secure MySQL backups\n\nThis Docker image will backup your MySQL/MariaDB databases following the Grandfather-Father-Son (GFS) retention scheme.\n\n## Features\n\n* GFS backups retention scheme\n* AES256 encryption/decryption\n* Single or multiple databases backups\n* Grouped or individual archives\n* Parallelized compression\n\n## GFS retention scheme\n\nThis means that you'll always have:\n\n* A backup for every day of the last week (6)\n* A backup for every week of the last month (4)\n* A backup for every month of the last year (12)\n* A backup for every previous year (unlimited)\n\nFor a 100MB backup, it will cost you around 2GB for the current year + 100MB for each previous year.\n\nIn SuperSafe mode, you'll have:\n\n* A backup for every day of the last month (28~31)\n* A backup for every week of the last year (48)\n* A backup for every previous year (unlimited)\n\nFor a 100MB backup, backups will cost you around 8GB for the current year + 100MB for each previous year.\n\nBackups are run by default every day at 00:00 UTC.\n\n\n## Usage\n\n```bash\ndocker run -d \\\n    --network mysql \\\n    -e MYSQL_USER=root \\\n    -e MYSQL_PASSWORD=password \\\n    -e CHOWN_FILES='1000:1000' \\\n    -e MAX_CPU=4 \\\n    -v /path/to/backups:/backup \\\n    williarin/secure-mysql-backups:1\n```\n\n## Variables\n\nAll variables can be appended with `_FILE` in case you want to populate them from secrets.\n\nAs an example, you can use: `MYSQL_PASSWORD_FILE=/run/secret/mysql-root-password`\n\n\n| Variable | Description | Default |\n| -------- | ----------- | ------- |\n| `SUPERSAFE_MODE` | Run backups in SuperSafe mode. This means many more backups ([see details](#gfs-retention-scheme)). | `false` |\n| `MYSQL_HOST` | The host of your MySQL/MariaDB database. | `mysql` |\n| `MYSQL_PORT` | The port number of your MySQL/MariaDB database. | `3306` |\n| `MYSQL_USER` | The username of your MySQL/MariaDB database. | `root` |\n| `MYSQL_PASSWORD` | The username of your MySQL/MariaDB database. | empty |\n| `MYSQL_DATABASE` | The database name to dump, or a space separated list of databases to dump. | all user databases |\n| `CRON_MINUTE` | The minute interval of cron job to dump database. Don't use `CRON_TIME` if you use this. | `0` |\n| `CRON_HOUR` | The hour interval of cron job to dump database. Don't use `CRON_TIME` if you use this. | `0` |\n| `CRON_TIME` | The interval of cron job to dump database. Use it to override the cron job. Warning: overriding this variable my lead to inconsistent GFS backups. | `0 0 * * *` |\n| `BACKUP_NAME` | The name of the backup. It will produce files like `main-backup.day1-Monday.tgz` | `main-backup` |\n| `INDIVIDUAL_BACKUPS` | Set to true if you want to create one archive per database, instead of a global archive for all databases. It will produce files like `main-backup.my_db.day1-Monday.tgz`| `false` |\n| `MAX_CPU` | Maximum CPU count to use while compressing the archive. | all CPUs |\n| `CHOWN_FILES` | Set permissions to the created archives and files within them. | `root:root` |\n| `AES_PASSPHRASE` | If set, all archives will be encrypted with AES-256-CBC algorithm. | empty |\n\n\n## Manually run a backup\n\nIf you want to bypass the cron and run a manual backup, run this command:\n\n```bash\ndocker run --rm \\\n    --network mysql \\\n    -e MYSQL_USER=root \\\n    -e MYSQL_PASSWORD=password \\\n    -e CHOWN_FILES='1000:1000' \\\n    -e MAX_CPU=4 \\\n    -v /path/to/backups:/backup \\\n    williarin/secure-mysql-backups:1 \\\n    backup\n```\n\nThis will create a new file named `main-backup.day3-Wednesday.tgz` which you can untar normally.\n\n\n## Decrypting encrypted backup\n\nCurrently there's not yet an automatic backup restoration command.\n\nIn the meantime, use this script to decrypt an archive:\n\n```bash\ndocker run --rm \\\n    -e AES_PASSPHRASE=my_passphrase \\\n    -e CHOWN_FILES='1000:1000' \\\n    -v /path/to/backups:/backup \\\n    williarin/secure-mysql-backups:1 \\\n    decrypt main-backup.day3-Wednesday.tgz.aes\n```\n\nThis will create a new file named `main-backup.day3-Wednesday.tgz` which you can untar normally.\n\n\n## Usage with Docker Compose\n\n```yaml\nversion: '3.8'\n\nservices:\n    database:\n        image: mysql:8\n        restart: 'no'\n        environment:\n            - MYSQL_DATABASE=my_db\n            - MYSQL_ROOT_PASSWORD=root\n\n    backup:\n        image: williarin/secure-mysql-backups:1\n        restart: 'no'\n        volumes:\n            - ./backup:/backup\n        environment:\n            MYSQL_HOST: database\n            MYSQL_USER: root\n            MYSQL_PASSWORD: root\n            CHOWN_FILES: '1000:1000'\n            MAX_CPU: 4\n            AES_PASSPHRASE: my_passphrase\n```\n\nThen you can run a manual backup like this:\n\n```bash\ndocker compose run --rm backup backup\n```\n\nOr decrypting an archive:\n\n```bash\ndocker compose run --rm backup decrypt main-backup.day3-Wednesday.tgz.aes\n```\n\n## Available tags\n\nUse a numbered tag if you want to avoid BC breaks.\n\n* `1.1.0`, `1.1`, `1`, `latest`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliarin%2Fsecure-mysql-backups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliarin%2Fsecure-mysql-backups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliarin%2Fsecure-mysql-backups/lists"}