From 5836925166b8fae4608e8031fb54c15347cab313 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 17 Jan 2026 17:20:14 -0600 Subject: [PATCH] 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. --- k8s/deployment.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 2591f15b..925161eb 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -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