- 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>
74 lines
2.2 KiB
YAML
74 lines
2.2 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: couchdb-init
|
|
labels:
|
|
app: couchdb-init
|
|
spec:
|
|
backoffLimit: 3
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: couchdb-init
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: regcred
|
|
initContainers:
|
|
- name: wait-for-couchdb
|
|
image: curlimages/curl:8.5.0
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
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!"
|
|
containers:
|
|
- name: couchdb-init
|
|
image: gitea-http.taildb3494.ts.net/will/adopt-a-street-backend:latest
|
|
imagePullPolicy: Always
|
|
command: ["node", "scripts/setup-couchdb.js"]
|
|
envFrom:
|
|
- configMapRef:
|
|
name: adopt-a-street-config
|
|
- secretRef:
|
|
name: adopt-a-street-secrets
|
|
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: ADMIN_EMAIL
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: adopt-a-street-secrets
|
|
key: ADMIN_EMAIL
|
|
- name: ADMIN_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: adopt-a-street-secrets
|
|
key: ADMIN_PASSWORD
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "500m"
|
|
restartPolicy: Never
|