GithubHelp home page GithubHelp logo

devgeniem / flynn-s3-backup Goto Github PK

View Code? Open in Web Editor NEW
2.0 7.0 1.0 16 KB

Docker image for Flynn cluster backup into AWS S3 which you can run as Flynn app

Shell 63.50% HCL 30.10% Dockerfile 6.40%
flynn docker s3 backup bash

flynn-s3-backup's Introduction

Hacky Flynn s3 backup script

This is a docker image which uses minio client to connect into s3 bucket in amazon.

It downloads Flynn cluster backup tar file from http api and transfers it into append-only versioned s3.

Backups will first get uploaded into highly available STANDARD zone in s3.

They are transitioned to STANDARD_IA after 60 days.

And then transitioned to GLACIER after 120 days.

You can decide when AWS expires old backups from GLACIER.

**Note:**This script will exit when the backup is ready and it counts in the Flynn's ability to spin up new process for the next backup.

Usage

Create and deploy the backup process as app in Flynn

$ docker build -t devgeniem/flynn-backup .
$ flynn create s3-backup --remote="" 
$ flynn -a s3-backup docker push devgeniem/flynn-backup

Create append only s3 bucket and aws iam user

Note: Check that terraform cli has been installed before this.

$ cd terraform

# This creates new bucket and aws iam user credentials for the account that you provide
$ terraform apply

Configure the backup process

# Get the flynn controller AUTH_KEY which you can use as FLYNN_AUTH_KEY later
$ flynn -a controller env get AUTH_KEY

# Setup the backup process
$ flynn -a s3-backup env set \
	FLYNN_AUTH_KEY=auth-key-from-flynn \
	AWS_S3_BUCKET=your-bucket-name \
	AWS_ACCESS_KEY_ID=YYYYYYYYYYYYYYYY \
	AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXX \
	BACKUP_INTERVAL_SECONDS=10800 # Put any interval >1800 here

Start the backup process

$ flynn -a s3-backup scale app=1

How to retrieve old backups from versioned bucket

Note: Check that aws commandline tools has been installed before this.

# This outputs json of all versions
$ aws s3api list-object-versions --bucket your-bucket-name

# This is how you restore older version
# In this example the version we want to restore is rehtEuCbtlaaJWnP0jfdHMQLkyrBPHG_
$ aws s3api get-object --bucket your-bucket-name \
	--key backups/flynn-backup.tar \
	--version-id rehtEuCbtlaaJWnP0jfdHMQLkyrBPHG_ \
	flynn-backup.tar

Maintainers

@onnimonni

License

MIT

flynn-s3-backup's People

Contributors

kochjoel avatar nomafin avatar onnimonni avatar villepietarinen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

yashodhank

flynn-s3-backup's Issues

Error 500

Hi there,

I tried to give this a go but I'm getting an error 500 when I push the docker image on the server.

Do you have any idea why?

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.