Permalink
Browse files

Merge pull request #772 from amazeeio/restic-backup-support

add restic backup support:
  • Loading branch information...
Schnitzel committed Nov 18, 2018
2 parents 6296c2b + 2fffe9c commit c97e38083267eb5de33f7dc11091fce6746221b3
@@ -362,6 +362,20 @@ else
done
fi
# If restic backups are supported by this cluster we create the schedule definition
if oc apply --insecure-skip-tls-verify customresourcedefinition schedules.backup.appuio.ch > /dev/null; then
TEMPLATE_PARAMETERS=()
BACKUP_SCHEDULE=$( /oc-build-deploy/scripts/convert-crontab.sh "${OPENSHIFT_PROJECT}" "H 0 * * *")
TEMPLATE_PARAMETERS+=(-p BACKUP_SCHEDULE="${BACKUP_SCHEDULE}")
PRUNE_SCHEDULE=$( /oc-build-deploy/scripts/convert-crontab.sh "${OPENSHIFT_PROJECT}" "H 3 * * *")
TEMPLATE_PARAMETERS+=(-p PRUNE_SCHEDULE="${PRUNE_SCHEDULE}")
OPENSHIFT_TEMPLATE="/oc-build-deploy/openshift-templates/backup/schedule.yml"
. /oc-build-deploy/scripts/exec-openshift-resources.sh
fi
if [ -f /oc-build-deploy/lagoon/${YAML_CONFIG_FILE}.yml ]; then
oc apply --insecure-skip-tls-verify -n ${OPENSHIFT_PROJECT} -f /oc-build-deploy/lagoon/${YAML_CONFIG_FILE}.yml
fi
@@ -594,7 +608,7 @@ do
OPENSHIFT_SERVICES_TEMPLATE="/oc-build-deploy/openshift-templates/${SERVICE_TYPE}/pvc.yml"
if [ -f $OPENSHIFT_SERVICES_TEMPLATE ]; then
OPENSHIFT_TEMPLATE=$OPENSHIFT_SERVICES_TEMPLATE
. /oc-build-deploy/scripts/exec-openshift-create-pvc.sh
. /oc-build-deploy/scripts/exec-openshift-resources.sh
fi
CRONJOB_COUNTER=0
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Template
metadata:
creationTimestamp: null
name: lagoon-openshift-template-schedule
parameters:
- name: SERVICE_NAME
description: Name of this service
required: true
- name: SAFE_BRANCH
description: Which branch this belongs to, special chars replaced with dashes
required: true
- name: SAFE_PROJECT
description: Which project this belongs to, special chars replaced with dashes
required: true
- name: BRANCH
description: Which branch this belongs to, original value
required: true
- name: PROJECT
description: Which project this belongs to, original value
required: true
- name: LAGOON_GIT_SHA
description: git hash sha of the current deployment
required: true
- name: SERVICE_ROUTER_URL
description: URL of the Router for this service
value: ""
- name: OPENSHIFT_PROJECT
description: Name of the Project that this service is in
required: true
- name: REGISTRY
description: Registry where Images are pushed to
required: true
- name: BACKUP_SCHEDULE
description: Schedule of the Backup in Cron format
required: true
- name: PRUNE_SCHEDULE
description: Schedule of the Pruning in Cron format
required: true
objects:
- apiVersion: backup.appuio.ch/v1alpha1
kind: Schedule
metadata:
name: backup-schedule
spec:
backup:
keepJobs: 2
schedule: '${BACKUP_SCHEDULE}'
check:
schedule: 0 0 * * 0
prune:
retention:
keepDaily: 7
keepWeekly: 4
schedule: '${PRUNE_SCHEDULE}'
@@ -72,6 +72,10 @@ objects:
type: ${DEPLOYMENT_STRATEGY}
template:
metadata:
annotations:
appuio.ch/backupcommand: >-
mysqldump --all-databases -h $MARIADB_HOST -u $MARIADB_USERNAME
-p$MARIADB_PASSWORD
creationTimestamp: null
labels:
service: ${SERVICE_NAME}
@@ -58,6 +58,10 @@ objects:
type: ${DEPLOYMENT_STRATEGY}
template:
metadata:
annotations:
appuio.ch/backupcommand: >-
mysqldump --all-databases -h $MARIADB_HOST -u $MARIADB_USERNAME
-p$MARIADB_PASSWORD
creationTimestamp: null
labels:
service: ${SERVICE_NAME}
@@ -47,6 +47,8 @@ objects:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
appuio.ch/backup: "true"
name: ${SERVICE_NAME}
spec:
accessModes:
@@ -47,6 +47,8 @@ objects:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
appuio.ch/backup: "true"
name: ${SERVICE_NAME}
spec:
accessModes:
@@ -41,6 +41,8 @@ objects:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
appuio.ch/backup: "true"
name: ${SERVICE_NAME}
spec:
accessModes:

This file was deleted.

Oops, something went wrong.

0 comments on commit c97e380

Please sign in to comment.