From 36f9725760c58462b617d9453ff7fede38635e66 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 22 Oct 2024 10:36:12 -0500 Subject: [PATCH] PG evaluation for livenessProbe web container --- osm-seed/templates/web/web-deployment.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osm-seed/templates/web/web-deployment.yaml b/osm-seed/templates/web/web-deployment.yaml index 22f0cf98..22641b66 100644 --- a/osm-seed/templates/web/web-deployment.yaml +++ b/osm-seed/templates/web/web-deployment.yaml @@ -35,7 +35,23 @@ spec: command: - /bin/bash - -c - - ./liveness.sh + - > + # Check PostgreSQL connection + PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -U $POSTGRES_USER -d $POSTGRES_DB -c "SELECT 1;" > /dev/null 2>&1; + if [ $? -ne 0 ]; then + echo "Failed to connect to PostgreSQL"; + exit 1; + fi; + + # Check apache status + ./liveness.sh; + if [ $? -ne 0 ]; then + echo "liveness.sh script failed"; + exit 1; + fi; + + echo "All checks passed"; + exit 0; initialDelaySeconds: 600 timeoutSeconds: 5 periodSeconds: 10