Skip to content

frxyt/docker-labrackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/labrackup@server.example.com
        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 labrackup@server.example.com

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/user1@server1.example.com # 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 user@server.ip, 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 <devops@ferox.yt>
Copyright (c) 2019 Jérémy WALTHER <jeremy.walther@golflima.net>

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.

Releases

No releases published

Packages

No packages published