{"id":21113086,"url":"https://github.com/lapwat/backup-to-bucket","last_synced_at":"2025-03-14T10:13:03.328Z","repository":{"id":50494952,"uuid":"513131377","full_name":"lapwat/backup-to-bucket","owner":"lapwat","description":"This Docker image let's you create different types of backup and upload it to a bucket.","archived":false,"fork":false,"pushed_at":"2022-10-27T16:00:22.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T04:27:27.098Z","etag":null,"topics":[],"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/lapwat.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":"2022-07-12T12:22:24.000Z","updated_at":"2022-08-04T10:49:01.000Z","dependencies_parsed_at":"2023-01-20T11:01:35.592Z","dependency_job_id":null,"html_url":"https://github.com/lapwat/backup-to-bucket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapwat%2Fbackup-to-bucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapwat%2Fbackup-to-bucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapwat%2Fbackup-to-bucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lapwat%2Fbackup-to-bucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lapwat","download_url":"https://codeload.github.com/lapwat/backup-to-bucket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243558484,"owners_count":20310574,"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-11-20T01:38:16.750Z","updated_at":"2025-03-14T10:13:03.307Z","avatar_url":"https://github.com/lapwat.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backup to bucket\n\nThis Docker image let's you create different types of backup and upload it to a bucket.\n\nIt works both ways, you can also retrieve a backup from a bucket and restore it.\n\nBackup types\n- [x] file / folder `.tar`\n- [x] MySQL `.sql`\n- [x] PostgreSQL `.sql`\n\nTransformations\n- [x] compression `.gz`\n- [x] encryption `.age`\n\nActions performed by `[backup.sh](backup.sh)`:\n- create the backup\n- compress the backup (optional)\n- encrypt the backup (optional)\n- create the bucket based on `BUCKET_NAME` and `MC_HOST_object-storage` environment variables with transition and expiry lifecycle rules (if it does not exist yet)\n- upload the backup to the bucket\n\nActions performed by `[restore.sh](restore.sh)`:\n- download the backup from the bucket\n- decrypt the backup (optional)\n- extract the backup (optional)\n- restore the backup\n\n## Run\n\n```sh\ndocker build -t ghcr.io/lapwat/sql-backup-to-bucket .\\\n\n# backup\ndocker run --env-file .env ghcr.io/lapwat/sql-backup-to-bucket backup\n\n# restore\ndocker run --env-file .env ghcr.io/lapwat/sql-backup-to-bucket restore\n```\n\n## Compression\n\nEnable backup compression by setting `COMPRESS` environment variable to `true`.\n\nDefault: No compression\n\n## Encryption\n\nEnable backup encryption by setting `AGE_PUBLIC_KEY` environment variable.\n\nDefault: No encryption\n\n### Decrypt the backup manually\n\n```\nage --decrypt -i key.txt CIPHER_NAME \u003e BACKUP_NAME\n```\n\n## Configuration examples\n\n### Backup a file / folder\n\nThis configuration creates a `${BACKUP_PREFIX}_YYYYmmddHHMMSS.tar.gz.age` archive of a file or folder.\n\n.env\n```\nCOMPRESS=true\nAGE_PUBLIC_KEY=agexxx\nBACKUP_TYPE=FILE\nBACKUP_FILENAME=/etc/hosts\nBACKUP_PREFIX=mybackup\nMC_HOST_object-storage=https://\u003cAccess Key\u003e:\u003cSecret Key\u003e@\u003cYOUR-S3-ENDPOINT\u003e\nBUCKET_NAME=mybucket\nBUCKET_TRANSITION_DAYS=7\nBUCKET_TRANSITION_STORAGE_CLASS=GLACIER\nBUCKET_EXPIRY_DAYS=90\n```\n\n### Backup a database\n\nThis configuration creates a `${BACKUP_PREFIX}_YYYYmmddHHMMSS.sql.gz.age` archive of a mysql database.\n\n.env\n```\nCOMPRESS=true\nAGE_PUBLIC_KEY=agexxx\nBACKUP_TYPE=MYSQL|POSTGRES\nDATABASE_HOST=localhost\nDATABASE_PORT=3306\nDATABASE_USER=root\nDATABASE_PASSWORD=password\nDATABASE_NAME=mydatabase\nBACKUP_PREFIX=mybackup\nMC_HOST_objectstorage=https://\u003cAccess Key\u003e:\u003cSecret Key\u003e@\u003cYOUR-S3-ENDPOINT\u003e\nBUCKET_NAME=mybucket\nBUCKET_TRANSITION_DAYS=7\nBUCKET_TRANSITION_STORAGE_CLASS=GLACIER\nBUCKET_EXPIRY_DAYS=90\n```\n\n### Restore a file / folder\n\nSimilarly, you can restore a file from a bucket\n\n.env\n```\nEXTRACT=true\nAGE_PRIVATE_KEY=AGE-SECRET-KEY-XXX\nBACKUP_TYPE=FILE\nRESTORE_DIRECTORY=/\nMC_HOST_object-storage=https://\u003cAccess Key\u003e:\u003cSecret Key\u003e@\u003cYOUR-S3-ENDPOINT\u003e\nBUCKET_NAME=mybucket\nBACKUP_NAME=mybackup_20221027000101.tar.gz.age\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapwat%2Fbackup-to-bucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flapwat%2Fbackup-to-bucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flapwat%2Fbackup-to-bucket/lists"}