Giter Club home page Giter Club logo

docker-aws-backup's Introduction

Backup data to AWS S3

This project provides Docker images to periodically back up compress, encrypt and transfer data folders to AWS S3, and to restore from the backup as needed.

๐Ÿ“ฆ Requirements

The Docker & Docker Compose system requirements are Linux Ubuntu as the OS (other operating systems are supported as well), an absolute minimum 512MB RAM (2GB recommended)

In order to install docker Ubuntu, you will need to meet the following requirements:

  • OS: Linux Ubuntu
  • Memory: 512MB RAM (2GB Recommended)
  • Disk: Sufficient amount to run the Docker containers you wish to use
  • CPU: Dependant on the applications you wish to run in the containers

๐Ÿ“‹ Features

  • The SCHEDULE variable determines backup frequency. See go-cron schedules documentation here. Omit to run the backup immediately and then exit.
  • If PASSPHRASE is provided, the backup will be encrypted using GPG.
  • Run docker exec <container name> sh backup.sh to trigger a backup ad-hoc.
  • If BACKUP_KEEP_DAYS is set, backups older than this many days will be deleted from S3.
  • Set S3_ENDPOINT if you're using a non-AWS S3-compatible storage provider.

๐Ÿ”ง Installation

  1. Install Docker and Docker-Compose
  1. Bring up your stack by running
git clone https://github.com/hitechnix/docker-aws-backup.git \
    && cd docker-aws-backup \
    && cp .env.example .env
  1. Edit environment variable
# Backup
SCHEDULE=@weekly
BACKUP_FOLDER=
BACKUP_FILE_NAME=
BACKUP_KEEP_DAYS=7
PASSPHRASE=wxHw26GJZQBDenA8
S3_REGION=us-east-1
S3_BUCKET=my-s3-bucket
S3_PREFIX=prefix
S3_ACCESS_KEY_ID=AKIA3M3ZKBJPQUBT2UK6
S3_SECRET_ACCESS_KEY=BNcXdm18XMctzMH87PZLm8UoP6WlegcPvsQbF5TH
  1. Start backup data to AWS S3
docker-compose up -d

๐Ÿ“ Usage

Example docker-compose.yml

version: "3.9"

services:
  backup:
    container_name: data-backup
    restart: always
    image: hitechnix/docker-aws-backup:1.0.0
    environment:
      - SCHEDULE=${SCHEDULE:-@weekly}
      - BACKUP_FOLDER=${BACKUP_FOLDER}
      - BACKUP_FILE_NAME=${BACKUP_FILE_NAME:-backup}
      - BACKUP_KEEP_DAYS=${BACKUP_KEEP_DAYS:-7}
      - PASSPHRASE=${PASSPHRASE:-passphrase}
      - S3_REGION=${S3_REGION:-region}
      - S3_BUCKET=${S3_BUCKET:-bucket}
      - S3_PREFIX=${S3_PREFIX:-prefix}
      - S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID:-key}
      - S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY:-secret}
    volumes:
      - ${BACKUP_FOLDER}:/home/backups
    networks:
      - network-bridge

networks:
  network-bridge:
    driver: bridge
    name: network-bridge

Restore

WARNING: DATA LOSS! All database objects will be dropped and re-created.

... from latest backup

docker exec <container name> sh restore.sh

NOTE: If your bucket has more than 1000 files, the latest may not be restored -- only one S3 ls command is used

... from specific backup

docker exec <container name> sh restore.sh <timestamp>

๐Ÿ“จ Message

I hope you find this useful. If you have any questions, please create an issue.

๐Ÿ” Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

๐Ÿ“– License

This software is released under the BSD 3-Clause License. Please see the LICENSE file or https://opensource.hitechnix.com/LICENSE.txt for more information.

โœจ Contributors

Thanks goes to these wonderful people (emoji key):

Son Tran Thanh
Son Tran Thanh

๐Ÿ”ง ๐Ÿš‡ ๐Ÿšง ๐Ÿ’ป ๐Ÿ“– ๐Ÿ‘€

This project follows the all-contributors specification. Contributions of any kind welcome!

docker-aws-backup's People

Contributors

trants avatar

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.