1-
21services :
3- # 1. YOUR APP (The Python Code )
2+ # 1. YOUR BACKEND API (Downloaded from Docker Hub )
43 backend-api :
5- image : aaren17/devops-demo:latest # Build the Dockerfile in this folder
6- container_name : backend-api # Name used by Prometheus to find it
4+ # IMPORTANT: On the server, this MUST point to Hub, not 'build: .'
5+ image : aaren17/devops-demo:latest
6+ container_name : backend-api
77 ports :
8- - " 5000:5000" # Open port 5000
8+ - " 5000:5000"
9+ # Kept on the same network so it can reach 'rabbitmq' by name
910 networks :
10- - monitoring # Connect to the shared network
11+ - monitoring
12+ # Tell the app where RabbitMQ is (optional but good practice)
13+ environment :
14+ - RABBITMQ_HOST=rabbitmq
15+
16+ # 2. NEW: RABBITMQ (The Message Broker)
17+ rabbitmq :
18+ # Use the 'management' tag to get the web UI plugin pre-installed
19+ image : rabbitmq:3-management
20+ container_name : rabbitmq
21+ ports :
22+ - " 5672:5672" # Main port for your Python app to send/receive messages
23+ - " 15672:15672" # Management UI port (website for humans)
24+ networks :
25+ - monitoring # Must be on the same network as backend-api
26+ # CRITICAL DEVOPS TASK: Persist data so queues survive restarts
27+ volumes :
28+ - rabbitmq_data:/var/lib/rabbitmq
1129
12- # 2 . PROMETHEUS (The Data Collector )
30+ # 3 . PROMETHEUS (Monitoring )
1331 prometheus :
1432 image : prom/prometheus:latest
1533 container_name : prometheus
1634 ports :
1735 - " 9090:9090"
1836 volumes :
19- # Mount the config file (CRITICAL STEP)
2037 - ./prometheus.yml:/etc/prometheus/prometheus.yml
21- # Save data permanently so it doesn't vanish on restart
2238 - prometheus-data:/prometheus
2339 networks :
2440 - monitoring
2541
26- # 3 . GRAFANA (The Dashboard)
42+ # 4 . GRAFANA (Dashboard)
2743 grafana :
2844 image : grafana/grafana:latest
2945 container_name : grafana
@@ -32,11 +48,11 @@ services:
3248 volumes :
3349 - grafana-data:/var/lib/grafana
3450 environment :
35- - GF_SECURITY_ADMIN_PASSWORD=admin # Default login
51+ - GF_SECURITY_ADMIN_PASSWORD=admin
3652 networks :
3753 - monitoring
3854
39- # 4 . NODE EXPORTER (Hardware Monitor )
55+ # 5 . NODE EXPORTER (Hardware Stats )
4056 node-exporter :
4157 image : prom/node-exporter:latest
4258 container_name : node-exporter
@@ -45,12 +61,12 @@ services:
4561 networks :
4662 - monitoring
4763
48- # Create the shared network
4964networks :
5065 monitoring :
5166 driver : bridge
5267
53- # Create the persistent storage areas
68+ # Define the new volume for RabbitMQ persistence
5469volumes :
5570 prometheus-data :
56- grafana-data:
71+ grafana-data :
72+ rabbitmq_data : # <--- NEW Volume added here
0 commit comments