Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit 2047953

Browse files
author
trzysiek
committed
App skeletons + health monitor.
1 parent 641e1e1 commit 2047953

File tree

9 files changed

+2824
-68
lines changed

9 files changed

+2824
-68
lines changed

docker-compose-old.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
services:
2+
prometheus:
3+
image: prom/prometheus:latest
4+
container_name: prometheus
5+
ports:
6+
- "9090:9090"
7+
volumes:
8+
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
9+
- prometheus_data:/prometheus
10+
command:
11+
- '--config.file=/etc/prometheus/prometheus.yml'
12+
- '--storage.tsdb.path=/prometheus'
13+
- '--web.console.libraries=/etc/prometheus/console_libraries'
14+
- '--web.console.templates=/etc/prometheus/consoles'
15+
- '--storage.tsdb.retention.time=200h'
16+
- '--web.enable-lifecycle'
17+
networks:
18+
- grafana_network
19+
20+
grafana:
21+
image: grafana/grafana:12.0.2
22+
container_name: grafana
23+
ports:
24+
- "3000:3000"
25+
environment:
26+
- GF_AUTH_ANONYMOUS_ENABLED=true
27+
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
28+
- GF_AUTH_DISABLE_LOGIN_FORM=true
29+
- GF_USERS_ALLOW_SIGN_UP=false
30+
volumes:
31+
- grafana_data:/var/lib/grafana
32+
- ./grafana/provisioning:/etc/grafana/provisioning
33+
depends_on:
34+
- prometheus
35+
networks:
36+
- grafana_network
37+
38+
loki:
39+
image: grafana/loki:latest
40+
container_name: loki
41+
ports:
42+
- "3100:3100"
43+
volumes:
44+
- ./loki:/etc/loki
45+
- loki_data:/loki
46+
command: -config.file=/etc/loki/loki.yml
47+
networks:
48+
- grafana_network
49+
50+
# Example microservice with metrics endpoint
51+
metrics_generator:
52+
image: prom/node-exporter:latest
53+
container_name: example_metrics
54+
ports:
55+
- "9100:9100"
56+
networks:
57+
- grafana_network
58+
59+
log-generator:
60+
build:
61+
context: ./log-generator
62+
dockerfile: Dockerfile
63+
container_name: log-generator
64+
networks:
65+
- grafana_network
66+
depends_on:
67+
- loki
68+
69+
volumes:
70+
grafana_data:
71+
driver: local
72+
prometheus_data:
73+
driver: local
74+
loki_data:
75+
driver: local
76+
77+
networks:
78+
grafana_network:
79+
driver: bridge
80+

docker-compose.yml

Lines changed: 36 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,48 @@
1-
services:
2-
prometheus:
3-
image: prom/prometheus:latest
4-
container_name: prometheus
5-
ports:
6-
- "9090:9090"
7-
volumes:
8-
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
9-
- prometheus_data:/prometheus
10-
command:
11-
- '--config.file=/etc/prometheus/prometheus.yml'
12-
- '--storage.tsdb.path=/prometheus'
13-
- '--web.console.libraries=/etc/prometheus/console_libraries'
14-
- '--web.console.templates=/etc/prometheus/consoles'
15-
- '--storage.tsdb.retention.time=200h'
16-
- '--web.enable-lifecycle'
17-
networks:
18-
- grafana_network
1+
version: '3.8'
192

20-
grafana:
21-
image: grafana/grafana:12.0.2
22-
container_name: grafana
3+
services:
4+
service1:
5+
build: ./service1
6+
container_name: service1
237
ports:
24-
- "3000:3000"
25-
environment:
26-
- GF_AUTH_ANONYMOUS_ENABLED=true
27-
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
28-
- GF_AUTH_DISABLE_LOGIN_FORM=true
29-
- GF_USERS_ALLOW_SIGN_UP=false
30-
volumes:
31-
- grafana_data:/var/lib/grafana
32-
- ./grafana/provisioning:/etc/grafana/provisioning
33-
depends_on:
34-
- prometheus
8+
- "5001:5001"
359
networks:
36-
- grafana_network
10+
- microservices-network
11+
healthcheck:
12+
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
13+
interval: 30s
14+
timeout: 10s
15+
retries: 3
3716

38-
loki:
39-
image: grafana/loki:latest
40-
container_name: loki
17+
service2:
18+
build: ./service2
19+
container_name: service2
4120
ports:
42-
- "3100:3100"
43-
volumes:
44-
- ./loki:/etc/loki
45-
- loki_data:/loki
46-
command: -config.file=/etc/loki/loki.yml
21+
- "5002:5002"
4722
networks:
48-
- grafana_network
23+
- microservices-network
24+
healthcheck:
25+
test: ["CMD", "curl", "-f", "http://localhost:5002/health"]
26+
interval: 30s
27+
timeout: 10s
28+
retries: 3
4929

50-
# Example microservice with metrics endpoint
51-
metrics_generator:
52-
image: prom/node-exporter:latest
53-
container_name: example_metrics
30+
health-monitor:
31+
build: ./health-monitor
32+
container_name: health-monitor
5433
ports:
55-
- "9100:9100"
34+
- "5000:5000"
5635
networks:
57-
- grafana_network
58-
59-
log-generator:
60-
build:
61-
context: ./log-generator
62-
dockerfile: Dockerfile
63-
container_name: log-generator
64-
networks:
65-
- grafana_network
36+
- microservices-network
6637
depends_on:
67-
- loki
68-
69-
volumes:
70-
grafana_data:
71-
# here was driver: local, but that didn't work
72-
prometheus_data:
73-
# here was driver: local, but that didn't work
74-
loki_data:
75-
# here was driver: local, but that didn't work
38+
- service1
39+
- service2
40+
environment:
41+
- CHECK_INTERVAL=10 # Check every 10 seconds
42+
- TIMEOUT=5 # 5 second timeout for health checks
43+
- MAX_RETRIES=3 # Max consecutive failures before marking as down
44+
restart: unless-stopped
7645

7746
networks:
78-
grafana_network:
79-
driver: bridge
80-
47+
microservices-network:
48+
driver: bridge

0 commit comments

Comments
 (0)