diff --git a/apps/wekan/README.md b/apps/wekan/README.md index 04c1638..0bfcee7 100644 --- a/apps/wekan/README.md +++ b/apps/wekan/README.md @@ -21,10 +21,12 @@ sent. ## Storage -WeKan uses its bundled FerretDB v1 with SQLite. Its database and uploads are stored -under `/data` on the `wekan-data` PVC (10Gi). The cluster's `local-path` StorageClass -has a `Delete` reclaim policy; deleting this PVC permanently deletes the WeKan data. -Keep independent backups for anything important. +WeKan uses a separate FerretDB v1 container with SQLite. FerretDB's database is on +the `ferretdb-data` PVC (5Gi); attachments and avatars are under `/data` on the +`wekan-data` PVC (10Gi). NetworkPolicy only permits WeKan to reach FerretDB. Both +claims use the cluster's `local-path` StorageClass with a `Delete` reclaim policy; +deleting either permanently deletes its data. Keep independent backups for anything +important. The former Planka database was checked before replacement and contained no projects, boards, cards, or uploaded files. Its two PVCs are retained separately for rollback; diff --git a/apps/wekan/ferretdb-data-pvc.yaml b/apps/wekan/ferretdb-data-pvc.yaml new file mode 100644 index 0000000..846ea9c --- /dev/null +++ b/apps/wekan/ferretdb-data-pvc.yaml @@ -0,0 +1,13 @@ +# FerretDB's SQLite database and state directory. +# local-path has reclaimPolicy: Delete; deleting this PVC deletes the database. +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ferretdb-data + namespace: wedding-planner +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 5Gi diff --git a/apps/wekan/ferretdb-deployment.yaml b/apps/wekan/ferretdb-deployment.yaml new file mode 100644 index 0000000..4a8ed98 --- /dev/null +++ b/apps/wekan/ferretdb-deployment.yaml @@ -0,0 +1,78 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ferretdb + namespace: wedding-planner +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: ferretdb + template: + metadata: + labels: + app: ferretdb + spec: + securityContext: + runAsNonRoot: true + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch + seccompProfile: + type: RuntimeDefault + containers: + - name: ferretdb + image: ghcr.io/wekan/ferretdb-sqlite:v1.107.0 + ports: + - name: mongodb + containerPort: 27017 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + env: + - name: FERRETDB_HANDLER + value: sqlite + - name: FERRETDB_SQLITE_URL + value: file:/state/ + - name: FERRETDB_LISTEN_ADDR + value: 0.0.0.0:27017 + - name: FERRETDB_STATE_DIR + value: /state + - name: FERRETDB_TELEMETRY + value: disable + - name: FERRETDB_LOG_LEVEL + value: error + - name: GODEBUG + value: multipathtcp=0 + volumeMounts: + - name: state + mountPath: /state + startupProbe: + tcpSocket: + port: mongodb + failureThreshold: 60 + periodSeconds: 5 + readinessProbe: + tcpSocket: + port: mongodb + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: mongodb + periodSeconds: 20 + resources: + requests: + cpu: 50m + memory: 96Mi + limits: + cpu: 500m + memory: 384Mi + volumes: + - name: state + persistentVolumeClaim: + claimName: ferretdb-data diff --git a/apps/wekan/ferretdb-service.yaml b/apps/wekan/ferretdb-service.yaml new file mode 100644 index 0000000..06bf50c --- /dev/null +++ b/apps/wekan/ferretdb-service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: ferretdb + namespace: wedding-planner +spec: + selector: + app: ferretdb + ports: + - name: mongodb + port: 27017 + targetPort: mongodb diff --git a/apps/wekan/kustomization.yaml b/apps/wekan/kustomization.yaml index b7a6ab4..1fb9475 100644 --- a/apps/wekan/kustomization.yaml +++ b/apps/wekan/kustomization.yaml @@ -4,6 +4,9 @@ kind: Kustomization resources: - namespace.yaml - wekan-data-pvc.yaml + - ferretdb-data-pvc.yaml + - ferretdb-deployment.yaml + - ferretdb-service.yaml - wekan-deployment.yaml - wekan-service.yaml - wekan-ingress.yaml diff --git a/apps/wekan/network-policy.yaml b/apps/wekan/network-policy.yaml index 0dcc891..6f7f10a 100644 --- a/apps/wekan/network-policy.yaml +++ b/apps/wekan/network-policy.yaml @@ -20,3 +20,23 @@ spec: ports: - protocol: TCP port: 8080 +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: ferretdb-ingress + namespace: wedding-planner +spec: + podSelector: + matchLabels: + app: ferretdb + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: wekan + ports: + - protocol: TCP + port: 27017 diff --git a/apps/wekan/wekan-deployment.yaml b/apps/wekan/wekan-deployment.yaml index c27d1f5..dffadda 100644 --- a/apps/wekan/wekan-deployment.yaml +++ b/apps/wekan/wekan-deployment.yaml @@ -24,6 +24,18 @@ spec: fsGroupChangePolicy: OnRootMismatch seccompProfile: type: RuntimeDefault + initContainers: + - name: wait-for-ferretdb + image: ghcr.io/wekan/wekan:v13.06 + command: + - bash + - -ec + - until (echo > /dev/tcp/ferretdb/27017) >/dev/null 2>&1; do sleep 2; done + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL containers: - name: wekan image: ghcr.io/wekan/wekan:v13.06 @@ -41,9 +53,15 @@ spec: - name: PORT value: "8080" - name: WEKAN_DB - value: ferretdb + value: mongodb + - name: MONGO_URL + value: mongodb://ferretdb:27017/wekan?directConnection=true - name: WRITABLE_PATH value: /data + - name: METEOR_REACTIVITY_ORDER + value: polling + - name: DEFAULT_METEOR_REACTIVITY_ORDER + value: polling - name: WITH_API value: "true" - name: DDP_TRANSPORT