{"id":19263950,"url":"https://github.com/chris2k20/volumes-backup","last_synced_at":"2025-04-21T18:31:51.777Z","repository":{"id":133842798,"uuid":"363114072","full_name":"chris2k20/volumes-backup","owner":"chris2k20","description":"Migrate/Backup Docker-Volumes or Folders locally or to other Hosts (easy but safe)! This universal container will encrypt the backup-file and upload it to transfer.sh (see Environment- customize). Enables Migration to another platform (eg. from Docker to Kubernetes).","archived":false,"fork":false,"pushed_at":"2021-05-13T13:30:51.000Z","size":18,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T15:13:10.127Z","etag":null,"topics":["backup","container","docker","docker-compose","kubernetes","restore","volume"],"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/chris2k20.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-30T11:04:33.000Z","updated_at":"2024-12-26T05:22:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"856dd581-b17d-4f03-9bd6-495b5146e122","html_url":"https://github.com/chris2k20/volumes-backup","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/chris2k20%2Fvolumes-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2k20%2Fvolumes-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2k20%2Fvolumes-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris2k20%2Fvolumes-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chris2k20","download_url":"https://codeload.github.com/chris2k20/volumes-backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250111051,"owners_count":21376578,"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":["backup","container","docker","docker-compose","kubernetes","restore","volume"],"created_at":"2024-11-09T19:37:44.719Z","updated_at":"2025-04-21T18:31:51.769Z","avatar_url":"https://github.com/chris2k20.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker-Image: Universal volumes-backup\n\nPurpose: **Migrate/Backup Container-Volumes or Folders locally or to other Hosts (easy but safe)!**\n\nThis universal container will encrypt the backup-file and upload it to [transfer.sh](https://transfer.sh/) (see Environment-customize). Enables Migration to another platform (eg. from Docker to Kubernetes).\n\nNo magic, very simple: This Image creates a tar-Archive from a folder (your volumes), saves it encrypted and uploads it, so that only you (and you alone) can access it everywhere.\nThen the other way around (`MODE=restore`): download file (eg. `DOWNLOAD_URL=https://transfer.sh/U6TIL/backup-volumes.tar.gz.enc`), decrypt it and unzip it.\n\n## General Usage\n\n- Set your personal `KEY`, so that the backup-file can be safely AES-encrypted\n- Different Folders for backup- and restore-mode to make sure the program does not overwrite the backup-data:\n  - backup-mode: Mount your source folders into the container (ReadOnly): under `/volumes-backup/` (or customize `BACKUP_FOLDER=/volumes-backup/`)\n  - restore-mode: Mount your destination folders into the container: under `/volumes-restore/` (or customize `RESTORE_FOLDER=/volumes-restore/`)\n\nImportant: **Mount the right folders in the right container-path in backup- and restore-mode!** (any name, here `volume1-myfiles` and `volume2-otherfolder`)\n\n## Example:\n\n### Backup-Mode\n\nPart 1: The backup-mode to get a encrypted backup-file from the local folders `/home/user/myfolder/` and `/opt/otherfolder/`:\n\n```bash\ndocker run -it --rm \\\n  -e \"MODE=backup\" \\\n  -e \"KEY=MY_S3CReT_KeY\" \\\n  -v \"/home/user/myfolder/:/volumes-backup/volume1-myfiles:ro\" \\\n  -v \"/opt/otherfolder/:/volumes-backup/volume2-otherfolder:ro\" \\\n  --mount type=tmpfs,destination=/data \\\n  user2k20/volumes-backup\n```\nThe container **returns the unique url to the file**\n\n### Restore-Mode\n\nPart 2: Restore backup-file to the local folders `/home/user/myfolder/` and `/opt/otherfolder/`:\n\n```bash\ndocker run -it --rm \\\n  -e \"MODE=restore\" \\\n  -e \"KEY=MY_S3CReT_KeY\" \\\n  -e \"DOWNLOAD_URL=https://transfer.sh/YOURURL/backup-volumes.tar.gz.enc\" \\\n  -v \"/home/user/myfolder/:/volumes-restore/volume1-myfiles\" \\\n  -v \"/opt/otherfolder/:/volumes-restore/volume2-otherfolder\" \\\n  --mount type=tmpfs,destination=/data \\\n  user2k20/volumes-backup\n```\n\nTo backup **whole docker volumes**: replace the absolute path from the example above `/home/user/myfolder/` with the name of the volume `myvolume1` (Docker Like):\n\n```bash\n  -v \"myvolume1:/volumes-restore/volume1-myfiles\" \\\n```\n## Offline Usage\n\nNO ONLINE UPLOAD: The encrypted backup file will be saved to `/data/`, so create a volume under this path. If you set `UPLOAD_URL=` to zero, nothing gets uploaded.\n\n```bash\n# backup\ndocker run -it --rm \\\n  -e \"MODE=backup\" \\\n  -e \"UPLOAD_URL=\" \\\n  -e \"KEY=MY_S3CReT_KeY\" \\\n  -v \"myvolume1:/volumes-backup/volume1-myvolume1:ro\" \\\n  -v \"secondvolume:/volumes-backup/volume2-secondvolume:ro\" \\\n  -v \"data:/data/\" \\\n  user2k20/volumes-backup\n\n# restore\ndocker run -it --rm \\\n  -e \"MODE=restore\" \\\n  -e \"DOWNLOAD_URL=\" \\\n  -e \"KEY=MY_S3CReT_KeY\" \\\n  -v \"myvolume1:/volumes-restore/volume1-myvolume1\" \\\n  -v \"secondvolume:/volumes-restore/volume2-secondvolume\" \\\n  -v \"data:/data/\" \\\n  user2k20/volumes-backup\n```\n\n## Kubernetes Job\n\nAn example manifest, which will run once as Job. It will restore the backup to the volume claims (here mysql and wordpress volumes). Replace all environment variables and the volume parts:\n\n```yaml\napiVersion: batch/v1\nkind: Job\nmetadata:\n  name: volumes-backup\nspec:\n  template:\n    spec:\n      containers:\n      - name: volumes-backup\n        image: user2k20/volumes-backup\n        env:\n          - name: MODE\n            value: restore\n          - name: KEY\n            value: MY_S3CReT_KeY\n          - name: DOWNLOAD_URL\n            value: https://transfer.sh/YOURURL/backup-volumes.tar.gz.enc\n        volumeMounts:\n          - mountPath: /volumes-restore/volume1-wordpress\n            name: wordpress-claim0\n          - mountPath: /volumes-restore/volume2-mysql\n            name: mysql-claim0\n          - mountPath: /data\n            name: data-volume            \n      restartPolicy: Never\n      volumes:\n        - name: wordpress-claim0\n          persistentVolumeClaim:\n            claimName: wordpress-claim0\n        - name: mysql-claim0\n          persistentVolumeClaim:\n            claimName: mysql-claim0\n        - name: data-volume\n          emptyDir: {}            \n  backoffLimit: 0\n```\n\n## Environment Variables\n\n**`MODE`**\n\nThis variable is mandatory and specifies the modus `backup` or `restore`\n\n**`BACKUP_FOLDER`**\n\nSets the folder that will be backuped. Default: mount all your volumes under `/volumes-backup/`\n\n**`BACKUP_FILE_NAME`**\n\nThe default backup name: `backup-volumes.tar.gz.enc`\n\n**`BACKUP_FILE`**\n\nFull path and filename. Default is `/data/${BACKUP_FILE_NAME}`\n\n\n**`RESTORE_FOLDER`**\n\nWhere will the Backup be restored. Default is `/volumes-restore/`\n\n**`KEY`**\n\nThis variable is mandatory and specifies the encryption key.\n\n**`OPENSSL_PARAM`**\n\nParameters that are used to decrypt/encrypt the backup file. Default: `-aes-256-cbc`\n\n**`UPLOAD_URL`**\n\nFor the backup-mode: Sets the URL where the encrypted backups will be sent to. Default here is: `https://transfer.sh/${BACKUP_FILE_NAME}` (host your [own transfer.sh container](https://github.com/dutchcoders/transfer.sh) – *great work by these guys!*).\n\n**`DOWNLOAD_URL`**\n\nFor the restore-mode. Sets the download url, where is the backup file is saved. NO default. You need to set this variable to the output-URL of the backup-mode.\n\n## Contributions\n\nContributions are always welcome.\n\n## No guarantee and no support\n\nIf you find any mistakes or have an improvement, please leave a comment. 😋\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2k20%2Fvolumes-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris2k20%2Fvolumes-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris2k20%2Fvolumes-backup/lists"}