From aa4179245a946157e8deb123bd14bf41d6b044de Mon Sep 17 00:00:00 2001 From: William Valentin Date: Fri, 5 Dec 2025 21:05:10 -0800 Subject: [PATCH] fix: simplify CouchDB startup by removing custom command override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom startup command was causing CouchDB to crash during initialization. The official couchdb:3.3 image has a proper entrypoint that handles all setup correctly using environment variables. Changes: - Removed custom command/entrypoint override - Rely on official CouchDB image's built-in initialization - Increased probe delays and failure thresholds for stability - Liveness: initialDelay 60s, failureThreshold 6 - Readiness: initialDelay 30s, failureThreshold 6 - Removed NODENAME, ERL_FLAGS, and COUCHDB_SINGLE_NODE_ENABLED env vars (handled by image defaults) Result: - CouchDB starts cleanly without crashes - Backend connects successfully - Health endpoint confirms: couchdb: connected Deployment status: All pods running (3/3) 🤖 Generated with AI Assistant Co-Authored-By: AI Assistant --- deploy/k8s/couchdb-statefulset.yaml | 37 ++++------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/deploy/k8s/couchdb-statefulset.yaml b/deploy/k8s/couchdb-statefulset.yaml index 8a49684..8c477f1 100644 --- a/deploy/k8s/couchdb-statefulset.yaml +++ b/deploy/k8s/couchdb-statefulset.yaml @@ -69,12 +69,6 @@ spec: secretKeyRef: name: adopt-a-street-secrets key: COUCHDB_SECRET - - name: NODENAME - value: couchdb@adopt-a-street-couchdb-0.adopt-a-street-couchdb - - name: ERL_FLAGS - value: "+K true +A 4" - - name: COUCHDB_SINGLE_NODE_ENABLED - value: "true" resources: requests: memory: "512Mi" @@ -89,41 +83,18 @@ spec: httpGet: path: /_up port: 5984 - initialDelaySeconds: 30 + initialDelaySeconds: 60 periodSeconds: 10 timeoutSeconds: 5 - failureThreshold: 3 + failureThreshold: 6 readinessProbe: httpGet: path: /_up port: 5984 - initialDelaySeconds: 5 + initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 - failureThreshold: 3 - command: - - sh - - -c - - | - # Create config directory and copy configuration - mkdir -p /opt/couchdb/etc/local.d - echo "[chttpd]" > /opt/couchdb/etc/local.d/10-cluster.ini - echo "bind_address = 0.0.0.0" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "port = 5984" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "[couchdb]" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "single_node = true" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "enable_cors = true" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "[cors]" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "origins = *" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "credentials = true" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "headers = accept, authorization, content-type, origin, referer, x-csrf-token" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "methods = GET, PUT, POST, HEAD, DELETE" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "max_age = 3600" >> /opt/couchdb/etc/local.d/10-cluster.ini - # Add admin credentials - echo "[admins]" >> /opt/couchdb/etc/local.d/10-cluster.ini - echo "${COUCHDB_USER} = ${COUCHDB_PASSWORD}" >> /opt/couchdb/etc/local.d/10-cluster.ini - # Start CouchDB - exec /opt/couchdb/bin/couchdb + failureThreshold: 6 volumeClaimTemplates: - metadata: