Sign inSign up

strawpay/backup-to-s3

By strawpay

•Updated over 10 years ago

Backup of a volume to S3. tar, zip and encrypt. https://github.com/strawpay/docker-backup-to-s3

Image
2

50K+

strawpay/backup-to-s3 repository overview

⁠strawpay/backup-to-s3

Docker container that periodically backups files to Amazon S3 using s3cmd⁠ and cron. All files will be tar:ed and encrypted with AES 256 CBC.

Always test to restore the files from the backup, before relying on it.

To decrypt resulting s3 object 2016-04-11T07:25:30Z.tgz.aes:

openssl aes-256-cbc -k <PASSPHRASE> -in 2016-04-11T07:25:30Z.tgz.aes -out restore.tgz -d
tar xf restore.tgz
⁠Usage
docker run -d [options] strawpay/backup-to-s3 backup-once|schedule|restore
  • Backup: Make a single backup and exit.
  • Schedule: Schedule backups with using cron.
  • Restore: Restore a backup,
⁠Options
NameOperationRequiredDescription
-e ACCESS_KEY=<AWS_KEY>allyesYour AWS key
-e SECRET_KEY=<AWS_SECRET>allyesYour AWS secret
-e S3_PATH=s3://<BUCKET_NAME>/<PATH>/allyesS3 Bucket name and path. Should end with trailing slash.
-e AES_PASSPHRASE=<PASSPHRASE>allyesPassphrase to generate AES-256-CBC encryption keys with.
-e VERSION=<VERSION_TO_RESTORE>restoreyesThe version to restore, must be the full s3 object name without the tgz.aes suffix.
-e PARAMS="--dry-run"allnoParameters to pass to the s3 command. (full list here)⁠
-e DATA_PATH=/data/allnoContainer's data folder. Default is /data/. Should end with trailing slash.
-e PREFIX=prefixbackup-once, schedulenoPrefix to encrypted tgz file name. The basename is a date stamp with a tgz.aes suffix
-e CRON_SCHEDULE='5 3 * * *'schedulenoSpecifies when cron job runs, see format⁠. Default is 5 3 * * *, runs every night at 03:05
-v /path/to/backup:/data:robackup-once, scheduleyesMount target local folder to container's data folder. Content of this folder will be tar:ed, encrypted and uploaded to the S3 bucket.
-v /path/to/restore:/datarestoreyesMount target local folder to container's data folder. The restored files from the S3 bucket will overwrite all files in the /path/to/restore folder. Note that the folder will not be emptied first, leaving any no overwritten files as is.
⁠Examples:
⁠Backup to S3 everyday at 12:00:
docker run -d \
	-e ACCESS_KEY=myawskey \
	-e SECRET_KEY=myawssecret \
 	-e S3_PATH=s3://my-bucket/backup/ \
	-e AES_PASSPHRASE=secret \
	-e CRON_SCHEDULE='0 12 * * *' \
	-v /home/user/data:/data:ro \
	strawpay/backup-to-s3 schedule
⁠Backup once and then delete the container:
docker run --rm \
	-e ACCESS_KEY=myawskey \
	-e SECRET_KEY=myawssecret \
	-e S3_PATH=s3://my-bucket/backup/ \
	-e AES_PASSPHRASE=secret \
	-v /home/user/data:/data:ro \
	strawpay/backup-to-s3 backup-once
⁠Restore the backup from 2016-04-11T07:25:30Z and then delete the container:
docker run --rm \
	-e ACCESS_KEY=myawskey \
	-e SECRET_KEY=myawssecret \
 	-e S3_PATH=s3://my-bucket/backup/ \
  	-e AES_PASSPHRASE=secret \
 	-e VERSION=2016-04-11T07:25:30Z\
	-v /home/user/data:/data \
	strawpay/backup-to-s3 restore
    

Source at https://github.com/strawpay/docker-backup-to-s3⁠ Forked from https://github.com/istepanov/docker-backup-to-s3⁠

Tag summary

Content type

Image

Digest

Size

137.5 MB

Last updated

over 10 years ago

docker pull strawpay/backup-to-s3