From f67cd5f6013c929b4a4997516c0f2d245aac455e Mon Sep 17 00:00:00 2001 From: disaster37 Date: Thu, 6 Apr 2017 08:29:56 +0000 Subject: [PATCH 1/4] Upgrade to rancher-backup 2.0.0 --- templates/rancher-backup/0/docker-compose.yml | 45 ------- .../rancher-backup/0/docker-compose.yml.tpl | 69 ++++++++++ .../rancher-backup/0/rancher-compose.yml | 121 ++++++++++++------ templates/rancher-backup/config.yml | 4 +- 4 files changed, 156 insertions(+), 83 deletions(-) delete mode 100644 templates/rancher-backup/0/docker-compose.yml create mode 100644 templates/rancher-backup/0/docker-compose.yml.tpl diff --git a/templates/rancher-backup/0/docker-compose.yml b/templates/rancher-backup/0/docker-compose.yml deleted file mode 100644 index b22a784..0000000 --- a/templates/rancher-backup/0/docker-compose.yml +++ /dev/null @@ -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 diff --git a/templates/rancher-backup/0/docker-compose.yml.tpl b/templates/rancher-backup/0/docker-compose.yml.tpl new file mode 100644 index 0000000..f357b15 --- /dev/null +++ b/templates/rancher-backup/0/docker-compose.yml.tpl @@ -0,0 +1,69 @@ +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} + 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 + 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}} + {{- end}} + +{{- if not (contains .Values.VOLUME_DRIVER "/")}} +volumes: + backup-data: + driver: local +{{- end}} diff --git a/templates/rancher-backup/0/rancher-compose.yml b/templates/rancher-backup/0/rancher-compose.yml index 67998e9..0fbc35e 100644 --- a/templates/rancher-backup/0/rancher-compose.yml +++ b/templates/rancher-backup/0/rancher-compose.yml @@ -1,124 +1,173 @@ -.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: "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 +176,3 @@ backup: scale: 1 -backup-data: - scale: 1 diff --git a/templates/rancher-backup/config.yml b/templates/rancher-backup/config.yml index 8c5aa70..eb47b19 100644 --- a/templates/rancher-backup/config.yml +++ b/templates/rancher-backup/config.yml @@ -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 " +license: MIT License From 95585ddbef9079a1fa98d553051ad241be70f519 Mon Sep 17 00:00:00 2001 From: disaster37 Date: Thu, 6 Apr 2017 09:39:55 +0000 Subject: [PATCH 2/4] Fix template --- templates/rancher-backup/0/docker-compose.yml.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/rancher-backup/0/docker-compose.yml.tpl b/templates/rancher-backup/0/docker-compose.yml.tpl index f357b15..882b41a 100644 --- a/templates/rancher-backup/0/docker-compose.yml.tpl +++ b/templates/rancher-backup/0/docker-compose.yml.tpl @@ -60,7 +60,6 @@ services: {{- else}} - backup-data:/backup {{- end}} - {{- end}} {{- if not (contains .Values.VOLUME_DRIVER "/")}} volumes: From f35c5b55294f6226376b436a70c6579035d939d0 Mon Sep 17 00:00:00 2001 From: disaster37 Date: Thu, 6 Apr 2017 10:03:05 +0000 Subject: [PATCH 3/4] Fix rancher-backup template --- .../rancher-backup/0/docker-compose.yml.tpl | 37 ++++++++++--------- .../rancher-backup/0/rancher-compose.yml | 17 +++++++++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/templates/rancher-backup/0/docker-compose.yml.tpl b/templates/rancher-backup/0/docker-compose.yml.tpl index 882b41a..d58d4ea 100644 --- a/templates/rancher-backup/0/docker-compose.yml.tpl +++ b/templates/rancher-backup/0/docker-compose.yml.tpl @@ -2,24 +2,24 @@ 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} + - 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} + - 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} @@ -35,6 +35,9 @@ services: - 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 diff --git a/templates/rancher-backup/0/rancher-compose.yml b/templates/rancher-backup/0/rancher-compose.yml index 0fbc35e..8a1feb4 100644 --- a/templates/rancher-backup/0/rancher-compose.yml +++ b/templates/rancher-backup/0/rancher-compose.yml @@ -115,6 +115,23 @@ catalog: 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" From 9b15a416d94f99c1c4ec36a088a8c8f5b44d8df3 Mon Sep 17 00:00:00 2001 From: disaster37 Date: Thu, 6 Apr 2017 15:18:21 +0000 Subject: [PATCH 4/4] Update rancher-backup image --- templates/rancher-backup/0/docker-compose.yml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/rancher-backup/0/docker-compose.yml.tpl b/templates/rancher-backup/0/docker-compose.yml.tpl index d58d4ea..155e64c 100644 --- a/templates/rancher-backup/0/docker-compose.yml.tpl +++ b/templates/rancher-backup/0/docker-compose.yml.tpl @@ -43,7 +43,7 @@ services: io.rancher.container.create_agent: true io.rancher.container.agent.role: environment tty: true - image: webcenter/rancher-backup:2.0.0 + image: webcenter/rancher-backup:2.0.0-2 stdin_open: false volumes: {{- if (contains .Values.VOLUME_DRIVER "/")}}