Commit 3a26a91e authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Add upgrade & backup

Add initContainers to run "cubicweb-ctl upgrade" with backup enabled.
Add backup cronjob running "db-dump" every day.
parent 8aa1686db505
......@@ -49,6 +49,24 @@ spec:
- name: config
configMap:
name: intranet
- name: backup
persistentVolumeClaim:
claimName: backup
initContainers:
- name: upgrade
image: r.intra.logilab.fr/intranet/intranet
imagePullPolicy: Always
command: ["cubicweb-ctl", "upgrade", "--backup-db=y", "--force", "--verbosity=0", "intranet"]
envFrom:
- secretRef:
name: intranet-env
resources:
requests:
cpu: 50m
memory: 500Mi
volumeMounts:
- name: backup
mountPath: /etc/cubicweb.d/intranet/backup
containers:
- name: intranet
image: r.intra.logilab.fr/intranet/intranet
......@@ -59,6 +77,8 @@ spec:
volumeMounts:
- name: static
mountPath: /etc/cubicweb.d/intranet/data
- name: backup
mountPath: /etc/cubicweb.d/intranet/backup
resources:
requests:
cpu: 50m
......@@ -131,3 +151,38 @@ spec:
ports:
- protocol: TCP
port: 8000
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: intranet-backup
spec:
schedule: "0 6 * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
metadata:
labels:
app: intranet
spec:
restartPolicy: Never
volumes:
- name: backup
persistentVolumeClaim:
claimName: backup
containers:
- name: intranet
image: r.intra.logilab.fr/intranet/intranet
imagePullPolicy: Always
command: ["cubicweb-ctl", "db-dump", "intranet"]
envFrom:
- secretRef:
name: intranet-env
volumeMounts:
- name: backup
mountPath: /etc/cubicweb.d/intranet/backup
resources:
requests:
cpu: 50m
memory: 500Mi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment