nextcloud: persist web root in pvc

This commit is contained in:
Brad Stein 2026-01-07 09:40:25 -03:00
parent a711c450d3
commit 9bb90053a1
5 changed files with 55 additions and 0 deletions

View File

@ -66,6 +66,8 @@ spec:
cpu: 500m cpu: 500m
memory: 512Mi memory: 512Mi
volumeMounts: volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
mountPath: /var/www/html/config mountPath: /var/www/html/config
- name: nextcloud-custom-apps - name: nextcloud-custom-apps
@ -85,6 +87,9 @@ spec:
- name: nextcloud-user-data - name: nextcloud-user-data
persistentVolumeClaim: persistentVolumeClaim:
claimName: nextcloud-user-data claimName: nextcloud-user-data
- name: nextcloud-web
persistentVolumeClaim:
claimName: nextcloud-web
- name: sync-script - name: sync-script
configMap: configMap:
name: nextcloud-mail-sync-script name: nextcloud-mail-sync-script

View File

@ -24,6 +24,8 @@ spec:
args: args:
- "cd /var/www/html && php -f cron.php" - "cd /var/www/html && php -f cron.php"
volumeMounts: volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
mountPath: /var/www/html/config mountPath: /var/www/html/config
- name: nextcloud-custom-apps - name: nextcloud-custom-apps
@ -40,3 +42,6 @@ spec:
- name: nextcloud-user-data - name: nextcloud-user-data
persistentVolumeClaim: persistentVolumeClaim:
claimName: nextcloud-user-data claimName: nextcloud-user-data
- name: nextcloud-web
persistentVolumeClaim:
claimName: nextcloud-web

View File

@ -23,6 +23,26 @@ spec:
runAsUser: 33 runAsUser: 33
runAsGroup: 33 runAsGroup: 33
initContainers: initContainers:
- name: seed-nextcloud-web
image: nextcloud:29-apache
command: ["/bin/sh", "-c"]
args:
- |
if [ ! -f /var/www/html/version.php ]; then
echo "Seeding Nextcloud webroot..."
tar -C /usr/src/nextcloud -cf - \
--exclude=./config \
--exclude=./data \
--exclude=./custom_apps \
. | tar -C /var/www/html -xf -
chown -R 33:33 /var/www/html || true
fi
securityContext:
runAsUser: 0
runAsGroup: 0
volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: fix-perms - name: fix-perms
image: alpine:3.20 image: alpine:3.20
command: ["/bin/sh", "-c"] command: ["/bin/sh", "-c"]
@ -166,6 +186,8 @@ spec:
name: nextcloud-oidc name: nextcloud-oidc
key: client-secret key: client-secret
volumeMounts: volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
mountPath: /var/www/html/config mountPath: /var/www/html/config
- name: nextcloud-custom-apps - name: nextcloud-custom-apps
@ -257,6 +279,8 @@ spec:
- containerPort: 80 - containerPort: 80
name: http name: http
volumeMounts: volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
mountPath: /var/www/html/config mountPath: /var/www/html/config
- name: nextcloud-custom-apps - name: nextcloud-custom-apps
@ -274,6 +298,9 @@ spec:
cpu: 1 cpu: 1
memory: 3Gi memory: 3Gi
volumes: volumes:
- name: nextcloud-web
persistentVolumeClaim:
claimName: nextcloud-web
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
persistentVolumeClaim: persistentVolumeClaim:
claimName: nextcloud-config claimName: nextcloud-config

View File

@ -34,6 +34,8 @@ spec:
name: nextcloud-admin name: nextcloud-admin
key: admin-password key: admin-password
volumeMounts: volumeMounts:
- name: nextcloud-web
mountPath: /var/www/html
- name: nextcloud-config-pvc - name: nextcloud-config-pvc
mountPath: /var/www/html/config mountPath: /var/www/html/config
- name: nextcloud-custom-apps - name: nextcloud-custom-apps
@ -60,6 +62,9 @@ spec:
- name: nextcloud-user-data - name: nextcloud-user-data
persistentVolumeClaim: persistentVolumeClaim:
claimName: nextcloud-user-data claimName: nextcloud-user-data
- name: nextcloud-web
persistentVolumeClaim:
claimName: nextcloud-web
- name: maintenance-script - name: maintenance-script
configMap: configMap:
name: nextcloud-maintenance-script name: nextcloud-maintenance-script

View File

@ -27,6 +27,19 @@ spec:
--- ---
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata:
name: nextcloud-web
namespace: nextcloud
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
storageClassName: astreae
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: metadata:
name: nextcloud-user-data name: nextcloud-user-data
namespace: nextcloud namespace: nextcloud