Add rancher-backup to the catalog

This commit is contained in:
Sebastien Langoureaux 2017-02-01 10:00:54 +00:00
parent d4f83acad5
commit 2a4341f280
5 changed files with 298 additions and 0 deletions

View File

@ -0,0 +1,52 @@
# 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
You must add your Rancher environment credential in environments variables to auto discover:
- `RANCHER_API_URL`: the API URL with your project ID
- `RANCHER_API_KEY`: the API key
- `RANCHER_API_SECRET`: the API secret key
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,46 @@
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}
RANCHER_API_URL: ${RANCHER_API_URL}
RANCHER_API_KEY: ${RANCHER_API_KEY}
RANCHER_API_SECRET: ${RANCHER_API_SECRET}
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
tty: true
image: webcenter/rancher-backup:1.0.1
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,146 @@
.catalog:
name: "Rancher Backup"
version: "1.0.1"
description: "It's a general purpose to solve backup matter on Rancher"
uuid: rancher-backup-1.0.1
minimum_rancher_version: v0.56.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 (default, /backup)"
label: "Target path on backend"
type: "string"
required: true
default: "/backup"
- 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 (per default, 25)"
label: "Volume size"
type: "string"
required: true
default: "25"
- variable: DISABLE_DUMP
description: "If disabled, it's doesn't perform dump before save data"
label: "Disable dump"
type: "string"
required: true
default: "false"
type: "enum"
options:
- "false"
- "true"
- variable: DISABLE_DUMP_RANCHER
description: "If disabled, it's doesn't perform the backup of stack definition"
label: "Disable Rancher dump"
type: "string"
required: true
default: "false"
type: "enum"
options:
- "false"
- "true"
- variable: RANCHER_API_URL
description: "The Rancher API URL with project ID"
label: "Rancher API URL"
type: "string"
required: true
- variable: RANCHER_API_KEY
description: "The Rancher API key"
label: "Rancher API key"
type: "password"
required: true
- variable: RANCHER_API_SECRET
description: "The Rancher API secret key"
label: "Rancher API secret"
type: "password"
required: true
- 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
backup-data:
scale: 1

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="303.002px" height="303.002px" viewBox="0 0 303.002 303.002" style="enable-background:new 0 0 303.002 303.002;"
xml:space="preserve">
<g>
<g>
<path d="M151.501,0c66.75,0,123.194,27.559,125.104,60.549c-1.91,32.987-58.354,60.553-125.104,60.553
c-66.752,0-123.191-27.56-125.104-60.553C28.31,27.559,84.749,0,151.501,0z"/>
<path d="M276.785,240.744c0,33.747-57.369,62.258-125.284,62.258S26.217,274.491,26.217,240.744v-29.771
c21.449,25.754,68.887,43.27,125.284,43.27s103.834-17.521,125.284-43.27V240.744z"/>
<path d="M276.785,179.688c0,33.746-57.369,62.258-125.284,62.258S26.217,213.434,26.217,179.688v-31.009
c21.449,25.748,68.887,43.259,125.284,43.259s103.834-17.522,125.284-43.259V179.688z"/>
<path d="M276.785,117.381c0,33.748-57.369,62.257-125.284,62.257s-125.284-28.51-125.284-62.257V90.135
c21.449,25.754,68.887,43.258,125.284,43.258s103.834-17.51,125.284-43.258V117.381z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,5 @@
name: Rancher Backup
description: |
It's a general purpose to solve backup matter on Rancher.
version: 1.0.1
category: Backup