Giter Club home page Giter Club logo

docker-labrackup's Introduction

Docker Image for Labrackup, by FEROX

Docker Cloud Automated build Docker Cloud Build Status Docker Pulls GitHub issues GitHub last commit

Labrackup helps you to retrieve backups of multiple servers / services and to perform a local backup rotation.

Docker Hub Image

frxyt/labrackup

  • amd64: frxyt/labrackup:latest, frxyt/labrackup:amd64
  • arm32v7: frxyt/labrackup:arm32v7
  • arm64v8: frxyt/labrackup:arm64v8

Usage

  • docker run --rm -v $(pwd):/labrackup frxyt/labrackup:latest
  • docker run --rm -v $(pwd):/labrackup frxyt/labrackup:latest /labrackup/backups.yml
  • docker run --rm -v $(pwd):/labrackup -e LABRACKUP_CONF_FILE=/labrackup/backups.yml frxyt/labrackup:latest
    • Sample content for backups.yml:

      .template:sample_host1: &template_sample_host1
        remote_host: server.example.com
        remote_port: 22
        remote_user: labrackup
        remote_keyfile: /labrackup/[email protected]
        external_host: gateways.storage.OS_REGION_NAME.cloud.ovh.net
        external_port: 22
        external_user: pca
        external_password: OS_TENANT_NAME.OS_USERNAME.OS_PASSWORD
      
      backups:
      
        gitlab:
          <<: *template_sample_host1
          remote_path: /data/gitlab/opt/backups
          local_path: /labrackup/backups/server.example.com/gitlab
          local_rotate:
            - -I '*_gitlab_backup.tar' -d 7 -w 4 -m 12
            - -I '*_gitlab_config.tar.gz' -d 7 -w 4 -m 12
          external_path: server.example.com/gitlab
      
        grafana:
          <<: *template_sample_host1
          remote_path: /data/grafana/backups
          local_path: /labrackup/backups/server.example.com/grafana
          local_rotate: ["-I '*_grafana-db.tar.gz' -d 7 -w 4 -m 12"]
    • Generate a key with: ssh-keygen -b 4096 -f [email protected]

Structure of backups.yml

backups: # base node

  gitlab: # Name of the first backup
    remote_host: server1.example.com # IP or Hostname of the server
    remote_port: 22 # SSH Port
    remote_user: user1 # SSH User
    remote_keyfile: /labrackup/[email protected] # SSH Private key to use
    remote_path: /data/gitlab/opt/backups # Remote path where backup are stored
    local_path: /labrackup/backups/server1.example.com/gitlab # Local path where backups need to be retrieved
    local_rotate: # rotate-backup options
      - -I '*_gitlab_backup.tar' -d 7 -w 4 -m 12
      - -I '*_gitlab_config.tar.gz' -d 7 -w 4 -m 12
    # Following external_* keys are optional, and can be used to replicate retrieved backups elsewhere
    external_host: gateways.storage.OS_REGION_NAME.cloud.ovh.net # IP or Hostname of the SFTP server 
    external_port: 22 # SFTP Port
    external_user: pca # SFTP User
    external_password: OS_TENANT_NAME.OS_USERNAME.OS_PASSWORD # SFTP Password
    external_path: server1.example.com/gitlab
  
  # Add as many backup sections as needed

Install Labrackup on ARM Server / Raspberry Pi

  1. ssh [email protected], then, sudo -s

  2. apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y

  3. apt-get install -y --fix-missing --install-recommends apt-transport-https apt-utils curl nano

  4. curl -sSL https://get.docker.com | sh

  5. mkdir /labrackup && cd /labrackup

  6. Create a backups.yml describing the services to backup: nano backups.yml

  7. Add your private key or generate it: ssh-keygen -b 4096 -f backups.key

  8. docker run --rm -v $(pwd):/labrackup frxyt/labrackup:arm32v7 (if you have an ARMv8 CPU, you can use arm64v8 instead)

  9. Add an hourly cron with: crontab -e

    0 * * * * /usr/bin/docker run --rm -v /labrackup:/labrackup frxyt/labrackup:arm32v7 >> /labrackup/backups.log 2>&1

Build

docker run --rm --privileged multiarch/qemu-user-static:register --reset
docker build -f Dockerfile              -t frxyt/labrackup:latest  .
docker build -f arch/amd64/Dockerfile   -t frxyt/labrackup:amd64   .
docker build -f arch/arm32v7/Dockerfile -t frxyt/labrackup:arm32v7 .
docker build -f arch/arm64v8/Dockerfile -t frxyt/labrackup:arm64v8 .

License

This project and images are published under the MIT License.

MIT License

Copyright (c) 2019 FEROX YT EIRL, www.ferox.yt <[email protected]>
Copyright (c) 2019 Jérémy WALTHER <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

docker-labrackup's People

Contributors

golflima avatar

Watchers

 avatar  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.