Add limesurvey, migrating its data off local-path onto GlusterFS
LimeSurvey was never in this repo, and its two PVCs used the k3s local-path
StorageClass: both volumes were pinned to rpi-worker-3's local disk with
persistentVolumeReclaimPolicy: Delete. That put the survey data on a single
SD-backed node with no replication, where deleting the PVC would destroy it.
Both volumes now live on gvolume0 under /mnt/gvolume0/limesurvey/{app,db},
with Retain, matching the pattern used by vaultwarden and tududi. Migrated
2026-09-21 via mysqldump/restore; verified identical afterwards (3 surveys,
742 responses, 2 users, 17 questions, 60 tables).
db-config.yaml is required, not optional: InnoDB's defaults assume a local
POSIX filesystem, and on a GlusterFS FUSE mount native AIO is unavailable and
O_DIRECT unreliable. Without innodb_use_native_aio=0 and
innodb_flush_method=fsync, MariaDB either fails to start or risks corruption.
A nightly dump to /mnt/gvolume0/limesurvey/backups (14 day retention) is
included -- a volume survives losing a node, but a logical dump also survives
corruption, a bad upgrade and mistaken deletes.
The old local-path PVCs (limesurvey-db-data, limesurvey-uploads) are
deliberately left in place as a rollback and are not managed here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
097dbeb7ea
commit
91d96eb17a
@@ -0,0 +1,45 @@
|
||||
# Added 2026-09-21. The datadir now lives on GlusterFS, which survives losing a
|
||||
# node -- but a logical dump also survives corruption, a bad upgrade, and
|
||||
# fat-fingered deletes, which a volume does not. Keeps 14 days.
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: limesurvey-db-backup
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
schedule: "17 3 * * *"
|
||||
concurrencyPolicy: Forbid
|
||||
successfulJobsHistoryLimit: 2
|
||||
failedJobsHistoryLimit: 3
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: dump
|
||||
image: docker.io/library/mariadb:11
|
||||
env:
|
||||
- name: MARIADB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: limesurvey
|
||||
key: db-root-password
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -e
|
||||
f=/backups/limesurvey-$(date -u +%Y%m%d-%H%M%S).sql.gz
|
||||
mariadb-dump -h limesurvey-db -u root -p"$MARIADB_ROOT_PASSWORD" \
|
||||
--single-transaction --routines --triggers --events \
|
||||
--databases limesurvey | gzip > "$f"
|
||||
echo "wrote $f ($(stat -c%s "$f") bytes)"
|
||||
find /backups -name 'limesurvey-*.sql.gz' -mtime +14 -delete
|
||||
volumeMounts:
|
||||
- name: backups
|
||||
mountPath: /backups
|
||||
volumes:
|
||||
- name: backups
|
||||
persistentVolumeClaim:
|
||||
claimName: limesurvey-backups
|
||||
@@ -0,0 +1,15 @@
|
||||
# InnoDB defaults assume a local POSIX filesystem. The datadir now lives on a
|
||||
# GlusterFS FUSE mount, where native async I/O is unavailable and O_DIRECT is
|
||||
# unreliable -- without these, MariaDB either fails to start ("Failed to
|
||||
# initialize AIO") or risks corruption. Keep these with the gluster PV.
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: limesurvey-db-config
|
||||
namespace: limesurvey
|
||||
data:
|
||||
99-gluster.cnf: |
|
||||
[mariadb]
|
||||
innodb_use_native_aio = 0
|
||||
innodb_flush_method = fsync
|
||||
innodb_file_per_table = 1
|
||||
@@ -0,0 +1,59 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: limesurvey-db
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: limesurvey-db
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: limesurvey-db
|
||||
spec:
|
||||
containers:
|
||||
- name: mariadb
|
||||
image: docker.io/library/mariadb:11
|
||||
env:
|
||||
- name: MARIADB_INITDB_SKIP_TZINFO
|
||||
value: "1"
|
||||
- name: MARIADB_DATABASE
|
||||
value: limesurvey
|
||||
- name: MARIADB_USER
|
||||
value: limesurvey
|
||||
- name: MARIADB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: limesurvey
|
||||
key: db-password
|
||||
- name: MARIADB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: limesurvey
|
||||
key: db-root-password
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: mysql
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
memory: 1Gi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
- name: dbconf
|
||||
mountPath: /etc/mysql/conf.d/99-gluster.cnf
|
||||
subPath: 99-gluster.cnf
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: limesurvey-db
|
||||
- name: dbconf
|
||||
configMap:
|
||||
name: limesurvey-db-config
|
||||
@@ -0,0 +1,89 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: limesurvey
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: limesurvey
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: limesurvey
|
||||
spec:
|
||||
# ONE volume mounted twice with subPath. Do not split this into two
|
||||
# volume entries pointing at the same PVC -- that wedges kubelet's volume
|
||||
# setup and leaves the pod stuck in Init with no events.
|
||||
initContainers:
|
||||
- name: seed-config
|
||||
image: docker.io/martialblog/limesurvey:6-apache
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- cp -rn /var/www/html/application/config/. /seed/
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /seed
|
||||
subPath: config
|
||||
containers:
|
||||
- name: limesurvey
|
||||
image: docker.io/martialblog/limesurvey:6-apache
|
||||
env:
|
||||
- name: DB_TYPE
|
||||
value: mysql
|
||||
- name: DB_HOST
|
||||
value: limesurvey-db
|
||||
- name: DB_PORT
|
||||
value: "3306"
|
||||
- name: DB_NAME
|
||||
value: limesurvey
|
||||
- name: DB_USERNAME
|
||||
value: limesurvey
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: limesurvey
|
||||
key: db-password
|
||||
- name: ADMIN_USER
|
||||
value: admin
|
||||
- name: ADMIN_NAME
|
||||
value: Jason
|
||||
- name: ADMIN_EMAIL
|
||||
value: admin@wittyoneoff.com
|
||||
- name: ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: limesurvey
|
||||
key: admin-password
|
||||
- name: PUBLIC_URL
|
||||
value: https://surveys.skatefight.us
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8080
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
memory: 1Gi
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/www/html/upload
|
||||
subPath: upload
|
||||
- name: data
|
||||
mountPath: /var/www/html/application/config
|
||||
subPath: config
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: limesurvey-app
|
||||
@@ -0,0 +1,28 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: limesurvey
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: surveys.skatefight.us
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: limesurvey
|
||||
port:
|
||||
number: 8080
|
||||
- host: origin-surveys.wittyoneoff.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: limesurvey
|
||||
port:
|
||||
number: 8080
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
# secret.example.yaml is intentionally NOT listed -- copy it to secret.yaml
|
||||
# (gitignored), set real values, and apply it once per cluster.
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- storage.yaml
|
||||
- db-config.yaml
|
||||
- db-deployment.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- ingress.yaml
|
||||
- backup-cronjob.yaml
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: limesurvey
|
||||
@@ -0,0 +1,12 @@
|
||||
# Copy to secret.yaml (gitignored), set real values, apply once per cluster:
|
||||
# kubectl apply -f secret.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: limesurvey
|
||||
namespace: limesurvey
|
||||
type: Opaque
|
||||
stringData:
|
||||
db-password: CHANGEME
|
||||
db-root-password: CHANGEME
|
||||
admin-password: CHANGEME
|
||||
@@ -0,0 +1,27 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: limesurvey
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: limesurvey
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
# Pinned: the UniFi forward "lime survey" (WAN 30087) targets this.
|
||||
nodePort: 30087
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: limesurvey-db
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: limesurvey-db
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
@@ -0,0 +1,94 @@
|
||||
# LimeSurvey was originally deployed with the k3s `local-path` StorageClass,
|
||||
# which pinned both volumes to rpi-worker-3's local disk with
|
||||
# persistentVolumeReclaimPolicy: Delete. That meant the survey data lived on a
|
||||
# single SD-backed node and would be destroyed by deleting the PVC. Migrated to
|
||||
# GlusterFS 2026-09-21.
|
||||
#
|
||||
# Two separate PVCs are correct here because the app and the database run in
|
||||
# SEPARATE pods. (The warning in apps/tududi/storage.yaml is about declaring the
|
||||
# same PVC twice as two volume entries in ONE pod -- that is what wedged an
|
||||
# earlier limesurvey attempt. The app pod below still uses ONE volume, mounted
|
||||
# twice with subPath.)
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: limesurvey-pv
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
volumeMode: Filesystem
|
||||
hostPath:
|
||||
path: /mnt/gvolume0/limesurvey/app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: limesurvey-app
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: ""
|
||||
volumeName: limesurvey-pv
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: limesurvey-db-pv
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
volumeMode: Filesystem
|
||||
hostPath:
|
||||
path: /mnt/gvolume0/limesurvey/db
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: limesurvey-db
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: ""
|
||||
volumeName: limesurvey-db-pv
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: limesurvey-backups-pv
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
volumeMode: Filesystem
|
||||
hostPath:
|
||||
path: /mnt/gvolume0/limesurvey/backups
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: limesurvey-backups
|
||||
namespace: limesurvey
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: ""
|
||||
volumeName: limesurvey-backups-pv
|
||||
@@ -10,3 +10,4 @@ resources:
|
||||
- apps/unified-streaming
|
||||
- apps/dashwise
|
||||
- apps/tududi
|
||||
- apps/limesurvey
|
||||
|
||||
Reference in New Issue
Block a user