Fix DB issue 2s

This commit is contained in:
Urtzi Alfaro
2025-09-30 21:58:10 +02:00
parent 147893015e
commit 7cc4b957a5
77 changed files with 4385 additions and 1211 deletions

View File

@@ -20,6 +20,39 @@ spec:
app.kubernetes.io/component: worker
spec:
initContainers:
- name: wait-for-migration
image: postgres:15-alpine
command:
- sh
- -c
- |
echo "Waiting for alert-processor database and migrations to be ready..."
# Wait for database to be accessible
until pg_isready -h $ALERT_PROCESSOR_DB_HOST -p $ALERT_PROCESSOR_DB_PORT -U $ALERT_PROCESSOR_DB_USER; do
echo "Database not ready yet, waiting..."
sleep 2
done
echo "Database is ready!"
# Give migrations extra time to complete after DB is ready
echo "Waiting for migrations to complete..."
sleep 10
echo "Ready to start service"
env:
- name: ALERT_PROCESSOR_DB_HOST
valueFrom:
configMapKeyRef:
name: bakery-config
key: ALERT_PROCESSOR_DB_HOST
- name: ALERT_PROCESSOR_DB_PORT
valueFrom:
configMapKeyRef:
name: bakery-config
key: DB_PORT
- name: ALERT_PROCESSOR_DB_USER
valueFrom:
secretKeyRef:
name: database-secrets
key: ALERT_PROCESSOR_DB_USER
- name: wait-for-database
image: busybox:1.36
command: