Docker Image for Labrackup, by FEROX
Labrackup helps you to retrieve backups of multiple servers / services and to perform a local backup rotation.
- Docker Hub: https://hub.docker.com/r/frxyt/labrackup
- GitHub: https://github.com/frxyt/docker-labrackup
frxyt/labrackup
- amd64:
frxyt/labrackup:latest
,frxyt/labrackup:amd64
- arm32v7:
frxyt/labrackup:arm32v7
- arm64v8:
frxyt/labrackup:arm64v8
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]
-
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
- For all
local_rotate
options, see: https://rotate-backups.readthedocs.io/en/latest/readme.html#command-line
-
ssh [email protected]
, then,sudo -s
-
apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
-
apt-get install -y --fix-missing --install-recommends apt-transport-https apt-utils curl nano
-
curl -sSL https://get.docker.com | sh
-
mkdir /labrackup && cd /labrackup
-
Create a
backups.yml
describing the services to backup:nano backups.yml
-
Add your private key or generate it:
ssh-keygen -b 4096 -f backups.key
-
docker run --rm -v $(pwd):/labrackup frxyt/labrackup:arm32v7
(if you have an ARMv8 CPU, you can usearm64v8
instead) -
Add an hourly cron with:
crontab -e
0 * * * * /usr/bin/docker run --rm -v /labrackup:/labrackup frxyt/labrackup:arm32v7 >> /labrackup/backups.log 2>&1
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 .
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.