ADD: implement migration and backup configurations for Nextcloud with Longhorn support
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: apps-migration
|
||||
namespace: nextcloud
|
||||
spec:
|
||||
volumes:
|
||||
- name: old-apps
|
||||
persistentVolumeClaim:
|
||||
claimName: nextcloud-apps-pvc
|
||||
- name: new-apps
|
||||
persistentVolumeClaim:
|
||||
claimName: nextcloud-apps-pvc-longhorn
|
||||
containers:
|
||||
- name: migrator
|
||||
image: alpine:3.18
|
||||
volumeMounts:
|
||||
- name: old-apps
|
||||
mountPath: /old
|
||||
- name: new-apps
|
||||
mountPath: /new
|
||||
command: ['sh']
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
echo "Copying apps data..."
|
||||
if [ "$(ls -A /old)" ]; then
|
||||
cp -rv /old/* /new/ 2>/dev/null || true
|
||||
echo "Apps migration completed"
|
||||
else
|
||||
echo "Old apps is empty"
|
||||
fi
|
||||
sleep infinity
|
||||
restartPolicy: Never
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: nextcloud-mariadb-pvc-longhorn
|
||||
namespace: nextcloud
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: longhorn
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: mariadb-restore
|
||||
namespace: nextcloud
|
||||
spec:
|
||||
nodeName: knode0
|
||||
containers:
|
||||
- name: restore
|
||||
image: busybox
|
||||
command: ["sleep", "3600"]
|
||||
volumeMounts:
|
||||
- name: new
|
||||
mountPath: /new
|
||||
- name: oldbackup
|
||||
mountPath: /backup
|
||||
volumes:
|
||||
- name: new
|
||||
persistentVolumeClaim:
|
||||
claimName: nextcloud-mariadb-pvc-longhorn
|
||||
- name: oldbackup
|
||||
hostPath:
|
||||
path: /var/lib/nextcloud/mariadb-backup
|
||||
type: DirectoryOrCreate
|
||||
Reference in New Issue
Block a user