Merge pull request #478 from disaster37/feature/rancherBackup

Upgrade rancher-backup entry
This commit is contained in:
Raúl Sánchez 2017-07-03 14:02:26 +02:00 committed by GitHub
commit 85ca4f5b9e
4 changed files with 175 additions and 83 deletions

View File

@ -1,45 +0,0 @@
backup:
environment:
CRON_SCHEDULE: ${CRON_SCHEDULE}
BACKEND: ${BACKEND}
TARGET_PATH: ${TARGET_PATH}
BK_FULL_FREQ: ${BK_FULL_FREQ}
BK_KEEP_FULL: ${BK_KEEP_FULL}
BK_KEEP_FULL_CHAIN: ${BK_KEEP_FULL_CHAIN}
VOLUME_SIZE: ${VOLUME_SIZE}
DEBUG: false
DISABLE_DUMP : ${DISABLE_DUMP}
DISABLE_DUMP_RANCHER: ${DISABLE_DUMP_RANCHER}
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}
labels:
io.rancher.sidekicks: backup-data
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environment
tty: true
image: webcenter/rancher-backup:1.0.2
stdin_open: false
privileged: true
volumes_from:
- backup-data
backup-data:
labels:
io.rancher.container.start_once: 'true'
image: alpine
volumes:
- /backup
net: none
command: /bin/true

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.0-2
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

@ -1,124 +1,190 @@
.catalog:
version: '2'
catalog:
name: "Rancher Backup"
version: "1.0.2"
version: "2.0.0"
description: "It's a general purpose to solve backup matter on Rancher"
uuid: rancher-backup-1.0.2
minimum_rancher_version: v0.56.0
minimum_rancher_version: v1.5.0
questions:
- variable: CRON_SCHEDULE
- 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
- variable: "BACKEND"
description: "The duplicity backend for remote backup"
label: "Backend"
type: "string"
required: true
- variable: TARGET_PATH
description: "The path on target backup (default, /backup)"
- variable: "TARGET_PATH"
description: "The path on target backup"
label: "Target path on backend"
type: "string"
required: true
default: "/backup"
- variable: BK_FULL_FREQ
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
- 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
- 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 (per default, 25)"
- variable: "VOLUME_SIZE"
description: "The volume size in MB"
label: "Volume size"
type: "string"
required: true
default: "25"
- variable: DISABLE_DUMP
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: "Disable dump"
label: "Enable dump service"
type: "string"
required: true
default: "false"
default: "true"
type: "enum"
options:
- "false"
- "true"
- variable: DISABLE_DUMP_RANCHER
- variable: "ENABLE_DUMP_STACK"
description: "If disabled, it's doesn't perform the backup of stack definition"
label: "Disable Rancher dump"
label: "Enable Rancher dump stack"
type: "string"
required: true
default: "false"
default: "true"
type: "enum"
options:
- "false"
- "true"
- variable: FTP_PASSWORD
- 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
- variable: "AWS_ACCESS_KEY_ID"
label: "AWS access key"
type: "string"
required: false
- variable: AWS_SECRET_ACCESS_KEY
- variable: "AWS_SECRET_ACCESS_KEY"
label: "AWS secret key"
type: "password"
required: false
- variable: AZURE_ACCOUNT_NAME
- variable: "AZURE_ACCOUNT_NAME"
label: "Azure account name"
type: "string"
required: false
- variable: AZURE_ACCOUNT_KEY
- variable: "AZURE_ACCOUNT_KEY"
label: "Azure account key"
type: "password"
required: false
- variable: CLOUDFILES_USERNAME
- variable: "CLOUDFILES_USERNAME"
label: "CloudFiles username"
type: "string"
required: false
- variable: CLOUDFILES_APIKEY
- variable: "CLOUDFILES_APIKEY"
label: "Cloudfiles API key"
type: "password"
required: false
- variable: DPBX_ACCESS_TOKEN
- variable: "DPBX_ACCESS_TOKEN"
label: "Dropbox access token"
type: "password"
required: false
- variable: GS_ACCESS_KEY_ID
- variable: "GS_ACCESS_KEY_ID"
label: "Google Storage key"
type: "string"
required: false
- variable: GS_SECRET_ACCESS_KEY
- variable: "GS_SECRET_ACCESS_KEY"
label: "Google Storage secret"
type: "password"
required: false
- variable: GOOGLE_DRIVE_ACCOUNT_KEY
- variable: "GOOGLE_DRIVE_ACCOUNT_KEY"
label: "Google Drive account key"
type: "password"
required: false
- variable: SWIFT_USERNAME
- variable: "SWIFT_USERNAME"
label: "Swift username"
type: "string"
required: false
- variable: SWIFT_PASSWORD
- variable: "SWIFT_PASSWORD"
label: "Swift password"
type: "password"
required: false
- variable: SWIFT_AUTHURL
- variable: "SWIFT_AUTHURL"
label: "Swift auth URL"
type: "string"
required: false
@ -127,5 +193,3 @@
backup:
scale: 1
backup-data:
scale: 1

View File

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