-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
135 lines (131 loc) · 4.15 KB
/
Copy pathdocker-compose.yml
File metadata and controls
135 lines (131 loc) · 4.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
networks:
pgm:
driver: bridge
services:
traefik:
image: traefik:v3
user: root
command:
- "--api.dashboard=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=pgm" # always route via the pgm network
- "--providers.docker.watch=true" # pick up scale events immediately
- "--entrypoints.web.address=:80"
- "--ping=true" # enables GET /ping for the healthcheck
ports:
- "80:80" # HTTP ingress → http://localhost
- "8090:8080" # Traefik dashboard → http://localhost:8090
volumes:
- /var/run/docker.sock:/var/run/docker.sock # Linux only
networks:
- pgm
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/ping || exit 1"]
interval: 10s
timeout: 5s
retries: 3
postgres:
image: postgres:18
container_name: postgres-db
hostname: postgres-db
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5445:5432"
command: >
postgres
-c shared_preload_libraries=pg_stat_statements
-c pg_stat_statements.track=all
-c track_io_timing=on
volumes:
- pgdata:/var/lib/postgresql/18/data
networks:
- pgm
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
seq:
image: datalust/seq:latest
container_name: seq
hostname: seq
environment:
ACCEPT_EULA: "Y"
SEQ_FIRSTRUN_ADMINPASSWORD: ${SEQ_FIRSTRUN_ADMINPASSWORD}
ports:
- "5341:5341" # ingestion (HTTP)
- "8080:80" # Seq UI → http://seq:8080
volumes:
- seqdata:/data
networks:
- pgm
healthcheck:
test: ["CMD-SHELL", "curl -sf http://seq/api || exit 1"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
# hostname: backend
env_file:
- ./backend/.env
- ./backend/.env.production
volumes:
- dpkeys:/var/lib/pgmonitor/keys
networks:
- pgm
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:4000/healthz || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
depends_on:
postgres:
condition: service_healthy
seq:
condition: service_healthy
traefik:
condition: service_healthy
labels:
- "traefik.enable=true"
# Route /api and /hubs to this service
- "traefik.http.routers.backend.rule=PathPrefix(`/api`) || PathPrefix(`/hubs`)"
- "traefik.http.routers.backend.entrypoints=web"
- "traefik.http.routers.backend.priority=10"
- "traefik.http.services.backend.loadbalancer.server.port=4000"
# Let Traefik respect the /healthz endpoint before sending traffic
- "traefik.http.services.backend.loadbalancer.healthcheck.path=/healthz"
- "traefik.http.services.backend.loadbalancer.healthcheck.interval=10s"
- "traefik.http.services.backend.loadbalancer.healthcheck.timeout=3s"
# Sticky sessions — keeps SignalR connections on the same backend instance
- "traefik.http.services.backend.loadbalancer.sticky.cookie=true"
- "traefik.http.services.backend.loadbalancer.sticky.cookie.name=pgm_instance"
- "traefik.http.services.backend.loadbalancer.sticky.cookie.httponly=true"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
networks:
- pgm
depends_on:
backend:
condition: service_healthy
labels:
- "traefik.enable=true"
# Catch-all — lower priority than backend so /api and /hubs win
- "traefik.http.routers.frontend.rule=PathPrefix(`/`)"
- "traefik.http.routers.frontend.entrypoints=web"
- "traefik.http.routers.frontend.priority=1"
- "traefik.http.services.frontend.loadbalancer.server.port=4173"
volumes:
pgdata:
seqdata:
dpkeys: