Files
adopt-a-street/deploy/k8s/couchdb-statefulset.yaml
William Valentin aa4179245a fix: simplify CouchDB startup by removing custom command override
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 <noreply@ai-assistant.com>
2025-12-05 21:05:10 -08:00

108 lines
2.7 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: adopt-a-street-couchdb
namespace: adopt-a-street
labels:
app: couchdb
spec:
type: ClusterIP # Regular ClusterIP service (not headless)
selector:
app: couchdb
ports:
- port: 5984
targetPort: 5984
name: couchdb
- port: 4369
targetPort: 4369
name: epmd
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: adopt-a-street-couchdb
namespace: adopt-a-street
spec:
serviceName: adopt-a-street-couchdb
replicas: 1
selector:
matchLabels:
app: couchdb
template:
metadata:
labels:
app: couchdb
spec:
# Place CouchDB on Pi 5 nodes (more RAM)
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- arm64 # Pi 5 architecture
containers:
- name: couchdb
image: couchdb:3.3
ports:
- containerPort: 5984
name: couchdb
- containerPort: 4369
name: epmd
env:
- name: COUCHDB_USER
valueFrom:
secretKeyRef:
name: adopt-a-street-secrets
key: COUCHDB_USER
- name: COUCHDB_PASSWORD
valueFrom:
secretKeyRef:
name: adopt-a-street-secrets
key: COUCHDB_PASSWORD
- name: COUCHDB_SECRET
valueFrom:
secretKeyRef:
name: adopt-a-street-secrets
key: COUCHDB_SECRET
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "2Gi"
cpu: "1000m"
volumeMounts:
- name: couchdb-data
mountPath: /opt/couchdb/data
livenessProbe:
httpGet:
path: /_up
port: 5984
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /_up
port: 5984
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
volumeClaimTemplates:
- metadata:
name: couchdb-data
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
# Uncomment and set your storage class if needed
# storageClassName: local-path