Sign inSign up

osshelp/backup

By osshelp

Updated almost 3 years ago

Useful backup tools and clients baked as all-in-one

Image
1

3.1K

osshelp/backup repository overview

Description

Based on official alpine image with backup utils.

Deploy examples

Typical
  backup:
    image: osshelp/backup:stable
    restart: always
    environment:
      CRON_TIME: "{min: 17, hour: 2}"
      MAILTO: $PD_EMAIL
      SERVER_NAME: project-server
      POSTGRES_PASSWORD: $POSTGRES_PASSWORD
      COMPRES_DIRS: "[/mnt/dir1, /mnt/dir2]"
      SYNC_DIRS: "[/mnt/bigdir]"
      RCLONE_STORAGE: "{name: b2_storage_name, type: b2, account: $B2_ACCOUNT, key: $B2_KEY}"
    volumes:
      - /mnt/docker/backup:/backup
      - /mnt/docker/someservice1/dir:/mnt/dir1
      - /mnt/docker/someservice2/dir:/mnt/dir2
      - /mnt/docker/someservice3/bigdir:/mnt/bigdir
    networks:
      - net
With custom script
  backup:
    image: osshelp/backup:stable
    restart: always
    environment:
      CRON_TIME: "{min: 17, hour: 2}"
      CUSTOM_BACKUP_COMMANDS: |
        ls -1 /mnt/gitlab-backups | tail -1 | grep -q "$$(date +%Y_%m_%d)" || show_error "Backup archive doesn't exist"
        mkdir -p "$$backup_dir/$$current_date"
        mv "/mnt/gitlab-backups/$$(ls -1 /mnt/gitlab-backups | tail -1)" "$$backup_dir/$$current_date/"
      MAILTO: $PD_EMAIL
      SERVER_NAME: project-server
      RCLONE_STORAGE: "{name: b2_storage_name, type: b2, account: $B2_ACCOUNT, key: $B2_KEY}"
    volumes:
      - /mnt/docker/backup:/backup
      - /mnt/docker/gitlab/var/opt/gitlab/backups:/mnt/gitlab-backups
    networks:
      - net

Internal vars in CUSTOM_BACKUP_COMMANDS must be escaped like $$.

Parameters

SettingDefaultDescription
COMPRES_DIRS[]List of directories for backup
COMPRES_DIRS_EXCLUDE[]List of direcotries for exlude
CRON_TIME{min: 15, hour: 3}Backup task cron time
CRON_LOGLEVEL8Cron Log Level. Most verbose 0
CUSTOM_BACKUP_COMMANDS-Custom command(s) for backup function
LOCAL_DAYS0Number of local copies +1
MONGO_HOST-MongoDB host
MONGO_AUTH_DBadminMongoDB authentication database
MONGO_USERadminMongoDB user
MONGO_PASSWORD-MongoDB password
MONGO_IGNORE_DBS[]List of ignored databases
MAILTO-Notify email address
MYSQL_HOSTmysqlMySQL host
MYSQL_USERrootMySQL user
MYSQL_PASSWORD-MySQL password
MYSQL_IGNORE_DBS[information_schema, performance_schema, pinba, phpmyadmin, sys]List of ignored databases
POSTGRES_HOSTpostgresPostgreSQL host
POSTGRES_USERpostgresPostgreSQL user
POSTGRES_PASSWORD-PostgreSQL password
POSTGRES_IGNORE_DBS[template]List of ignored databases
RCLONE_STORAGE-Rclone remote storage
REMOTE_SCHEME{daily: 7, weekly: 4, monthly: 3}Number of remote copies by type
REDIS_HOST-Redis host
REDIS_PASSWORD-Redis password
SSMTP_MAILHUBcontainer default gatewayMail relay host
SSMTP_HOSTNAMEhostname -fSSMTP hostname
SSMTP_REWRITE_DOMAIN-SSMTP rewrite domain
SSMTP_FROM_LINE_OVERRIDE-SSMTP From line override
SYNC_DIRS[]List of directories for sync
SERVER_NAME-Server for notifies
TIMEZONEEurope/MoscowTimezone
Cron time format
SettingDefaultDescription
min15Minute
hour3Hour
day*Day of mounth
mounth*Mounth
day_of_week*Day of week

Example:

    environment:
      CRON_TIME: "{min: 34, hour: 1, day: '*/2'}"
Rclone storage format

The format is the same as in the Ansible role:

SettingDefaultDescription
name-Storage name
key-Key:value for rclone storage

Example:

    environment:
      RCLONE_STORAGE: "{name: b2_storage_name, type: b2, account: $B2_ACCOUNT, key: $B2_KEY}"

Sources

Source repository is available at Github here.

License

GPL3

Author

OSSHelp Team, see https://oss.help

Tag summary

Content type

Image

Digest

sha256:f823af9c7

Size

142.9 MB

Last updated

almost 3 years ago

docker pull osshelp/backup