-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
188 lines (179 loc) · 4.73 KB
/
docker-compose.yml
File metadata and controls
188 lines (179 loc) · 4.73 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# ─── Low-RAM build note ──────────────────────────────────────────────────────
# On a 2-core / 2-4 GB server, build images ONE AT A TIME to avoid OOM:
#
# docker compose build api
# docker compose build poller
# docker compose build frontend
#
# Running `docker compose build` (all at once) will trigger three concurrent
# multi-stage builds (Go, Python/pip, Node/tsc/Vite) that together can peak at
# 3-4 GB RAM, crashing the machine before any image finishes.
#
# Once built, starting the stack uses far less RAM (nginx + uvicorn + Go binary).
# ─────────────────────────────────────────────────────────────────────────────
services:
postgres:
image: timescale/timescaledb:2.17.2-pg17
container_name: tod_postgres
environment:
POSTGRES_DB: ${POSTGRES_DB:-tod}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
ports:
- "5432:5432"
volumes:
- ./docker-data/postgres:/var/lib/postgresql/data
- ./scripts/init-postgres.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d ${POSTGRES_DB:-tod}"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 512M
networks:
- tod
redis:
image: redis:7-alpine
container_name: tod_redis
ports:
- "6379:6379"
volumes:
- ./docker-data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
deploy:
resources:
limits:
memory: 128M
networks:
- tod
nats:
image: nats:2-alpine
container_name: tod_nats
command: ["--jetstream", "--store_dir", "/data", "-m", "8222"]
ports:
- "4222:4222"
- "8222:8222"
volumes:
- ./docker-data/nats:/data
healthcheck:
test: ["CMD-SHELL", "wget --spider -q http://localhost:8222/healthz || exit 1"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 128M
networks:
- tod
openbao:
image: openbao/openbao:2.1
container_name: tod_openbao
entrypoint: /bin/sh
command:
- -c
- |
bao server -config=/etc/openbao/config.hcl &
BAO_PID=$$!
sleep 2
/init/init.sh
wait $$BAO_PID
environment:
BAO_ADDR: "http://127.0.0.1:8200"
BAO_UNSEAL_KEY: "${BAO_UNSEAL_KEY:-}"
BAO_TOKEN: "${OPENBAO_TOKEN:-}"
ports:
- "8200:8200"
volumes:
- ./infrastructure/openbao/config.hcl:/etc/openbao/config.hcl:ro
- ./infrastructure/openbao/init.sh:/init/init.sh:ro
- openbao_data:/openbao/data
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8200/v1/sys/health | grep -q '\"sealed\":false' || exit 1"]
interval: 5s
timeout: 3s
retries: 12
start_period: 30s
restart: unless-stopped
deploy:
resources:
limits:
memory: 256M
networks:
- tod
wireguard:
image: lscr.io/linuxserver/wireguard:latest
container_name: tod_wireguard
environment:
- PUID=1000
- PGID=1000
- TZ=UTC
volumes:
- ./docker-data/wireguard:/config
- ./docker-data/wireguard/custom-cont-init.d:/custom-cont-init.d
ports:
- "51820:51820/udp"
cap_add:
- NET_ADMIN
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "ip link show wg0 2>/dev/null || exit 0"]
interval: 10s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 128M
networks:
- tod
mailpit:
image: axllent/mailpit:latest
profiles: ["mail-testing"]
ports:
- "8026:8025"
- "1026:1025"
networks:
- tod
deploy:
resources:
limits:
memory: 64M
winbox-worker:
build:
context: ./winbox-worker
platform: linux/amd64
container_name: tod_winbox_worker
environment:
IDLE_TIMEOUT: 600
MAX_LIFETIME: 7200
MAX_CONCURRENT_SESSIONS: 10
LOG_LEVEL: info
XDG_RUNTIME_DIR: /run/user/1001
ports:
- "10100-10119:10100-10119"
deploy:
resources:
limits:
memory: 1G
networks:
- tod
- tod_remote_worker
volumes:
openbao_data:
networks:
tod:
driver: bridge
tod_remote_worker:
driver: bridge
internal: true