File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
services/ingestion_dispatcher Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -599,6 +599,12 @@ services:
599599 LOG_LEVEL : INFO
600600 networks :
601601 - fuzzforge-network
602+ healthcheck :
603+ test : ["CMD", "python", "healthcheck.py"]
604+ interval : 30s
605+ timeout : 5s
606+ retries : 3
607+ start_period : 10s
602608 restart : unless-stopped
603609
604610 # ============================================================================
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ WORKDIR /app
66COPY requirements.txt ./
77RUN pip install --no-cache-dir -r requirements.txt
88
9- COPY app.py ./
9+ COPY app.py healthcheck.py ./
1010
1111CMD ["python" , "app.py" ]
Original file line number Diff line number Diff line change 1+ """Simple healthcheck to verify RabbitMQ connectivity."""
2+ from __future__ import annotations
3+
4+ import os
5+ import sys
6+
7+ import pika
8+
9+
10+ def main () -> int :
11+ rabbit_url = os .getenv ("RABBITMQ_URL" , "amqp://ingest:ingest@rabbitmq:5672/" )
12+ try :
13+ connection = pika .BlockingConnection (pika .URLParameters (rabbit_url ))
14+ try :
15+ channel = connection .channel ()
16+ channel .basic_qos (prefetch_count = 1 )
17+ finally :
18+ connection .close ()
19+ except Exception as exc : # pragma: no cover - run-time diagnostic
20+ print (f"[healthcheck] RabbitMQ unavailable: { exc } " , file = sys .stderr )
21+ return 1
22+ return 0
23+
24+
25+ if __name__ == "__main__" :
26+ raise SystemExit (main ())
You can’t perform that action at this time.
0 commit comments