Merge pull request #703 from DevKyleS/rancherbackup_2.0.1-1

Updated Rancher Backup to v2.0.1
This commit is contained in:
Raúl Sánchez 2018-01-08 11:47:44 +01:00 committed by GitHub
commit 6bb34810ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 315 additions and 1 deletions

View File

@ -0,0 +1,48 @@
# Rancher Backup
## Info:
This template deploy one container that manage backup aspect in your Rancher environment.
For the moment, this template permit to perform the following actions:
- Dump automatically all databases supported before start the remote backup:
- PostgreSQL
- MySQL
- MariaDB
- MongoDB
- Elasticsearch
- Dump automatically all rancher stacks settings (docker-compose.yml and rancher-compose.yml) before start the remote backup
- Perform the remote backup of all `/backup` with duplicity (you can mount your shares storages on `/backup` to backup them)
To manage your backup policy, you can use the following environment variables:
- `CRON_SCHEDULE`: when you should start backup (incremental if full is not needed). For example, to start backup each day set `0 0 0 * * *`
- `BACKEND`: this is the target URL to externalize the backup. For example, to use FTP as external backup set `ftp://login@my-ftp.com` and add environment variable `FTP_PASSWORD`. For Amazon S3, set `s3://host[:port]/bucket_name[/prefix]`. Read the ducplicity man for [all supported backend](http://duplicity.nongnu.org/duplicity.1.html#sect7). There are no default value.
- `TARGET_PATH`: The path were store backup on local and remote. The default value is `/backup`.
- `BK_FULL_FREQ`: The frequency when you should make a full backup. For example, if you should make a full backup each 7 days, set `7D`. The default value is `7D`.
- `BK_KEEP_FULL`: How many full backup you should to keep. For example, to keep 3 full backup set `3`. The default value is `3`.
- `BK_KEEP_FULL_CHAIN`: The number of intermediate incremental backup you should keep with the full backup. For example, if you should keep only the incremental backup after the last full backup set `1`. The default value is set to `1`.
- `VOLUME_SIZE`: The volume size to store the backup (in MB). The default value is `25`.
- `DISABLE_DUMP`: Permit to disable the databases dump before launch the Backup
- `DISABLE_DUMP_RANCHER`: Permit to disable the Rancher settings dump before launch the Backup.
> Note: you can read [the duplicity documentation](http://duplicity.nongnu.org/duplicity.1.html) about backup policy
The currents backends supported by duplicity are FTP, Azure, B2, Cloud Files, Dropbox, FISH, Google Docs, Google Cloud Storage, HSI, Hubbic, Mega cloud storage, OneDrive backend, Par2 Wrapper Backend, S3 storage, Swift and MediaFire
## Deployment:
* Select Rancher Backup from the community catalog.
* Click deploy.
## Usage
* Just start the service and read the output or `/var/log/backup/backup.log` to check all work fine you expected.
### Specifics need
If you have a very specifics need to perform a dump before backup, you can create your own setting (read the README), and mount it to `/app/config`.
### General need
If you need to perform a dump before backup on general software that is not yet supported, you can :
- Contribute -> go to https://github.com/disaster37/rancher-backup
- Open enhance -> go to https://github.com/disaster37/rancher-backup/issues
## Issues / Enhance
Please open directly issues or enhance on https://github.com/disaster37/rancher-backup/issues

View File

@ -0,0 +1,71 @@
version: '2'
services:
backup:
environment:
- BACKUP_CRON_schedule=${CRON_SCHEDULE}
- BACKUP_DUPLICITY_url=${BACKEND}
- BACKUP_DUPLICITY_target-path=${TARGET_PATH}
- BACKUP_DUPLICITY_source-path=/backup
- BACKUP_DUPLICITY_full-if-older-than=${BK_FULL_FREQ}
- BACKUP_DUPLICITY_remove-all-but-n-full=${BK_KEEP_FULL}
- BACKUP_DUPLICITY_remove-all-inc-of-but-n-full=${BK_KEEP_FULL_CHAIN}
- BACKUP_DUPLICITY_volsize=${VOLUME_SIZE}
- BACKUP_DUPLICITY_options=${DUPLICITY_OPTIONS}
- DEBUG=false
- BACKUP_MODULE_database=${ENABLE_DUMP_SERVICE}
- BACKUP_MODULE_stack=${ENABLE_DUMP_STACK}
- BACKUP_MODULE_rancher-db=${ENABLE_DUMP_RANCHER_DATABASE}
- BACKUP_RANCHER_db_host=${RANCHER_DATABASE_HOST}
- BACKUP_RANCHER_db_port=${RANCHER_DATABASE_PORT}
- BACKUP_RANCHER_db_user=${RANCHER_DATABASE_USER}
- BACKUP_RANCHER_db_password=${RANCHER_DATABASE_PASSWORD}
- BACKUP_RANCHER_db_name=${RANCHER_DATABASE_NAME}
- DOCKER_HOST=docker-engine:2375
- FTP_PASSWORD=${FTP_PASSWORD}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AZURE_ACCOUNT_NAME=${AZURE_ACCOUNT_NAME}
- AZURE_ACCOUNT_KEY=${AZURE_ACCOUNT_KEY}
- CLOUDFILES_USERNAME=${CLOUDFILES_USERNAME}
- CLOUDFILES_APIKEY=${CLOUDFILES_APIKEY}
- DPBX_ACCESS_TOKEN=${DPBX_ACCESS_TOKEN}
- GS_ACCESS_KEY_ID=${GS_ACCESS_KEY_ID}
- GS_SECRET_ACCESS_KEY=${GS_SECRET_ACCESS_KEY}
- GOOGLE_DRIVE_ACCOUNT_KEY=${GOOGLE_DRIVE_ACCOUNT_KEY}
- SWIFT_USERNAME=${SWIFT_USERNAME}
- SWIFT_PASSWORD=${SWIFT_PASSWORD}
- SWIFT_AUTHURL=${SWIFT_AUTHURL}
- CONFD_BACKEND=${CONFD_BACKEND}
- CONFD_NODES=${CONFD_NODES}
- CONFD_PREFIX_KEY=${CONFD_PREFIX}
labels:
io.rancher.sidekicks: docker-engine
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environment
tty: true
image: webcenter/rancher-backup:2.0.1-1
stdin_open: false
volumes:
{{- if (contains .Values.VOLUME_DRIVER "/")}}
- ${VOLUME_DRIVER}:/data
{{- else}}
- backup-data:/data
{{- end}}
docker-engine:
privileged: true
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.hostname_override: container_name
image: index.docker.io/docker:1.13-dind
volumes:
{{- if (contains .Values.VOLUME_DRIVER "/")}}
- ${VOLUME_DRIVER}:/data
{{- else}}
- backup-data:/backup
{{- end}}
{{- if not (contains .Values.VOLUME_DRIVER "/")}}
volumes:
backup-data:
driver: local
{{- end}}

View File

@ -0,0 +1,195 @@
version: '2'
catalog:
name: "Rancher Backup"
version: "2.0.1"
description: "It's a general purpose to solve backup matter on Rancher"
minimum_rancher_version: v1.5.0
questions:
- variable: "CRON_SCHEDULE"
description: "The schedule with the Go cron syntaxe (per default, each day)"
label: "Schedule"
type: "string"
required: true
default: "0 0 0 * * *"
- variable: "BACKEND"
description: "The duplicity backend for remote backup"
label: "Backend"
type: "string"
required: true
- variable: "TARGET_PATH"
description: "The path on target backup"
label: "Target path on backend"
type: "string"
required: true
default: "/"
- variable: "BK_FULL_FREQ"
description: "The backup full frequency (per defaut, each 7 days)"
label: "Backup full frequency"
type: "string"
required: true
default: "7D"
- variable: "BK_KEEP_FULL"
description: "How many keep full backup (per default, keep 3s)"
label: "Backup full retention"
type: "string"
required: true
default: "5"
- variable: "BK_KEEP_FULL_CHAIN"
description: "How many keep incremental backup chain (per default, keep 1)"
label: "Backup incremental retention"
type: "string"
required: true
default: "1"
- variable: "VOLUME_SIZE"
description: "The volume size in MB"
label: "Volume size"
type: "string"
required: true
default: "200"
- variable: "DUPLICITY_OPTIONS"
description: "Pass options when invoke Duplicity command backup"
label: "Duplicity options"
type: "string"
required: false
- variable: "ENABLE_DUMP_SERVICE"
description: "If disabled, it's doesn't perform dump before save data"
label: "Enable dump service"
type: "string"
required: true
default: "true"
type: "enum"
options:
- "false"
- "true"
- variable: "ENABLE_DUMP_STACK"
description: "If disabled, it's doesn't perform the backup of stack definition"
label: "Enable Rancher dump stack"
type: "string"
required: true
default: "true"
type: "enum"
options:
- "false"
- "true"
- variable: "ENABLE_DUMP_RANCHER_DATABASE"
description: "If disabled, it's doesn't perform the dump of Rancher database"
label: "Enable Rancher database dump"
type: "string"
required: true
default: "true"
type: "enum"
options:
- "false"
- "true"
- variable: "VOLUME_DRIVER"
description: "Docker driver to store volume of local dump"
label: "Volume drver / Path"
type: "string"
required: true
default: "local"
- variable: "RANCHER_DATABASE_HOST"
description: "The rancher database host"
label: "Rancher DB host"
type: "string"
required: false
- variable: "RANCHER_DATABASE_PORT"
description: "The rancher database port"
label: "Rancher DB port"
type: "string"
required: false
default: "3306"
- variable: "RANCHER_DATABASE_NAME"
description: "The rancher database name"
label: "Rancher DB name"
type: "string"
required: false
default: "rancher"
- variable: "RANCHER_DATABASE_USER"
description: "The rancher database user"
label: "Rancher DB user"
type: "string"
required: false
default: "rancher"
- variable: "RANCHER_DATABASE_PASSWORD"
description: "The rancher database password"
label: "Rancher DB password"
type: "password"
required: false
- variable: "CONFD_BACKEND"
description: "The confd backend to grab config"
label: "Confd backend"
required: true
default: "env"
type: "string"
- variable: "CONFD_NODES"
description: "The confd nodes"
label: "Confd nodes"
required: false
type: "string"
- variable: "CONFD_PREFIX"
description: "The confd prefix"
label: "Confd prefix"
required: true
default: "/backup"
type: "string"
- variable: "FTP_PASSWORD"
label: "FTP password"
type: "password"
required: false
- variable: "AWS_ACCESS_KEY_ID"
label: "AWS access key"
type: "string"
required: false
- variable: "AWS_SECRET_ACCESS_KEY"
label: "AWS secret key"
type: "password"
required: false
- variable: "AZURE_ACCOUNT_NAME"
label: "Azure account name"
type: "string"
required: false
- variable: "AZURE_ACCOUNT_KEY"
label: "Azure account key"
type: "password"
required: false
- variable: "CLOUDFILES_USERNAME"
label: "CloudFiles username"
type: "string"
required: false
- variable: "CLOUDFILES_APIKEY"
label: "Cloudfiles API key"
type: "password"
required: false
- variable: "DPBX_ACCESS_TOKEN"
label: "Dropbox access token"
type: "password"
required: false
- variable: "GS_ACCESS_KEY_ID"
label: "Google Storage key"
type: "string"
required: false
- variable: "GS_SECRET_ACCESS_KEY"
label: "Google Storage secret"
type: "password"
required: false
- variable: "GOOGLE_DRIVE_ACCOUNT_KEY"
label: "Google Drive account key"
type: "password"
required: false
- variable: "SWIFT_USERNAME"
label: "Swift username"
type: "string"
required: false
- variable: "SWIFT_PASSWORD"
label: "Swift password"
type: "password"
required: false
- variable: "SWIFT_AUTHURL"
label: "Swift auth URL"
type: "string"
required: false
backup:
scale: 1

View File

@ -1,7 +1,7 @@
name: Rancher Backup name: Rancher Backup
description: | description: |
It's a general purpose to solve backup matter on Rancher. It's a general purpose to solve backup matter on Rancher.
version: 2.0.0 version: 2.0.1
category: Backup category: Backup
maintainer: "Sebastien Langoureaux <linuxworkgroup@gmail.com>" maintainer: "Sebastien Langoureaux <linuxworkgroup@gmail.com>"
license: MIT License license: MIT License