Skip to content

Commit e012266

Browse files
Run prometheus in container
1 parent df51a5c commit e012266

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docker-compose.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414

1515
postgres:
1616
image: postgres:16-alpine
17-
container_name: postgres-server
17+
container_name: postgres
1818
environment:
1919
POSTGRES_USER: ${DB_USER}
2020
POSTGRES_PASSWORD: ${DB_PASSWORD}
@@ -30,6 +30,16 @@ services:
3030
interval: 2s
3131
timeout: 5s
3232
retries: 5
33+
34+
prometheus:
35+
image: prom/prometheus:v2.54.1
36+
container_name: prometheus
37+
ports:
38+
- 9090:9090
39+
volumes:
40+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
41+
networks:
42+
- shared-network
3343

3444
networks:
3545
shared-network:

prometheus.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
global:
2+
scrape_interval: 30s
3+
4+
scrape_configs:
5+
- job_name: 'prometheus'
6+
static_configs:
7+
- targets: ['backend:8081']

0 commit comments

Comments
 (0)