Fix Redis connection in production with startup probe and explicit 127.0.0.1

Changes:
- Added startupProbe to towerops container to allow up to 70s for startup
  (gives Valkey sidecar time to be ready)
- Changed REDIS_HOST from 'localhost' to '127.0.0.1' for explicit loopback
- Removed initialDelaySeconds from liveness/readiness probes (handled by startup)
- Added comment clarifying Redis connects to Valkey sidecar

This ensures the app waits for Valkey to be ready before accepting traffic.
This commit is contained in:
Graham McIntire 2026-01-17 17:20:14 -06:00
parent d81b025282
commit 5836925166
No known key found for this signature in database

View file

@ -84,8 +84,9 @@ spec:
secretKeyRef:
name: towerops-secrets
key: SECRET_KEY_BASE
# Redis connection to Valkey sidecar container (localhost because same pod)
- name: REDIS_HOST
value: "localhost"
value: "127.0.0.1"
- name: REDIS_PORT
value: "6379"
envFrom:
@ -100,11 +101,18 @@ spec:
limits:
memory: "2Gi"
cpu: "500m"
startupProbe:
httpGet:
path: /health
port: 4000
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 12 # 10s + (12 * 5s) = 70s max startup time
livenessProbe:
httpGet:
path: /health
port: 4000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
@ -112,7 +120,6 @@ spec:
httpGet:
path: /health
port: 4000
initialDelaySeconds: 5
periodSeconds: 3
timeoutSeconds: 2
successThreshold: 1