Code Monkey home page Code Monkey logo

docker-s3backup's Introduction

docker-s3backup

dokku/s3backup

Info

Docker image that creates and streams a tar backup of a host volume to Amazon S3 storage.

  • Lightweight: Based on the Alpine base image
  • Fast: Backups are streamed directly to S3 with awscli
  • Versatile: Can also be used with selfhosted S3-compatible services like minio

Usage

Run the automated build, specifying your AWS credentials, bucket name, and backup path.

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -v /path/to/backup:/backup dokku/s3backup

Advanced Usage

Example with different region, different S3 storage class, different signature version and call to S3-compatible service (different endpoint url)

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e AWS_DEFAULT_REGION=us-east-1 \
      -e AWS_SIGNATURE_VERSION=s3v4 \
      -e S3_STORAGE_CLASS=STANDARD_IA \
      -e ENDPOINT_URL=https://YOURAPIURL \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -v /path/to/backup:/backup dokku/s3backup

Encryption

You can optionally encrypt your backup using GnuPG. To do so, set ENCRYPTION_KEY. This would encrypt the backup with the passphrase "your_secret_passphrase". The cypher algorithm used is AES256.

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -e ENCRYPTION_KEY=your_secret_passphrase
      -v /path/to/backup:/backup dokku/s3backup

You can also use a GPG public key to encrypt the backup. To do so, set ENCRYPTION_KEY to the public key. This would encrypt the backup with the public key. The backup can only be decrypted with the corresponding private key, making it impossible to encrypt your data even if the backups and all the configuration files are compromised.

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -e ENCRYPT_WITH_PUBLIC_KEY_ID=public_key_id \
      -v /path/to/backup:/backup dokku/s3backup

In the above command, replace public_key_id with the ID (or, even better, the fingerprint) of your GPG public key. The backup will be encrypted using this public key and can only be decrypted with the corresponding private key. Please note that the public key must be available on the keyserver specified by the KEYSERVER environment variable. By default, this is set to hkp://keyserver.ubuntu.com and can be overridden by setting the KEYSERVER environment variable:

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -e ENCRYPT_WITH_PUBLIC_KEY_ID=public_key_id \
      -e KEYSERVER=hkp://pgp.mit.edu \
      -v /path/to/backup:/backup dokku/s3backup

Building

First, build the image.

docker build -t s3backup .

Then run the image, specifying your AWS credentials, bucket name, and backup path.

docker run -it \
      -e AWS_ACCESS_KEY_ID=ID \
      -e AWS_SECRET_ACCESS_KEY=KEY \
      -e BUCKET_NAME=backups \
      -e BACKUP_NAME=backup \
      -v /path/to/backup:/backup s3backup

docker-s3backup's People

Contributors

alexanderbabel avatar danelder avatar dependabot-preview[bot] avatar dependabot[bot] avatar djdefi avatar josegonzalez avatar luflow avatar mykolasolodukha avatar rosario-raulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-s3backup's Issues

"awk: cmd. line:1: Unexpected token" - issue with dokku/s3backup:0.9.1?

Hey,

I'm creating an issue here as I can't do it on https://github.com/dokku/docker-s3backup.

Issue

When using dokku-postgres 1.4.12, I can create DB backups fine.
However, after having updated to latest (1.6.0), I have an error awk: cmd. line:1: Unexpected token.

I actually have the exact same error when trying to do DB backup with dokku-mariadb 1.6.0, as well as when using directly latest dokku/s3backup — however, using the latest dokkupaas/s3backup works fine.

Log

$ dokku plugin:list | grep postgres
  postgres             1.4.12 enabled    dokku postgres service plugin

$ dokku postgres:backup myapp mybucket
[sudo] password for user:
2019-03-26-18-24-27: The backup for myapp finished successfully.

$ sudo dokku plugin:update postgres
Plugin (postgres) updated
0.2.0: Pulling from dokku/ambassador
8e402f1a9c57: Pull complete
1e29874fbf0d: Pull complete
5f7744e8e9e2: Pull complete
Digest: sha256:53d3409e0a50160ba0d4bd47dee305116e590dbdcbc4cbea305b230fca39788c
Status: Downloaded newer image for dokku/ambassador:0.2.0
0.3.0: Pulling from dokku/wait
6c40cc604d8e: Pull complete
f329e6c12567: Pull complete
76d0541288b1: Pull complete
Digest: sha256:e0ef4e9b77580d65bffbdd71c43d39321c2ab47d87b09213b7e29f041a192f41
Status: Downloaded newer image for dokku/wait:0.3.0
0.9.1: Pulling from dokku/s3backup
8e402f1a9c57: Already exists
63da1710a56d: Pull complete
7dff28a04710: Pull complete
71de8f4baf9b: Pull complete
6d25a46e0817: Pull complete
929cc7d11c16: Pull complete
Digest: sha256:ef4ee8c258a4978b3b826199a979621c6abb5a59e94ca9cbd804fe24381015b3
Status: Downloaded newer image for dokku/s3backup:0.9.1
1.30.1-uclibc: Pulling from library/busybox
697743189b6d: Pull complete
Digest: sha256:2331ca40c3a40baead42bd592393ee16662a76b0f0699d843f50410d46c9098b
Status: Downloaded newer image for busybox:1.30.1-uclibc
-----> Priming bash-completion cache

$ dokku plugin:list | grep postgres
  postgres             1.6.0 enabled    dokku postgres service plugin

$ dokku postgres:backup myapp mybucket
awk: cmd. line:1: Unexpected token

ARM64 support

Hey,

I would like to see arm64 support for this image. I use it in a Kubernetes context for my backup strategy. For example I use k3s on a Raspberry Pi 4.

Therefore I build my own image with arm64 support and I would be really glad to add this to the base image. Unfortunately, building of the image is not done through GitHub Actions. But I wrote a small GitHub Workflow that takes care of this.

I don't know if this could fit in your workflow or not, therefore I propose this feature here.

I would be very happy to hear some feedback on this matter and maybe it is possible to adjust your workflow.

My current version of the GitHub Workflow file can be found here: https://github.com/AlexanderBabel/docker-s3backup/blob/master/.github/workflows/build.yml

Cheers!
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.