-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
234 lines (222 loc) · 6.47 KB
/
Copy pathdocker-compose.yml
File metadata and controls
234 lines (222 loc) · 6.47 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
version: "3.8"
# Profiles let you run just the data layer (the historical default — start
# infra, then `pnpm dev` on the host) or the fully containerized stack.
#
# docker compose up -d # postgres + redis only
# docker compose --profile full up -d --build # postgres + redis + api + indexer + all workers
# docker compose --profile app up -d --build # postgres + redis + every process (alias for full)
# docker compose --profile api up -d --build # postgres + redis + api only
#
# See docs/docker-compose.md for the full walkthrough.
services:
postgres:
image: postgres:16-alpine
container_name: vatix-postgres
stop_signal: SIGTERM
stop_grace_period: 30s
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: vatix
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
container_name: vatix-redis
stop_signal: SIGTERM
stop_grace_period: 10s
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
api:
build:
context: .
target: api
container_name: vatix-backend
profiles: ["app", "full", "api"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
REDIS_URL: redis://redis:6379
ports:
- "${PORT:-3000}:${PORT:-3000}"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
indexer:
build:
context: .
target: indexer
container_name: vatix-indexer
profiles: ["app", "full", "indexer"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
oracle:
build:
context: .
target: oracle
container_name: vatix-oracle
profiles: ["app", "oracle"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
REDIS_URL: redis://redis:6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
finalization-worker:
build:
context: .
target: finalization-worker
container_name: vatix-finalization-worker
profiles: ["app", "full", "workers", "finalization-worker"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
# No HTTP surface, so liveness is checked against PID 1's cmdline
# (the container's tsx entrypoint) instead of a port. Without this,
# a crash-looped or hung finalization worker in the "workers"/"full"
# profile reports no unhealthy state to `docker compose ps` and
# resolution finalization can silently stop advancing.
healthcheck:
test:
[
"CMD-SHELL",
"grep -q finalization/main.ts /proc/1/cmdline || exit 1",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
oracle-worker:
build:
context: .
target: oracle-worker
container_name: vatix-oracle-worker
profiles: ["app", "full", "workers", "oracle-worker"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
REDIS_URL: redis://redis:6379
STELLAR_RPC_URL: ${STELLAR_RPC_URL}
SOROBAN_NETWORK_PASSPHRASE: ${SOROBAN_NETWORK_PASSPHRASE}
ORACLE_SECRET_KEY: ${ORACLE_SECRET_KEY}
INDEXER_CONTRACT_ID: ${INDEXER_CONTRACT_ID}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# See finalization-worker above: same PID-1 liveness pattern. Without
# it, a hung oracle-worker silently stops consuming the oracle
# submission queue and resolutions never reach chain.
healthcheck:
test: ["CMD-SHELL", "grep -q oracle/main.ts /proc/1/cmdline || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
settlement-worker:
build:
context: .
target: settlement-worker
container_name: vatix-settlement-worker
profiles: ["app", "full", "workers", "settlement-worker"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
REDIS_URL: redis://redis:6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# See finalization-worker above: same PID-1 liveness pattern. Without
# it, a hung settlement-worker silently stops consuming the
# settlement queue and matched trades never settle on-chain.
healthcheck:
test:
[
"CMD-SHELL",
"grep -q settlement/consumer.ts /proc/1/cmdline || exit 1",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# One-off migration runner — not part of any long-running profile.
# Usage: docker compose --profile tools run --rm migrate
migrate:
build:
context: .
target: migrate
container_name: vatix-migrate
profiles: ["tools", "migrate"]
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/vatix
depends_on:
postgres:
condition: service_healthy
# One-off local load test for order placement (~100 rps by default). LOCAL
# ONLY — see scripts/load-test-orders.ts for the safety guard and details.
# Usage:
# docker compose --profile api up -d --build # start the API first
# docker compose --profile tools run --rm load-test
load-test:
build:
context: .
target: build
container_name: vatix-load-test
profiles: ["tools", "load-test"]
environment:
LOAD_TEST_BASE_URL: http://api:3000
command:
[
"node_modules/.bin/tsx",
"scripts/load-test-orders.ts",
"--url",
"http://api:3000",
]
depends_on:
- api
volumes:
postgres_data:
redis_data: