├── .gitignore ├── image ├── service │ ├── backup-manager │ │ ├── assets │ │ │ ├── cronjobs │ │ │ ├── README.md │ │ │ └── backup-manager.conf │ │ ├── install.sh │ │ └── startup.sh │ └── gpg │ │ ├── assets │ │ ├── README.md │ │ └── mike.gpg │ │ └── startup.sh ├── Dockerfile └── environment │ └── default.startup.yaml ├── test ├── test.bats └── test_helper.bash ├── Makefile ├── LICENSE ├── CHANGELOG.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.twgit_features_subject 2 | /.twgit 3 | -------------------------------------------------------------------------------- /image/service/backup-manager/assets/cronjobs: -------------------------------------------------------------------------------- 1 | # Backup 2 | {{ BACKUP_MANAGER_CRON_EXP }} root /usr/sbin/backup-manager > /proc/1/fd/1 2>/proc/1/fd/2 3 | # empty line 4 | -------------------------------------------------------------------------------- /test/test.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | load test_helper 3 | 4 | @test "image build" { 5 | 6 | run build_image 7 | [ "$status" -eq 0 ] 8 | 9 | } 10 | -------------------------------------------------------------------------------- /image/service/backup-manager/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # this script is run during the image build 3 | 4 | # delete default config 5 | rm -f /etc/backup-manager.conf 6 | -------------------------------------------------------------------------------- /image/service/gpg/assets/README.md: -------------------------------------------------------------------------------- 1 | For backup encryption, add your gpg public keys here or mount a directory with those keys at docker run to /container/service/gpg/assets/ 2 | -------------------------------------------------------------------------------- /image/service/backup-manager/assets/README.md: -------------------------------------------------------------------------------- 1 | Add your custom backup-manager.conf file here or mount one at docker run to /container/service/backup-manager/assets/backup-manager.conf 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | NAME = osixia/backup-manager 2 | VERSION = 0.3.0 3 | 4 | .PHONY: build build-nocache test tag-latest push push-latest release git-tag-version 5 | 6 | build: 7 | docker build -t $(NAME):$(VERSION) --rm image 8 | 9 | build-nocache: 10 | docker build -t $(NAME):$(VERSION) --no-cache --rm image 11 | 12 | test: 13 | env NAME=$(NAME) VERSION=$(VERSION) bats test/test.bats 14 | 15 | tag-latest: 16 | docker tag $(NAME):$(VERSION) $(NAME):latest 17 | 18 | push: 19 | docker push $(NAME):$(VERSION) 20 | 21 | push-latest: 22 | docker push $(NAME):latest 23 | 24 | release: build test tag-latest push push-latest 25 | 26 | git-tag-version: release 27 | git tag -a v$(VERSION) -m "v$(VERSION)" 28 | git push origin v$(VERSION) 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /image/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use osixia/light-baseimage 2 | # sources: https://github.com/osixia/docker-light-baseimage 3 | FROM osixia/light-baseimage:1.1.1 4 | MAINTAINER Bertrand Gouny 5 | 6 | # Install Backup Manager, GNUPG for encryption and cron from baseimage 7 | # sources: https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/add-service-available 8 | #  https://github.com/osixia/docker-light-baseimage/blob/stable/image/service-available/:cron/download.sh 9 | RUN apt-get -y update \ 10 | && /container/tool/add-service-available :cron \ 11 | && LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ 12 | backup-manager \ 13 | gnupg \ 14 | openssh-client \ 15 | libnet-amazon-s3-perl \ 16 | mysql-client \ 17 | && apt-get clean \ 18 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 19 | 20 | # Add service directory to /container/service 21 | ADD service /container/service 22 | 23 | # Use baseimage install-service script 24 | # https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-service 25 | RUN /container/tool/install-service 26 | 27 | # Add default env variables 28 | ADD environment /container/environment/99-default 29 | 30 | # Set backup data in a data volume 31 | # Must match env var BM_REPOSITORY_ROOT in backup-manager.conf 32 | VOLUME ["/data/backup"] 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## [0.3.0] - 2018-01-12 8 | ### Added 9 | - Pipe configuration #2 10 | 11 | ## [0.2.1] - 2017-10-07 12 | ### Added 13 | - openssh-client and libnet-amazon-s3-perl packages #1 14 | 15 | ### Changed 16 | - Upgrade baseimage to light-baseimage:1.1.1 17 | 18 | ## [0.2.0] - 2017-07-19 19 | ### Added 20 | - Incremental tarball support 21 | 22 | ### Changed 23 | - Upgrade Backup Manager version to 0.7.12.4 24 | - Upgrade baseimage to light-baseimage:1.1.0 (debian stretch) 25 | 26 | ## [0.1.8] - 2017-03-19 27 | ### Changed 28 | - Upgrade baseimage to light-baseimage:0.2.6 29 | 30 | ## [0.1.7] - 2016-09-03 31 | ### Changed 32 | - Upgrade baseimage to light-baseimage:0.2.5 33 | 34 | ## [0.1.6] - 2016-07-26 35 | ### Changed 36 | - Upgrade baseimage to light-baseimage:0.2.4 37 | 38 | ## [0.1.5] - 2016-02-20 39 | ### Changed 40 | - Upgrade baseimage to light-baseimage:0.2.2 41 | 42 | ## [0.1.4] - 2016-01-27 43 | ### Added 44 | - Makefile with build no cache 45 | 46 | ### Changed 47 | - Upgrade baseimage to light-baseimage:0.2.1 48 | 49 | ## [0.1.3] - 2015-11-20 50 | ### Changed 51 | - Upgrade baseimage to light-baseimage:0.1.5 52 | 53 | ## [0.1.2] - 2015-11-19 54 | ### Changed 55 | - Upgrade baseimage to light-baseimage:0.1.4 56 | 57 | ### Fixed 58 | - config file 59 | 60 | ## [0.1.0] - 2015-10-30 61 | Initial release 62 | -------------------------------------------------------------------------------- /image/service/gpg/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # set -x (bash debug) if log level is trace 4 | # https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/log-helper 5 | log-helper level eq trace && set -x 6 | 7 | [ -d ${CONTAINER_SERVICE_DIR}/gpg/.data ] || mkdir -p ${CONTAINER_SERVICE_DIR}/gpg/.data 8 | ln -sf ${CONTAINER_SERVICE_DIR}/gpg/.data $HOME/.gnupg 9 | 10 | chmod 400 -R ${CONTAINER_SERVICE_DIR}/gpg/assets/ 11 | chmod 400 ${HOME}/.gnupg 12 | 13 | FIRST_START_DONE="${CONTAINER_STATE_DIR}/docker-gpg-first-start-done" 14 | # container first start 15 | if [ ! -e "$FIRST_START_DONE" ]; then 16 | 17 | 18 | if [ "${BACKUP_MANAGER_ENCRYPTION,,}" == "true" ]; then 19 | 20 | log-helper info "Use encryption..." 21 | 22 | TEMP_FILE="trusted-key.tmp" 23 | 24 | # add public keys to gpg 25 | for f in $(find ${CONTAINER_SERVICE_DIR}/gpg/assets/ -type f ! -name 'README.md'); do 26 | log-helper debug "Add key ${f}" 27 | gpg --import ${f} 28 | done 29 | 30 | # add recipient key to trusted keys 31 | log-helper debug "Recipient key : ${BACKUP_MANAGER_ENCRYPTION_RECIPIENT}" 32 | TRUST_VALUE=':6:' 33 | 34 | TRUSTVAR=`gpg --with-colons --fingerprint ${BACKUP_MANAGER_ENCRYPTION_RECIPIENT} | awk -F: '$1 == "fpr" {print $10;}' | head -1` 35 | 36 | if [ -z "$TRUSTVAR" ]; then 37 | log-helper error "Error: gpg key ${BACKUP_MANAGER_ENCRYPTION_RECIPIENT} not found" 38 | exit 1 39 | fi 40 | 41 | echo $TRUSTVAR$TRUST_VALUE >> $TEMP_FILE 42 | gpg --import-ownertrust $TEMP_FILE 43 | 44 | rm -f $TEMP_FILE 45 | 46 | fi 47 | 48 | touch $FIRST_START_DONE 49 | fi 50 | 51 | exit 0 52 | -------------------------------------------------------------------------------- /test/test_helper.bash: -------------------------------------------------------------------------------- 1 | setup() { 2 | IMAGE_NAME="$NAME:$VERSION" 3 | } 4 | 5 | # function relative to the current container / image 6 | build_image() { 7 | #disable outputs 8 | docker build -t $IMAGE_NAME $BATS_TEST_DIRNAME/../image &> /dev/null 9 | } 10 | 11 | run_image() { 12 | CONTAINER_ID=$(docker run $@ -d $IMAGE_NAME) 13 | CONTAINER_IP=$(get_container_ip_by_cid $CONTAINER_ID) 14 | } 15 | 16 | start_container() { 17 | start_containers_by_cid $CONTAINER_ID 18 | } 19 | 20 | stop_container() { 21 | stop_containers_by_cid $CONTAINER_ID 22 | } 23 | 24 | remove_container() { 25 | remove_containers_by_cid $CONTAINER_ID 26 | } 27 | 28 | clear_container() { 29 | stop_containers_by_cid $CONTAINER_ID 30 | remove_containers_by_cid $CONTAINER_ID 31 | } 32 | 33 | wait_process() { 34 | wait_process_by_cid $CONTAINER_ID $@ 35 | } 36 | 37 | # generic functions 38 | get_container_ip_by_cid() { 39 | local IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" $1) 40 | echo "$IP" 41 | } 42 | 43 | start_containers_by_cid() { 44 | for cid in "$@" 45 | do 46 | #disable outputs 47 | docker start $cid &> /dev/null 48 | done 49 | } 50 | 51 | stop_containers_by_cid() { 52 | for cid in "$@" 53 | do 54 | #disable outputs 55 | docker stop $cid &> /dev/null 56 | done 57 | } 58 | 59 | remove_containers_by_cid() { 60 | for cid in "$@" 61 | do 62 | #disable outputs 63 | docker rm $cid &> /dev/null 64 | done 65 | } 66 | 67 | clear_containers_by_cid() { 68 | stop_containers_by_cid $@ 69 | remove_containers_by_cid $@ 70 | } 71 | 72 | wait_process_by_cid() { 73 | cid=$1 74 | docker exec $cid /container/tool/wait-process ${@:2} 75 | } 76 | -------------------------------------------------------------------------------- /image/environment/default.startup.yaml: -------------------------------------------------------------------------------- 1 | # Directories to backup: paths without spaces in their name 2 | # This image allows you to set up, tarball or tarball-incremental method 3 | # but other methods can be used and configured by setting directly backup manager 4 | # envirnonment variables BM_* 5 | BACKUP_MANAGER_ARCHIVE_METHOD: tarball 6 | 7 | BACKUP_MANAGER_TARBALL_DIRECTORIES: /data-to-backup /data-to-backup2 8 | 9 | # Run backup-manager at 4:00am 10 | BACKUP_MANAGER_CRON_EXP: 0 4 * * * 11 | 12 | # Delete backups that are over 15 days 13 | BACKUP_MANAGER_TTL: 15 14 | 15 | # Ftp upload config 16 | BACKUP_MANAGER_UPLOAD_METHOD: ftp 17 | BACKUP_MANAGER_UPLOAD_HOSTS: ftp.example.org 18 | BACKUP_MANAGER_UPLOAD_FTP_USER: ftp-user 19 | BACKUP_MANAGER_UPLOAD_FTP_PASSWORD: ftp-password 20 | BACKUP_MANAGER_UPLOAD_DESTINATION: / 21 | BACKUP_MANAGER_UPLOAD_TTL: 60 # Delete backups on the ftp that are over 60 days 22 | 23 | # Encryption, disabled if empty 24 | BACKUP_MANAGER_ENCRYPTION: false 25 | BACKUP_MANAGER_ENCRYPTION_RECIPIENT: Mike Ross 26 | 27 | # 28 | # tarball-incremental specific options: 29 | # 30 | # Which frequency to use for the master tarball? possible values: weekly, monthly 31 | BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE: weekly 32 | 33 | # Number of the day, in the BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE frequency when master tarballs should be made 34 | BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE: 1 35 | 36 | # pipe command 37 | #BACKUP_MANAGER_PIPE_COMMAND_0: ssh host -c \\"mysqldump -ufoo -pbar base\\" 38 | #BACKUP_MANAGER_PIPE_NAME_0: base 39 | #BACKUP_MANAGER_PIPE_FILETYPE_0: sql 40 | #BACKUP_MANAGER_PIPE_COMPRESS_0: gzip 41 | # 42 | #BACKUP_MANAGER_PIPE_COMMAND_1: ssh host -c \\"tar -c -z /home/user\\" 43 | #BACKUP_MANAGER_PIPE_NAME_1: host.home.user 44 | #BACKUP_MANAGER_PIPE_FILETYPE_1: tar.gz 45 | -------------------------------------------------------------------------------- /image/service/gpg/assets/mike.gpg: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1 3 | 4 | mQENBFYCk8UBCADbGb5XKUJVXLh6nHKnoDS2oYX9FypUci2eSVtRmm2UCo5+QgBu 5 | h8/LTY5rYM0syw0HqPm3jwwsN9PURpM82Dw1vM48YzcYfI+U7y5nSbBIVAzt5T7Z 6 | 9AtJMqgMilNvQBqhFRT2+6QqpWlQ8LR8+6MIARePinoO3HnqCKTmOhXz24UYCgXQ 7 | AR3VoQUfO780tsynltM/gmyTCfkQItnPHWARrapSfRu1ijR/j/ymlzMV1LjiY0tI 8 | mN2BbrbYgKspf1kkyS7SKIDumHb0SgfdoHLmSUTaVUm0lpNlTmvJYMdu4EKu7Emo 9 | W7wDMHqLZKmaCs+u1sF2NMbZqb0xqCXWqM/LABEBAAG0IU1pa2UgUm9zcyA8bWlr 10 | ZS5yb3NzQGxhd3llcnMub3JnPokBOAQTAQIAIgUCVgKTxQIbAwYLCQgHAwIGFQgC 11 | CQoLBBYCAwECHgECF4AACgkQAbakfuWTSiKfYAf+PwF16YJwXlQFGV+OM2/g8pUJ 12 | OFF88yEj29sy4DH3ODZBL6g0xvE65vUp/vwCzqUuRwhhbx089RkJfFr32oy8s0ZF 13 | NAKroG3dzmxBVhjSSQ441T9SHhQwqlxY8dIVwhq/5WYSq7fBojVBi90LMKUDPB0L 14 | QbW1OSzccNaeYRIBXw/Y6zDvGJ2di8m7JepUENaEdU/IOtOKMI0zCUf+jrK5pE00 15 | HKPhlKFH0VkTYEyr6PY+8AY4YLD1DJM4QH2L54yJRkTJewiGRNIuY7Vl7xP222FR 16 | iAYS+m1iiXOhlmCVyFIvDjjMlD/GxoIU2bpVvourlDB0M19JY8138SjEiHolq7kB 17 | DQRWApPFAQgAxj0gbfJAl2PIcys6EA+G0A4sN3K3UHQ+dpM5I0ZHZBUibwYslsLA 18 | L3ar//CEDXzmsKhPUEAgg9nMWeiOuz8Az3g3k0XwaqydUDhM8YnnUTnMQWxy/Xuz 19 | qxmkS+mwiIxUHWaSX6vYZ9wvE502a3uwKWUO+gP/9oCkKi6w6//PdruJfUiKxYTm 20 | 91Z/D0EG/4UqeMbQh6HJnXHgfnT8lHqYsDr/j3oAiItwJVuvxc1xLRyAW09ZAcnh 21 | G0Z+N8oILiSfhugxO9zg43QmfF6hgN3qFqqqQIPB3pHsOGcNSJNoUocHdyb6QNZQ 22 | 6ljPEOIZDsI3EI3iKm6aPLPFv4n8X23BxQARAQABiQEfBBgBAgAJBQJWApPFAhsM 23 | AAoJEAG2pH7lk0oiUR0H/0Aa6rrExZIf2pxomCnj4bwonUUbwxO4P4asw15SzNAt 24 | zpnj6CKWpmsbtG7zb/b/EDQAPRHSpLKE/bCot+ivB3QS96UtAo5f/3Ue72C2eemD 25 | HlD0EmSrUGMwzF29GHQwSD4jgPRZx/7IitiKXRCDdi6plhjvoLrRr0NYSAF+TI4a 26 | dozkqgMVt/uvmubxm/4FW0/uqArtdRnj9y3ulCHS1WGUHb6GBl+ow3REqOdaLpF+ 27 | HABiuT9cA0tuyjC9cDqxD0HqX44uxmkp5GXeUl+p8+QkAPoxrO9XZ8qgRbJXATKL 28 | O+aOff260BEEEdCHQKNc80p4ICLjlJcZVA46l9gbNEQ= 29 | =74jo 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /image/service/backup-manager/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # set -x (bash debug) if log level is trace 4 | # https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/log-helper 5 | log-helper level eq trace && set -x 6 | 7 | FIRST_START_DONE="${CONTAINER_STATE_DIR}/docker-backup-manager-first-start-done" 8 | # container first start 9 | if [ ! -e "$FIRST_START_DONE" ]; then 10 | 11 | # adapt cronjobs file 12 | sed -i "s|{{ BACKUP_MANAGER_CRON_EXP }}|${BACKUP_MANAGER_CRON_EXP}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/cronjobs 13 | 14 | # 15 | # bootstrap config 16 | # 17 | sed -i "s|{{ BACKUP_MANAGER_TTL }}|${BACKUP_MANAGER_TTL}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 18 | sed -i "s|{{ BACKUP_MANAGER_TARBALL_DIRECTORIES }}|${BACKUP_MANAGER_TARBALL_DIRECTORIES}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 19 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_METHOD }}|${BACKUP_MANAGER_UPLOAD_METHOD}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 20 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_HOSTS }}|${BACKUP_MANAGER_UPLOAD_HOSTS}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 21 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_FTP_USER }}|${BACKUP_MANAGER_UPLOAD_FTP_USER}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 22 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_FTP_PASSWORD }}|${BACKUP_MANAGER_UPLOAD_FTP_PASSWORD}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 23 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_DESTINATION }}|${BACKUP_MANAGER_UPLOAD_DESTINATION}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 24 | sed -i "s|{{ BACKUP_MANAGER_UPLOAD_TTL }}|${BACKUP_MANAGER_UPLOAD_TTL}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 25 | sed -i "s|{{ BACKUP_MANAGER_ARCHIVE_METHOD }}|${BACKUP_MANAGER_ARCHIVE_METHOD}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 26 | sed -i "s|{{ BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE }}|${BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 27 | sed -i "s|{{ BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE }}|${BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 28 | 29 | # encryption 30 | if [ "${BACKUP_MANAGER_ENCRYPTION,,}" == "true" ]; then 31 | sed -i "s|# export BM_ENCRYPTION_METHOD|export BM_ENCRYPTION_METHOD|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 32 | sed -i "s|# export BM_ENCRYPTION_RECIPIENT=\"{{ BACKUP_MANAGER_ENCRYPTION_RECIPIENT }}\"|export BM_ENCRYPTION_RECIPIENT=\"{{ BACKUP_MANAGER_ENCRYPTION_RECIPIENT }}\"|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 33 | 34 | sed -i "s|{{ BACKUP_MANAGER_ENCRYPTION_RECIPIENT }}|${BACKUP_MANAGER_ENCRYPTION_RECIPIENT}|g" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 35 | fi 36 | 37 | 38 | i=0 39 | BACKUP_MANAGER_PIPE_COMMAND="BACKUP_MANAGER_PIPE_COMMAND_${i}"; 40 | while [ -n "${!BACKUP_MANAGER_PIPE_COMMAND}" ]; do 41 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_COMMAND[$i]=\"${!BACKUP_MANAGER_PIPE_COMMAND}\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 42 | 43 | BACKUP_MANAGER_PIPE_NAME="BACKUP_MANAGER_PIPE_NAME_$i" 44 | if [ -n "${!BACKUP_MANAGER_PIPE_NAME}" ]; then 45 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_NAME[$i]=\"${!BACKUP_MANAGER_PIPE_NAME}\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 46 | else 47 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_NAME[$i]=\"\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 48 | fi 49 | 50 | BACKUP_MANAGER_PIPE_FILETYPE="BACKUP_MANAGER_PIPE_FILETYPE_$i" 51 | if [ -n "${!BACKUP_MANAGER_PIPE_FILETYPE}" ]; then 52 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_FILETYPE[$i]=\"${!BACKUP_MANAGER_PIPE_FILETYPE}\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 53 | else 54 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_FILETYPE[$i]=\"\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 55 | fi 56 | 57 | BACKUP_MANAGER_PIPE_COMPRESS="BACKUP_MANAGER_PIPE_COMPRESS_$i" 58 | if [ -n "${!BACKUP_MANAGER_PIPE_COMPRESS}" ]; then 59 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_COMPRESS[$i]=\"${!BACKUP_MANAGER_PIPE_COMPRESS}\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 60 | else 61 | sed -ie "/^# BACKUP MANAGER COMMAND PIPE DATA/i BM_PIPE_COMPRESS[$i]=\"\"" ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf 62 | fi 63 | 64 | i=$((i+1)) 65 | BACKUP_MANAGER_PIPE_COMMAND="BACKUP_MANAGER_PIPE_COMMAND_${i}"; 66 | done 67 | 68 | touch $FIRST_START_DONE 69 | fi 70 | 71 | # add cron jobs 72 | ln -sf ${CONTAINER_SERVICE_DIR}/backup-manager/assets/cronjobs /etc/cron.d/backup-manager 73 | chmod 600 ${CONTAINER_SERVICE_DIR}/backup-manager/assets/cronjobs 74 | 75 | if [ ! -e "/etc/backup-manager.conf" ]; then 76 | log-helper info "Link ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf to /etc/backup-manager.conf ..." 77 | ln -sf ${CONTAINER_SERVICE_DIR}/backup-manager/assets/backup-manager.conf /etc/backup-manager.conf 78 | fi 79 | 80 | exit 0 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # osixia/backup-manager 2 | 3 | [![Docker Pulls](https://img.shields.io/docker/pulls/osixia/backup-manager.svg)][hub] 4 | [![Docker Stars](https://img.shields.io/docker/stars/osixia/backup-manager.svg)][hub] 5 | [![](https://images.microbadger.com/badges/image/osixia/backup-manager.svg)](http://microbadger.com/images/osixia/backup-manager "Get your own image badge on microbadger.com") 6 | 7 | [hub]: https://hub.docker.com/r/osixia/backup-manager/ 8 | 9 | Latest release: 0.3.0 - Backup Manager 0.7.12.4 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/backup-manager/)  10 | 11 | **A docker image to run periodically backup-manager.** 12 | > https://github.com/sukria/Backup-Manager 13 | 14 | - [Quick start](#quick-start) 15 | - [Beginner Guide](#beginner-guide) 16 | - [Backup directory and data persistence](#backup-directory-and-data-persistence) 17 | - [Use your own Backup Manager config](#use-your-own-backup-manager-config) 18 | - [Fix docker mounted file problems](#fix-docker-mounted-file-problems) 19 | - [Debug](#debug) 20 | - [Environment Variables](#environment-variables) 21 | - [Set your own environment variables](#set-your-own-environment-variables) 22 | - [Use command line argument](#use-command-line-argument) 23 | - [Link environment file](#link-environment-file) 24 | - [Make your own image or extend this image](#make-your-own-image-or-extend-this-image) 25 | - [Advanced User Guide](#advanced-user-guide) 26 | - [Extend osixia/backup-manager:0.3.0 image](#extend-osixiabackup-manager030-image) 27 | - [Make your own backup-manager image](#make-your-own-backup-manager-image) 28 | - [Tests](#tests) 29 | - [Under the hood: osixia/light-baseimage](#under-the-hood-osixialight-baseimage) 30 | - [Security](#security) 31 | - [Changelog](#changelog) 32 | 33 | ## Quick start 34 | 35 | # Run Backup Manager image 36 | docker run --volume /host/data:/data-to-backup --detach osixia/backup-manager:0.3.0 37 | 38 | ## Beginner Guide 39 | 40 | ### Backup directory and data persistence 41 | 42 | Backups are created by default in the directory `/data/backup` that has been declared as a volume, so your backup files are saved outside the container in a data volume. 43 | 44 | For more information about docker data volume, please refer to : 45 | 46 | > [https://docs.docker.com/userguide/dockervolumes/](https://docs.docker.com/userguide/dockervolumes/) 47 | 48 | 49 | ### Use your own Backup Manager config 50 | This image comes with a backup manager config file that can be easily customized via environment variables for a quick bootstrap, 51 | but setting your own backup-manager.conf is possible. 2 options: 52 | 53 | - Link your config file at run time to `/container/service/backup-manager/assets/backup-manager.conf` : 54 | 55 | docker run --volume /data/my-backup-manager.conf:/container/service/backup-manager/assets/backup-manager.conf --detach osixia/backup-manager:0.3.0 56 | 57 | - Add your config file by extending or cloning this image, please refer to the [Advanced User Guide](#advanced-user-guide) 58 | 59 | ### Fix docker mounted file problems 60 | 61 | You may have some problems with mounted files on some systems. The startup script try to make some file adjustment and fix files owner and permissions, this can result in multiple errors. See [Docker documentation](https://docs.docker.com/v1.4/userguide/dockervolumes/#mount-a-host-file-as-a-data-volume). 62 | 63 | To fix that run the container with `--copy-service` argument : 64 | 65 | docker run [your options] osixia/backup-manager:0.3.0 --copy-service 66 | 67 | ### Debug 68 | 69 | The container default log level is **info**. 70 | Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`. 71 | 72 | Example command to run the container in `debug` mode: 73 | 74 | docker run --detach osixia/backup-manager:0.3.0 --loglevel debug 75 | 76 | See all command line options: 77 | 78 | docker run osixia/backup-manager:0.3.0 --help 79 | 80 | ## Environment Variables 81 | 82 | Environment variables defaults are set in **image/environment/default.yaml** 83 | 84 | See how to [set your own environment variables](#set-your-own-environment-variables) 85 | 86 | - **BACKUP_MANAGER_ARCHIVE_METHOD**: Archive method, this image allows you to set **tarball** or **tarball-incremental** methods with the following environment variables but all Backup Manager environment variables (starting by *BM_**) can also be set to configure any method you need. Defaults to `tarball`. 87 | 88 | - **BACKUP_MANAGER_TARBALL_DIRECTORIES**: Directories to backup: paths without spaces in their name. Defaults to `/data-to-backup /data-to-backup2`. 89 | 90 | - **BACKUP_MANAGER_CRON_EXP**: Cron expression to schedule backup-manager execution. Defaults to `0 4 * * *`. Every days at 4am. 91 | 92 | - **BACKUP_MANAGER_TTL**: Backup TTL in days. Defaults to `15`. 93 | 94 | Upload configuration: 95 | 96 | - **BACKUP_MANAGER_UPLOAD_METHOD**: Upload method. Defaults to `ftp`. 97 | 98 | - **BACKUP_MANAGER_UPLOAD_HOSTS**: Upload to this ftp hosts. Defaults to `ftp.example.org`. 99 | 100 | - **BACKUP_MANAGER_UPLOAD_FTP_USER**: Ftp user. Defaults to `ftp-user`. 101 | - **BACKUP_MANAGER_UPLOAD_FTP_PASSWORD**: Ftp password. Defaults to `ftp-password`. 102 | - **BACKUP_MANAGER_UPLOAD_DESTINATION**: Upload to this ftp directory. Defaults to `/`. 103 | - **BACKUP_MANAGER_UPLOAD_TTL**: Backup TTL on the ftp hosts in days. Defaults to `60`. 104 | 105 | Encryption configuration: 106 | 107 | - **BACKUP_MANAGER_ENCRYPTION**: Encrypt backups. Defaults to `false`. 108 | - **BACKUP_MANAGER_ENCRYPTION_RECIPIENT**: GPG recipient. Defaults to `Mike Ross`. 109 | 110 | Incremental tarball configuration: 111 | - **BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE**: Which frequency to use for the master tarball? possible values: weekly, monthly. Defaults to `weekly`. 112 | 113 | - **BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE**: Number of the day, in the BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE frequency when master tarballs should be made. Defaults to `1`. 114 | 115 | Examples: you want to make master tarballs every friday: 116 | BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE="weekly" 117 | BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE="5" 118 | 119 | Or every first day of the month: 120 | BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE="monthly" 121 | BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE="1" 122 | 123 | Pipe configuration: 124 | - **BACKUP_MANAGER_PIPE_COMMAND_0**: Command 125 | - **BACKUP_MANAGER_PIPE_NAME_0**: Name of command (no mandatory, empty if not set) 126 | - **BACKUP_MANAGER_PIPE_FILETYPE_0**: File type of pipe command (no mandatory, empty if not set) 127 | - **BACKUP_MANAGER_PIPE_COMPRESS_0**: Compress type (no mandatory, empty if not set) 128 | 129 | You can add **BACKUP_MANAGER_PIPE_COMMAND_1**, **BACKUP_MANAGER_PIPE_COMMAND_2**... to implement other pipe command. 130 | 131 | Examples: Archive a remote MySQL database through SSH: 132 | BACKUP_MANAGER_PIPE_COMMAND_0: ssh host -c \\"mysqldump -ufoo -pbar base\\" 133 | BACKUP_MANAGER_PIPE_NAME_0: base 134 | BACKUP_MANAGER_PIPE_FILETYPE_0: sql 135 | BACKUP_MANAGER_PIPE_COMPRESS_0: gzip 136 | Archive a specific directory, on a remote server through SSH: 137 | BACKUP_MANAGER_PIPE_COMMAND_1: ssh host -c \\"tar -c -z /home/user\\" 138 | BACKUP_MANAGER_PIPE_NAME_1: host.home.user 139 | BACKUP_MANAGER_PIPE_FILETYPE_1: tar.gz 140 | 141 | More help: https://raw.githubusercontent.com/sukria/Backup-Manager/master/doc/user-guide.txt 142 | 143 | ### Set your own environment variables 144 | 145 | #### Use command line argument 146 | Environment variables can be set by adding the --env argument in the command line, for example: 147 | 148 | docker run --env BACKUP_MANAGER_TARBALL_DIRECTORIES="/home/billy" \ 149 | --detach osixia/backup-manager:0.3.0 150 | 151 | #### Link environment file 152 | 153 | For example if your environment file is in : /data/backup-manager/environment/my-env.yaml 154 | 155 | docker run --volume /data/backup-manager/environment/my-env.yaml:/container/environment/01-custom/env.yaml \ 156 | --detach osixia/backup-manager:0.3.0 157 | 158 | Take care to link your environment file to `/container/environment/XX-somedir` (with XX < 99 so they will be processed before default environment files) and not directly to `/container/environment` because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE). 159 | 160 | #### Make your own image or extend this image 161 | 162 | This is the best solution if you have a private registry. Please refer to the [Advanced User Guide](#advanced-user-guide) just below. 163 | 164 | ## Advanced User Guide 165 | 166 | ### Extend osixia/backup-manager:0.3.0 image 167 | 168 | If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image. 169 | 170 | Dockerfile example: 171 | 172 | FROM osixia/backup-manager:0.3.0 173 | MAINTAINER Your Name 174 | 175 | ADD environment /container/environment/01-custom 176 | ADD gpg-keys /container/service/gpg/assets 177 | ADD my-backup-manager.conf /container/service/backup-manager/assets/backup-manager.conf 178 | 179 | 180 | ### Make your own backup-manager image 181 | 182 | Clone this project : 183 | 184 | git clone https://github.com/osixia/docker-backup-manager 185 | cd docker-backup-manager 186 | 187 | Adapt Makefile, set your image NAME and VERSION, for example : 188 | 189 | NAME = osixia/backup-manager 190 | VERSION = 0.2.0 191 | 192 | becomes : 193 | NAME = billy-the-king/backup-manager 194 | VERSION = 0.1.0 195 | 196 | Add your custom keys, environment files, config ... 197 | 198 | Build your image : 199 | 200 | make build 201 | 202 | Run your image : 203 | 204 | docker run -d billy-the-king/backup-manager:0.1.0 205 | 206 | ### Tests 207 | 208 | We use **Bats** (Bash Automated Testing System) to test this image: 209 | 210 | > [https://github.com/sstephenson/bats](https://github.com/sstephenson/bats) 211 | 212 | Install Bats, and in this project directory run : 213 | 214 | make test 215 | 216 | ### Under the hood: osixia/light-baseimage 217 | 218 | This image is based on osixia/light-baseimage. 219 | More info: https://github.com/osixia/docker-light-baseimage 220 | 221 | ## Security 222 | If you discover a security vulnerability within this docker image, please send an email to the Osixia! team at security@osixia.net. For minor vulnerabilities feel free to add an issue here on github. 223 | 224 | Please include as many details as possible. 225 | 226 | ## Changelog 227 | 228 | Please refer to: [CHANGELOG.md](CHANGELOG.md) 229 | -------------------------------------------------------------------------------- /image/service/backup-manager/assets/backup-manager.conf: -------------------------------------------------------------------------------- 1 | # Backup Manager Configuration File 2 | # 3 | # * This configuration file is divided into sections. 4 | # The 'global' section is mandatory, every keys defined in 5 | # this section are inherited in the other sections. 6 | # * There is one section per "backup method", you have to 7 | # fill the section of the chosen method. 8 | # 9 | ############################################################## 10 | 11 | ############################################################## 12 | # Repository - everything about where archives are 13 | ############################################################# 14 | 15 | # Where to store the archives 16 | export BM_REPOSITORY_ROOT="/data/backup" 17 | 18 | # Where to place temporary files 19 | export BM_TEMP_DIR="/tmp" 20 | 21 | # For security reasons, the archive repository and the generated 22 | # archives will be readable/writable by a given user/group. 23 | # This is recommended to set this to true. 24 | export BM_REPOSITORY_SECURE="true" 25 | 26 | # The repository will be readable/writable only by a specific 27 | # user:group pair if BM_REPOSITORY_SECURE is set to true. 28 | export BM_REPOSITORY_USER="root" 29 | export BM_REPOSITORY_GROUP="root" 30 | # You can also choose the permission to set the repository, default 31 | # is 770, pay attention to what you do there! 32 | export BM_REPOSITORY_CHMOD="770" 33 | 34 | ############################################################## 35 | # Archives - let's focus on the precious tarballs... 36 | ############################################################## 37 | 38 | # Each archive generated will be chmoded for security reasons 39 | # (BM_REPOSITORY_SECURE should be enabled for this). 40 | export BM_ARCHIVE_CHMOD="660" 41 | 42 | # Number of days we have to keep an archive (Time To Live) 43 | export BM_ARCHIVE_TTL="{{ BACKUP_MANAGER_TTL }}" 44 | 45 | # Do you want to purge only the top-level directory or all 46 | # directories under BM_REPOSITORY_ROOT? 47 | export BM_REPOSITORY_RECURSIVEPURGE="false" 48 | 49 | # Do you want to replace duplicates by symlinks? 50 | # (archive-DAY is a duplicate of archive-(DAY - 1) if they 51 | # are both the same according to MD5 hashes). 52 | export BM_ARCHIVE_PURGEDUPS="true" 53 | 54 | # Prefix of every archive on that box (default is HOSTNAME) 55 | export BM_ARCHIVE_PREFIX="$HOSTNAME" 56 | 57 | # Should we purge only archives built with $BM_ARCHIVE_PREFIX 58 | export BM_ARCHIVE_STRICTPURGE="true" 59 | 60 | # You may want to nice the commands run for archive-creation 61 | # (Recommanded for desktop users.) 62 | # Choose a nice level from -20 (most favorable scheduling) to 19 (least favorable). 63 | export BM_ARCHIVE_NICE_LEVEL="10" 64 | 65 | # The backup method to use. 66 | # Available methods are: 67 | # - tarball 68 | # - tarball-incremental 69 | # - mysql 70 | # - pgsql 71 | # - svn 72 | # - pipe 73 | # - none 74 | # If you don't want to use any backup method (you don't want to 75 | # build archives) then choose "none" 76 | export BM_ARCHIVE_METHOD="{{ BACKUP_MANAGER_ARCHIVE_METHOD }}" 77 | 78 | ############################################################## 79 | # Encryption - because you cannot trust the place your 80 | # archives are 81 | ############################################################## 82 | 83 | # If you want to encrypt your archives locally, Backup Manager 84 | # can use GPG while building the archive (so the archive is never 85 | # written to the disk without being encrypted. 86 | 87 | # Note: this feature is only possible with the following archive types: 88 | # tar, tar.gz, tar.bz2 89 | 90 | # Uncomment the following line if you want to enable encryption 91 | # available method: gpg 92 | # export BM_ENCRYPTION_METHOD="gpg" 93 | 94 | # The encryption will be made using a GPG ID 95 | # Examples: 96 | # export BM_ENCRYPTION_RECIPIENT="0x1EE5DD34" 97 | # export BM_ENCRYPTION_RECIPIENT="Alexis Sukrieh" 98 | # export BM_ENCRYPTION_RECIPIENT="sukria@sukria.net" 99 | 100 | # export BM_ENCRYPTION_RECIPIENT="{{ BACKUP_MANAGER_ENCRYPTION_RECIPIENT }}" 101 | 102 | ############################################################## 103 | # Section "TARBALL" 104 | # - Backup method: tarball 105 | ############################################################# 106 | 107 | # Archive filename format 108 | # long : host-full-path-to-folder.tar.gz 109 | # short : parentfolder.tar.gz 110 | export BM_TARBALL_NAMEFORMAT="long" 111 | 112 | # Type of archives 113 | # Available types are: 114 | # tar, tar.gz, tar.bz2, tar.lz, dar, zip. 115 | # Make sure to satisfy the appropriate dependencies 116 | # (bzip2, dar, lzma, ...). 117 | export BM_TARBALL_FILETYPE="tar.gz" 118 | 119 | # You can choose to build archives remotely over SSH. 120 | # You will then need to fill the BM_UPLOAD_SSH variables 121 | # (BM_UPLOAD_SSH_HOSTS, BM_UPLOAD_SSH_USER, BM_UPLOAD_SSH_KEY). 122 | # If this boolean is set to true, archive will be saved locally (in 123 | # BM_REPOSITORY_ROOT but will be built by the remote host). 124 | # Thus, BM_TARBALL_DIRECTORIES will be used to backup remote directories. 125 | # Those archive will be prefixed with the remote host name. 126 | export BM_TARBALL_OVER_SSH="false" 127 | 128 | # Do you want to dereference the files pointed by symlinks ? 129 | # enter true or false (true can lead to huge archives, be careful). 130 | export BM_TARBALL_DUMPSYMLINKS="false" 131 | 132 | # Targets to backup 133 | 134 | # You can use two different variables for defining the targets of 135 | # your backups, either a simple space-separated list (BM_TARBALL_DIRECTORIES) 136 | # or an array (BM_TARBALL_TARGETS[]). 137 | # Use the first one for simple path that doesn't contain spaces in their name. 138 | # Use the former if you want to specify paths to backups with spaces. 139 | 140 | # It's recommanded to use BM_TARBALL_TARGETS[] though. 141 | # Warning! You *must not* use both variables at the same time. 142 | # NOTE: The Debian package will only update BM_TARBALL_DIRECTORIES 143 | 144 | # Paths without spaces in their name: 145 | export BM_TARBALL_DIRECTORIES="{{ BACKUP_MANAGER_TARBALL_DIRECTORIES }}" 146 | 147 | # If one or more of the targets contain a space, use the array: 148 | # declare -a BM_TARBALL_TARGETS 149 | # BM_TARBALL_TARGETS[0]="/etc" 150 | # BM_TARBALL_TARGETS[1]="/boot" 151 | # export BM_TARBALL_TARGETS 152 | 153 | # Files to exclude when generating tarballs, you can put absolute 154 | # or relative paths, Bash wildcards are possible. 155 | export BM_TARBALL_BLACKLIST="" 156 | 157 | # With the "dar" filetype, you can choose a maximum slice limit. 158 | export BM_TARBALL_SLICESIZE="1000M" 159 | 160 | # Extra options to append to the tarball generation 161 | # (take care to what you do; this will be silently added to the 162 | # command line.) 163 | export BM_TARBALL_EXTRA_OPTIONS="" 164 | 165 | ############################################################## 166 | # The tarball-incremental method uses the same keys as the 167 | # tarball method, plus two others. 168 | ############################################################# 169 | 170 | # Which frequency to use for the master tarball? 171 | # possible values: weekly, monthly 172 | export BM_TARBALLINC_MASTERDATETYPE="{{ BACKUP_MANAGER_TARBALLINC_MASTERDATETYPE }}" 173 | 174 | # Number of the day, in the BM_TARBALLINC_MASTERDATETYPE frequency 175 | # when master tarballs should be made 176 | export BM_TARBALLINC_MASTERDATEVALUE="{{ BACKUP_MANAGER_TARBALLINC_MASTERDATEVALUE }}" 177 | 178 | # Examples: you want to make master tarballs every friday: 179 | # BM_TARBALLINC_MASTERDATETYPE="weekly" 180 | # BM_TARBALLINC_MASTERDATEVALUE="5" 181 | # 182 | # Or every first day of the month: 183 | # BM_TARBALLINC_MASTERDATETYPE="monthly" 184 | # BM_TARBALLINC_MASTERDATEVALUE="1" 185 | 186 | ############################################################## 187 | # Backup method: MYSQL 188 | ############################################################# 189 | 190 | # This method is dedicated to MySQL databases. 191 | # You should not use the tarball method for backing up database 192 | # directories or you may have corrupted archives. 193 | # Enter here the list of databases to backup. 194 | # Wildcard: __ALL__ (will dump all the databases in one archive) 195 | export BM_MYSQL_DATABASES="__ALL__" 196 | 197 | # The best way to produce MySQL dump is done by using the "--opt" switch 198 | # of mysqldump. This make the dump directly usable with mysql (add the drop table 199 | # statements), lock the tables during the dump and other things. 200 | # This is recommended for full-clean-safe backups, but needs a 201 | # privileged user (for the lock permissions). 202 | export BM_MYSQL_SAFEDUMPS="true" 203 | 204 | # The user who is allowed to read every databases filled in BM_MYSQL_DATABASES 205 | export BM_MYSQL_ADMINLOGIN="root" 206 | 207 | # its password 208 | export BM_MYSQL_ADMINPASS="" 209 | 210 | # the host where the database is 211 | export BM_MYSQL_HOST="localhost" 212 | 213 | # the port where MySQL listen to on the host 214 | export BM_MYSQL_PORT="3306" 215 | 216 | # which compression format to use? (gzip or bzip2) 217 | export BM_MYSQL_FILETYPE="bzip2" 218 | 219 | # Extra options to append to mysqldump 220 | # (take care to what you do; this will be silently added to the 221 | # command line.) 222 | export BM_MYSQL_EXTRA_OPTIONS="" 223 | 224 | # Make separate backups of each database? 225 | export BM_MYSQL_SEPARATELY="true" 226 | 227 | # Specify DBs to exclude here (separated by space) 228 | export BM_MYSQL_DBEXCLUDE="" 229 | 230 | ############################################################## 231 | # Backup method: PostgreSQL 232 | ############################################################# 233 | 234 | # This method is dedicated to PostgreSQL databases. 235 | # You should not use the tarball method for backing up database 236 | # directories or you may have corrupted archives. 237 | # Enter here the list of databases to backup. 238 | # Wildcard: __ALL__ (will dump all the databases in one archive) 239 | export BM_PGSQL_DATABASES="__ALL__" 240 | 241 | # The user who is allowed to read every databases filled in BM_PGSQL_DATABASES 242 | export BM_PGSQL_ADMINLOGIN="root" 243 | 244 | # its password 245 | export BM_PGSQL_ADMINPASS="" 246 | 247 | # the host where the database is 248 | export BM_PGSQL_HOST="localhost" 249 | 250 | # the port where PostgreSQL listen to on the host 251 | export BM_PGSQL_PORT="5432" 252 | 253 | # which compression format to use? (gzip or bzip2) 254 | export BM_PGSQL_FILETYPE="bzip2" 255 | 256 | # Extra options to append to pg_dump 257 | # (take care to what you do; this will be silently added to the 258 | # command line.) 259 | export BM_PGSQL_EXTRA_OPTIONS="" 260 | 261 | ############################################################## 262 | # Backup method: svn 263 | ############################################################# 264 | 265 | # Absolute paths to the svn repositories to archive 266 | export BM_SVN_REPOSITORIES="" 267 | 268 | # You can compress the resulting XML files 269 | # Supported compressor are: bzip2 and gzip 270 | export BM_SVN_COMPRESSWITH="bzip2" 271 | 272 | ############################################################## 273 | # Backup method: pipe 274 | ############################################################# 275 | 276 | # The "pipe" method is a generic way of making archive. 277 | # Its concept is simple, for every kind of archive you want 278 | # to make, you give: a command which will send output on stdout, 279 | # a name, a file type and optionnaly, a compressor. 280 | 281 | # Be careful, this feature uses arrays! 282 | declare -a BM_PIPE_COMMAND 283 | declare -a BM_PIPE_NAME 284 | declare -a BM_PIPE_FILETYPE 285 | declare -a BM_PIPE_COMPRESS 286 | 287 | # You can virtually implement whatever backup scenario you like 288 | # with this method. 289 | # 290 | # The resulting archives will be named like this: 291 | # $BM_ARCHIVE_PREFIX-$BM_PIPE_NAME.$DATE.$BM_PIPE_FILETYPE 292 | # If you specified a BM_PIPE_COMPRESS option, the resulting filename 293 | # will change as expected (eg, .gz if "gzip"). 294 | # 295 | # Here are a couple of examples for using this method: 296 | # BACKUP MANAGER COMMAND PIPE DATA 297 | 298 | # Archive a remote MySQL database through SSH: 299 | # BM_PIPE_COMMAND[0]="ssh host -c \"mysqldump -ufoo -pbar base\"" 300 | # BM_PIPE_NAME[0]="base" 301 | # BM_PIPE_FILETYPE[0]="sql" 302 | # BM_PIPE_COMPRESS[0]="gzip" 303 | # This will make somthing like: localhost-base.20050421.sql.gz 304 | 305 | # Archive a specific directory, on a remote server through SSH: 306 | # BM_PIPE_COMMAND[0]="ssh host -c \"tar -c -z /home/user\"" 307 | # BM_PIPE_NAME[0]="host.home.user" 308 | # BM_PIPE_FILETYPE[0]="tar.gz" 309 | # BM_PIPE_COMPRESS[0]="" 310 | # This will make somthing like: localhost-host.home.user.20050421.tar.gz 311 | 312 | export BM_PIPE_COMMAND 313 | export BM_PIPE_NAME 314 | export BM_PIPE_FILETYPE 315 | export BM_PIPE_COMPRESS 316 | 317 | ############################################################## 318 | # Section "UPLOAD" 319 | # You can upload archives to remote hosts with different 320 | # methods. 321 | ############################################################# 322 | 323 | # Which method to use for uploading archives, you can put 324 | # multiple methods here. 325 | # Available methods: 326 | # - scp 327 | # - ssh-gpg 328 | # - ftp 329 | # - rsync 330 | # - s3 331 | # - none 332 | 333 | # If you don't want to use any upload method (you don't want to 334 | # upload files to remote hosts) then choose "none" 335 | export BM_UPLOAD_METHOD="{{ BACKUP_MANAGER_UPLOAD_METHOD }}" 336 | 337 | # where to upload (global to all methods. Not required to be set for S3) 338 | export BM_UPLOAD_HOSTS="{{ BACKUP_MANAGER_UPLOAD_HOSTS }}" 339 | 340 | # Where to put archives on the remote hosts (global) 341 | export BM_UPLOAD_DESTINATION="{{ BACKUP_MANAGER_UPLOAD_DESTINATION }}" 342 | 343 | # Uncomment the 'export ...' line below to activate the uploaded archives 344 | # database. 345 | # Using the database will avoid extraneous uploads to remote hosts in the 346 | # case of running more than one backup-manager jobs per day (such as when 347 | # you are using different configuration files for different parts of your 348 | # filesystem). 349 | # Note that when you upload to multiple hosts, a single succesfull upload 350 | # will mark the archive as uploaded. Thus upload errors to specific hosts 351 | # will have to be resolved manually. 352 | # You can specify any filename, but it is recommended to keep the database 353 | # inside the archive repository. The variable's value has been preset to 354 | # that. 355 | #export BM_UPLOADED_ARCHIVES=${BM_REPOSITORY_ROOT}/${BM_ARCHIVE_PREFIX}-uploaded.list 356 | 357 | ############################################################## 358 | # The SSH method 359 | ############################################################# 360 | 361 | # the user to use for the SSH connections/transfers 362 | export BM_UPLOAD_SSH_USER="bmngr" 363 | 364 | # The private key to use for opening the connection 365 | export BM_UPLOAD_SSH_KEY="" 366 | 367 | # specific ssh hosts 368 | export BM_UPLOAD_SSH_HOSTS="" 369 | 370 | # port to use for SSH connections (leave blank for default one) 371 | export BM_UPLOAD_SSH_PORT="" 372 | 373 | # destination for ssh uploads (overrides BM_UPLOAD_DESTINATION) 374 | export BM_UPLOAD_SSH_DESTINATION="" 375 | 376 | # purge archives on remote hosts before uploading? 377 | export BM_UPLOAD_SSH_PURGE="true" 378 | 379 | # If you set BM_UPLOAD_SSH_PURGE, you can specify a time to live 380 | # for archives uploaded with SSH. 381 | # This can let you use different ttl's locally and remotely 382 | # By default, BM_ARCHIVE_TTL will be used. 383 | export BM_UPLOAD_SSH_TTL="" 384 | 385 | ############################################################## 386 | # The SSH-GPG method 387 | # The ssh-gpg method uses the same configuration keys as the 388 | # ssh method, plus one other 389 | ############################################################# 390 | 391 | # The gpg public key used for encryption, this can be a short 392 | # or long key id, or a descriptive name. See gpg man page for 393 | # all possibilities how to specify a key. 394 | export BM_UPLOAD_SSHGPG_RECIPIENT="" 395 | 396 | ############################################################## 397 | # The FTP method 398 | ############################################################# 399 | 400 | # Use FTP secured transfers (FTP over TLS) 401 | # User, password and data will be uploaded encrypted with SSL. 402 | # Passive mode will be automaticaly activated 403 | export BM_UPLOAD_FTP_SECURE="false" 404 | 405 | # Do you want to use FTP passive mode? 406 | # This is mandatory for NATed/firewalled environments 407 | export BM_UPLOAD_FTP_PASSIVE="true" 408 | 409 | # Timeout (in seconds) for FTP transfer 410 | # This setting only has effect when using FTP transfer with 411 | # secure mode disabled (BM_UPLOAD_FTP_SECURE to "false") 412 | export BM_UPLOAD_FTP_TIMEOUT="120" 413 | 414 | # Test the FTP connection before starting archives upload. 415 | # This will enable BM to try sending a 2MB test file before 416 | # sending any archive 417 | export BM_UPLOAD_FTP_TEST="false" 418 | 419 | # the user to use for the FTP connections/transfers 420 | export BM_UPLOAD_FTP_USER="{{ BACKUP_MANAGER_UPLOAD_FTP_USER }}" 421 | 422 | # the FTP user's password 423 | export BM_UPLOAD_FTP_PASSWORD="{{ BACKUP_MANAGER_UPLOAD_FTP_PASSWORD }}" 424 | 425 | # FTP specific remote hosts 426 | export BM_UPLOAD_FTP_HOSTS="" 427 | 428 | # purge archives on remote hosts before uploading? 429 | export BM_UPLOAD_FTP_PURGE="true" 430 | 431 | # You can specify a time to live for archives uploaded with FTP 432 | # This can let you use different ttl's locally and remotely 433 | # By default, BM_ARCHIVE_TTL will be used. 434 | export BM_UPLOAD_FTP_TTL="{{ BACKUP_MANAGER_UPLOAD_TTL }}" 435 | 436 | # destination for FTP uploads (overrides BM_UPLOAD_DESTINATION) 437 | export BM_UPLOAD_FTP_DESTINATION="" 438 | 439 | 440 | ############################################################## 441 | # The S3 method 442 | ############################################################# 443 | 444 | # The Amazon S3 method requires that you secure an S3 445 | # account. See http://aws.amazon.com 446 | 447 | # The bucket to upload to. This bucket must be dedicated to backup-manager 448 | export BM_UPLOAD_S3_DESTINATION="" 449 | 450 | # the S3 access key provided to you 451 | export BM_UPLOAD_S3_ACCESS_KEY="" 452 | 453 | # the S3 secret key provided to you 454 | export BM_UPLOAD_S3_SECRET_KEY="" 455 | 456 | # purge archives on remote hosts before uploading? 457 | export BM_UPLOAD_S3_PURGE="false" 458 | 459 | # You can specify a time to live for archives uploaded to S3 460 | # This can let you use different ttl's locally and remotely 461 | # By default, BM_ARCHIVE_TTL will be used. 462 | export BM_UPLOAD_S3_TTL="" 463 | 464 | ############################################################## 465 | # The RSYNC method 466 | ############################################################# 467 | 468 | # Which directories should be backuped with rsync 469 | export BM_UPLOAD_RSYNC_DIRECTORIES="" 470 | 471 | # Destination for rsync uploads (overrides BM_UPLOAD_DESTINATION) 472 | export BM_UPLOAD_RSYNC_DESTINATION="" 473 | 474 | # The list of remote hosts, if you want to enable the upload 475 | # system, just put some remote hosts here (fqdn or IPs) 476 | # Leave it empty if you want to use the hosts that are defined in 477 | # BM_UPLOAD_HOSTS 478 | export BM_UPLOAD_RSYNC_HOSTS="" 479 | 480 | # Do you want to dereference the files pointed by symlinks? 481 | # enter true or false (true can lead to huge archives, be careful). 482 | export BM_UPLOAD_RSYNC_DUMPSYMLINKS="false" 483 | 484 | # Files/folders to exclude when rsyncing. Warning: rsync will interpret 485 | # it as a mask, so will exclude any file/folder corresponding to it 486 | export BM_UPLOAD_RSYNC_BLACKLIST="" 487 | 488 | # Extra options to append to rsync 489 | # (take care to what you do; this will be silently added to the 490 | # command line.) 491 | export BM_UPLOAD_RSYNC_EXTRA_OPTIONS="" 492 | 493 | # Do you want to limit the maximum available bandwidth rsync 494 | # can use ? 495 | # By default, no bandwidth limit is applied. 496 | # Example: 32M, 1024K, ... 497 | export BM_UPLOAD_RSYNC_BANDWIDTH_LIMIT="" 498 | 499 | ############################################################## 500 | # Section "BURNING" 501 | # - Automatic CDR/CDRW/DVDR burning 502 | ############################################################# 503 | 504 | # the method of burning archives from the list : 505 | # - DVD : burn archives on a DVD medium 506 | # (that doesn't need formatting, like DVD+RW). 507 | # 508 | # - DVD-RW : blank the DVD medium and burn archives 509 | # (recommanded for DVD-RW media). 510 | # 511 | # - CDRW : blank the CDRW and burn the whole 512 | # ARCHIVES_REPOSITORY or only 513 | # the generated archives. 514 | # 515 | # - CDR : burn the whole ARCHIVES_REPOSITORY or 516 | # only the generated archives. 517 | # - none : disable the burning system 518 | # 519 | # Note that if backup-manager is run from interactive prompt you 520 | # will be asked to insert disc(s) when needed 521 | 522 | export BM_BURNING_METHOD="none" 523 | 524 | # When the CD is burnt, it is possible to check every file's 525 | # MD5 checksum to see if the CD is not corrupted. 526 | export BM_BURNING_CHKMD5="false" 527 | 528 | # The device to use for mounting the cdrom 529 | export BM_BURNING_DEVICE="/dev/cdrom" 530 | 531 | # You can force cdrecord to use a specific device 532 | # Fill in the full path to the device to use or even 533 | # e.g. BM_BURNING_DEVFORCED="/dev/cdrom" 534 | # If none specified, the default cdrecord device will be used. 535 | export BM_BURNING_DEVFORCED="" 536 | 537 | # By default backup-manager will make Joliet media (using the mkisofs switches 538 | # : "-R -J"). You can change these if you want to use non-Joliet disc images. 539 | # Change this only if you know what you're doing. Refer to mkisofs(8) for 540 | # details. 541 | export BM_BURNING_ISO_FLAGS="-R -J" 542 | 543 | # enter here the max size of your media 544 | # (usal sizes are 4200 for DVD media and 700 or 800 for CDR media) 545 | export BM_BURNING_MAXSIZE="650" 546 | 547 | 548 | ############################################################## 549 | # Advanced settings, use this with care. 550 | ############################################################# 551 | 552 | # Every output made can be sent to syslog 553 | # set this to "true" or "false" 554 | export BM_LOGGER="true" 555 | 556 | # Which level of messages do you want to log to syslog? 557 | # possible values are : debug,info,warning,error 558 | export BM_LOGGER_LEVEL="warning" 559 | 560 | # You can choose which facility to use 561 | export BM_LOGGER_FACILITY="user" 562 | 563 | # Enter here some shell script. 564 | # It will be executed before the first action of backup-manager. 565 | export BM_PRE_BACKUP_COMMAND="" 566 | 567 | # Enter here some shell script. 568 | # It will be executed after the last action of backup-manager. 569 | export BM_POST_BACKUP_COMMAND="" 570 | --------------------------------------------------------------------------------