Git Product home page Git Product logo

github-backup-aws-s3's Introduction

github-backup-to-s3

A tool to backup all your github repos to a aws s3 bucket. It can optionally backup just an organisation's repositories.

Usage

copy .env.example and rename it .env and setup the config variables.

AWS Credentials

create a new IAM user with programmatic access and add access to putObject on the specific bucket you want to backup.

(no other permissions is needed)

the policy could look something like:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "123456789",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::REPLACE-WITH-BUCKET-NAME/*"
            ]
        }
    ]
}

Run in organisation module

In your .env, set:

GITHUB_ORGANISATION to the name of the Organisation

BACKUP_MODE=organisation

Run locally

node index.js

Deploy to aws lambda

it might be more useful to deploy it with a schedule on aws lambda, so it will backup with a given interval.

install Serverless Framework

npm install -g serverless

optionally make modifications to serverless.yml and run

choose the scheduling interval: http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html

serverless deploy -v --schedule-expression 'rate(2 hours)'

// every hour
serverless deploy -v --schedule-expression 'rate(0 * * * ? *)'

// every 5 minute
serverless deploy -v --schedule-expression 'cron(*/5 * * * ? *)'

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.