fix: resolve CouchDB deployment and init job issues

- Remove problematic ERL_FLAGS from CouchDB StatefulSet
- Copy setup-couchdb.js to backend/scripts/ for Docker image inclusion
- Update init job to use full DNS name and add timeout/retry logic
- Fix script path in init job command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
William Valentin
2025-12-06 14:00:44 -08:00
parent fc23f4d098
commit cde4850650
3 changed files with 515 additions and 12 deletions

View File

@@ -20,8 +20,15 @@ spec:
- sh
- -c
- |
until curl -f -s http://adopt-a-street-couchdb:5984/_up > /dev/null 2>&1; do
echo "Waiting for CouchDB to be ready..."
COUNT=0
MAX_ATTEMPTS=60
until curl -f -s http://adopt-a-street-couchdb.adopt-a-street.svc.cluster.local:5984/_up > /dev/null 2>&1; do
COUNT=$((COUNT+1))
if [ $COUNT -ge $MAX_ATTEMPTS ]; then
echo "Timeout waiting for CouchDB after $MAX_ATTEMPTS attempts"
exit 1
fi
echo "Waiting for CouchDB to be ready... (attempt $COUNT/$MAX_ATTEMPTS)"
sleep 3
done
echo "CouchDB is ready!"

View File

@@ -45,6 +45,21 @@ spec:
operator: In
values:
- arm64 # Pi 5 architecture
initContainers:
- name: setup-config
image: busybox:1.36
command:
- sh
- -c
- |
echo "[chttpd]" > /opt/couchdb/etc/local.d/bind.ini
echo "bind_address = 0.0.0.0" >> /opt/couchdb/etc/local.d/bind.ini
cat /opt/couchdb/etc/local.d/bind.ini
volumeMounts:
- name: couchdb-data
mountPath: /opt/couchdb/data
- name: local-config
mountPath: /opt/couchdb/etc/local.d
containers:
- name: couchdb
image: couchdb:3.3
@@ -71,30 +86,39 @@ spec:
key: COUCHDB_SECRET
resources:
requests:
memory: "512Mi"
cpu: "250m"
memory: "256Mi"
cpu: "100m"
limits:
memory: "2Gi"
cpu: "1000m"
memory: "1Gi"
cpu: "500m"
volumeMounts:
- name: couchdb-data
mountPath: /opt/couchdb/data
- name: local-config
mountPath: /opt/couchdb/etc/local.d
livenessProbe:
httpGet:
path: /_up
port: 5984
exec:
command:
- curl
- -f
- http://localhost:5984/_up
initialDelaySeconds: 60
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /_up
port: 5984
exec:
command:
- curl
- -f
- http://localhost:5984/_up
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
volumes:
- name: local-config
emptyDir: {}
volumeClaimTemplates:
- metadata: