-
Notifications
You must be signed in to change notification settings - Fork 266
Expand file tree
/
Copy pathdocker-compose.e2e.yml
More file actions
353 lines (337 loc) · 14 KB
/
Copy pathdocker-compose.e2e.yml
File metadata and controls
353 lines (337 loc) · 14 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
name: ${COMPOSE_PROJECT_NAME:-monitorss-e2e}
services:
# --- Infrastructure ---
mongo:
image: mongo:7.0.2
hostname: mongo
restart: "no"
tmpfs:
- /data/db
- /data/configdb
ports:
# Default host 27019 (not 27018) so the e2e stack can run alongside the dev
# stack (docker-compose.dev.yml publishes mongo on 27018). Parameterized so
# concurrent e2e runs can each bind a distinct host port. The backend reaches
# mongo over the internal network (mongo:27017), unaffected by this mapping;
# only host-side e2e helpers use it (see e2e/helpers/constants.ts MONGO_URI).
- "${E2E_MONGO_PORT:-27019}:27017"
command: ["--replSet", "dbrs", "--bind_ip_all", "--port", "27017"]
# The replica set is initiated via the healthcheck rather than a
# docker-entrypoint-initdb.d script: init scripts make the mongo image start a
# temporary mongod, then stop it and start the real one, and the second start
# can race the first for port 27017 ("Address already in use", exit code 48),
# killing the container and the whole E2E stack with it.
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "try { quit(rs.status().myState === 1 ? 0 : 1) } catch (e) { rs.initiate(); quit(1) }"]
interval: 2s
timeout: 10s
retries: 30
networks:
- e2e-default
rabbitmq-broker:
image: rabbitmq:3-management-alpine
restart: "no"
tmpfs:
- /var/lib/rabbitmq/mnesia
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 5s
timeout: 5s
retries: 20
networks:
- e2e-default
feed-requests-postgres-db:
image: postgres:17-alpine
restart: "no"
tmpfs:
- /var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "postgres", "-U", "postgres"]
timeout: 45s
interval: 10s
retries: 10
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
networks:
- e2e-default
feed-requests-redis-cache:
image: redis:7-alpine
restart: "no"
tmpfs:
- /data
command: redis-server --save ""
networks:
- e2e-default
# --- Migrations ---
feed-requests-postgres-migration:
build:
context: services/feed-requests
dockerfile: Dockerfile
target: build
restart: "no"
command: "npm run migration:up"
depends_on:
feed-requests-postgres-db:
condition: service_healthy
environment:
- NODE_ENV=local
- FEED_REQUESTS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/feedrequests
- FEED_REQUESTS_POSTGRES_SCHEMA=feedrequests
- FEED_REQUESTS_API_KEY=feed-requests-api-key
- FEED_REQUESTS_API_PORT=5000
- FEED_REQUESTS_RABBITMQ_BROKER_URL=amqp://rabbitmq-broker:5672
- FEED_REQUESTS_FAILED_REQUEST_DURATION_THRESHOLD_HOURS=48
- FEED_REQUESTS_START_TARGET=service
- FEED_REQUESTS_REDIS_URI=redis://feed-requests-redis-cache:6379
- FEED_REQUESTS_REDIS_DISABLE_CLUSTER=true
- FEED_REQUESTS_FEED_REQUEST_DEFAULT_USER_AGENT=MonitoRSS
networks:
- e2e-default
user-feeds-postgres-migration:
build:
context: services/user-feeds-next
dockerfile: Dockerfile.dev
restart: "no"
command: npx tsx ./src/scripts/run-migrations.ts
depends_on:
feed-requests-postgres-db:
condition: service_healthy
environment:
- USER_FEEDS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/userfeeds
- NODE_ENV=local
networks:
- e2e-default
# --- Application Services ---
feed-requests-service:
build:
context: services/feed-requests
dockerfile: Dockerfile
target: build
restart: "no"
extra_hosts:
- "host.docker.internal:host-gateway"
command: node ./dist/main
depends_on:
feed-requests-postgres-db:
condition: service_healthy
rabbitmq-broker:
condition: service_healthy
feed-requests-postgres-migration:
condition: service_completed_successfully
environment:
- NODE_ENV=local
- FEED_REQUESTS_START_TARGET=service
- FEED_REQUESTS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/feedrequests
- FEED_REQUESTS_POSTGRES_SCHEMA=feedrequests
- FEED_REQUESTS_API_KEY=feed-requests-api-key
- FEED_REQUESTS_API_PORT=5000
- FEED_REQUESTS_RABBITMQ_BROKER_URL=amqp://rabbitmq-broker:5672
- FEED_REQUESTS_FAILED_REQUEST_DURATION_THRESHOLD_HOURS=48
- FEED_REQUESTS_REDIS_URI=redis://feed-requests-redis-cache:6379
- FEED_REQUESTS_REDIS_DISABLE_CLUSTER=true
- FEED_REQUESTS_FEEDS_MONGODB_URI=mongodb://mongo:27017/rss?replicaSet=dbrs&directConnection=true
- FEED_REQUESTS_FEED_REQUEST_DEFAULT_USER_AGENT=MonitoRSS
networks:
- e2e-default
feed-requests-api:
build:
context: services/feed-requests
dockerfile: Dockerfile
target: build
restart: "no"
extra_hosts:
- "host.docker.internal:host-gateway"
command: node ./dist/main
depends_on:
feed-requests-postgres-db:
condition: service_healthy
rabbitmq-broker:
condition: service_healthy
feed-requests-postgres-migration:
condition: service_completed_successfully
environment:
- NODE_ENV=local
- FEED_REQUESTS_START_TARGET=api
- FEED_REQUESTS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/feedrequests
- FEED_REQUESTS_POSTGRES_SCHEMA=feedrequests
- FEED_REQUESTS_API_KEY=feed-requests-api-key
- FEED_REQUESTS_API_PORT=5000
- FEED_REQUESTS_RABBITMQ_BROKER_URL=amqp://rabbitmq-broker:5672
- FEED_REQUESTS_FAILED_REQUEST_DURATION_THRESHOLD_HOURS=48
- FEED_REQUESTS_REDIS_URI=redis://feed-requests-redis-cache:6379
- FEED_REQUESTS_REDIS_DISABLE_CLUSTER=true
- FEED_REQUESTS_FEEDS_MONGODB_URI=mongodb://mongo:27017/rss?replicaSet=dbrs&directConnection=true
- FEED_REQUESTS_FEED_REQUEST_DEFAULT_USER_AGENT=MonitoRSS
networks:
- e2e-default
e2e-user-feeds-service:
build:
context: services/user-feeds-next
dockerfile: Dockerfile.dev
restart: "no"
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
e2e-user-feeds-api:
condition: service_healthy
environment:
- LOG_LEVEL=debug
- USER_FEEDS_START_TARGET=service
- NODE_ENV=local
- USER_FEEDS_DISCORD_API_BASE_URL=http://host.docker.internal:${E2E_MOCK_DISCORD_PORT:-3002}/api/v10
- USER_FEEDS_DISCORD_CLIENT_ID=000000000000000001
- USER_FEEDS_DISCORD_API_TOKEN=fake-bot-token
- USER_FEEDS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/userfeeds
- USER_FEEDS_API_PORT=5000
- USER_FEEDS_RABBITMQ_BROKER_URL=amqp://guest:guest@rabbitmq-broker:5672
- USER_FEEDS_FEED_REQUESTS_API_URL=http://feed-requests-api:5000/v1/feed-requests
- USER_FEEDS_FEED_REQUESTS_API_KEY=feed-requests-api-key
- USER_FEEDS_API_KEY=user-feeds-api-key
- USER_FEEDS_REDIS_URI=redis://feed-requests-redis-cache:6379
- USER_FEEDS_REDIS_DISABLE_CLUSTER=true
networks:
- e2e-default
e2e-user-feeds-api:
build:
context: services/user-feeds-next
dockerfile: Dockerfile.dev
restart: "no"
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: "wget --no-verbose --tries=1 --spider http://127.0.0.1:5000/v1/user-feeds/health || exit 1"
interval: 5s
timeout: 5s
retries: 10
depends_on:
feed-requests-postgres-db:
condition: service_healthy
rabbitmq-broker:
condition: service_healthy
user-feeds-postgres-migration:
condition: service_completed_successfully
environment:
- LOG_LEVEL=debug
- USER_FEEDS_START_TARGET=api
- NODE_ENV=local
- USER_FEEDS_DISCORD_API_BASE_URL=http://host.docker.internal:${E2E_MOCK_DISCORD_PORT:-3002}/api/v10
- USER_FEEDS_DISCORD_CLIENT_ID=000000000000000001
- USER_FEEDS_DISCORD_API_TOKEN=fake-bot-token
- USER_FEEDS_POSTGRES_URI=postgres://postgres:postgres@feed-requests-postgres-db:5432/userfeeds
- USER_FEEDS_API_PORT=5000
- USER_FEEDS_RABBITMQ_BROKER_URL=amqp://guest:guest@rabbitmq-broker:5672
- USER_FEEDS_FEED_REQUESTS_API_URL=http://feed-requests-api:5000/v1/feed-requests
- USER_FEEDS_FEED_REQUESTS_API_KEY=feed-requests-api-key
- USER_FEEDS_API_KEY=user-feeds-api-key
- USER_FEEDS_REDIS_URI=redis://feed-requests-redis-cache:6379
- USER_FEEDS_REDIS_DISABLE_CLUSTER=true
networks:
- e2e-default
web-api:
build:
context: services/backend-api
dockerfile: Dockerfile.dev
restart: "no"
# Source is bind-mounted (narrowly: src only, node_modules stays in the
# image) so a fresh `up` always runs current backend code — image rebuilds
# are only needed for dependency changes, and the stale-COPY-layer trap (a
# cached build silently running old source) is structurally impossible.
# Cheap here because Node reads modules once at boot; web-client stays
# in-image (see its comment).
volumes:
- ./services/backend-api/src:/usr/src/app/src
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
mongo:
condition: service_healthy
rabbitmq-broker:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:8100/api/v1/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 10
ports:
- "${E2E_BACKEND_PORT:-8100}:8100"
environment:
- BACKEND_API_NODE_ENV=local
- BACKEND_API_PORT=8100
- BACKEND_API_DISCORD_API_BASE_URL=http://host.docker.internal:${E2E_MOCK_DISCORD_PORT:-3002}/api/v9
- BACKEND_API_DISCORD_BOT_TOKEN=fake-bot-token
- BACKEND_API_DISCORD_CLIENT_ID=000000000000000001
- BACKEND_API_DISCORD_CLIENT_SECRET=fake-client-secret
- BACKEND_API_DISCORD_REDIRECT_URI=http://localhost:${E2E_BACKEND_PORT:-8100}/api/v1/discord/callback-v2
- BACKEND_API_SESSION_SECRET=e2e-session-secret-that-is-long-enough-for-validation
- BACKEND_API_SESSION_SALT=e2esessionsalt16
- BACKEND_API_USER_FEEDS_API_HOST=http://e2e-user-feeds-api:5000
- BACKEND_API_USER_FEEDS_API_KEY=user-feeds-api-key
- BACKEND_API_FEED_REQUESTS_API_HOST=http://feed-requests-api:5000
- BACKEND_API_FEED_REQUESTS_API_KEY=feed-requests-api-key
- BACKEND_API_FEED_USER_AGENT=MonitoRSS
- BACKEND_API_MONGODB_URI=mongodb://mongo:27017/rss?replicaSet=dbrs&directConnection=true
- BACKEND_API_RABBITMQ_BROKER_URL=amqp://guest:guest@rabbitmq-broker:5672/
- BACKEND_API_LOGIN_REDIRECT_URI=http://localhost:${E2E_FRONTEND_PORT:-3100}
# Fixed admin Discord id for the admin-access E2E spec. BACKEND_API_ADMIN_USER_IDS
# accepts Discord ids (not just internal Mongo ids), so a stable value can be
# baked in even though each test user's internal id is minted at runtime. Must
# match E2E_ADMIN_DISCORD_ID in e2e/helpers/mock-discord-data.ts.
- BACKEND_API_ADMIN_USER_IDS=900000000000000099
# Mock mailer (plain SMTP on the host, reached via host.docker.internal) so
# the email-verification one-time-code flow can be driven through the UI.
- BACKEND_API_SMTP_HOST=host.docker.internal
- BACKEND_API_SMTP_PORT=${E2E_MOCK_SMTP_PORT:-3004}
- BACKEND_API_SMTP_SECURE=false
- BACKEND_API_SMTP_USERNAME=mock
- BACKEND_API_SMTP_PASSWORD=mock
- BACKEND_API_SMTP_FROM_DOMAIN=example.com
- BACKEND_API_PADDLE_KEY=${BACKEND_API_PADDLE_KEY:-}
- BACKEND_API_PADDLE_URL=${BACKEND_API_PADDLE_URL:-}
- BACKEND_API_PADDLE_WEBHOOK_SECRET=${BACKEND_API_PADDLE_WEBHOOK_SECRET:-}
# Reddit OAuth + authenticated feed fetches are served by the host-side mock
# reddit server (e2e/mock-reddit-server.ts), reached via host.docker.internal
# by both the backend (token exchange) and the browser popup (authorize).
- BACKEND_API_REDDIT_CLIENT_ID=${BACKEND_API_REDDIT_CLIENT_ID:-}
- BACKEND_API_REDDIT_CLIENT_SECRET=fake-reddit-client-secret
- BACKEND_API_REDDIT_REDIRECT_URI=http://localhost:${E2E_BACKEND_PORT:-8100}/api/v1/reddit/callback
- BACKEND_API_REDDIT_API_BASE_URL=http://host.docker.internal:${E2E_MOCK_REDDIT_PORT:-3006}/api/v1
- BACKEND_API_REDDIT_AUTHENTICATED_FEED_BASE_URL=http://host.docker.internal:${E2E_MOCK_REDDIT_PORT:-3006}
# Reddit tokens are encrypted at rest; any fixed 64-char hex key works for e2e.
- BACKEND_API_ENCRYPTION_KEY_HEX=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
- BACKEND_API_ENABLE_SUPPORTERS=true
# Small workspace feed limit so the over-limit enforcement spec can exercise
# disable/re-enable with a handful of seeded feeds. Other specs create at
# most a couple of feeds per workspace.
- BACKEND_API_DEFAULT_MAX_WORKSPACE_FEEDS=5
- LOG_LEVEL=debug
- NODE_ENV=local
command: npm run dev
networks:
- e2e-default
web-client:
build:
context: services/backend-api
dockerfile: Dockerfile.dev
working_dir: /usr/src/app/client
restart: "no"
# Deliberately NOT bind-mounted (unlike web-api): vite transforms modules per
# request, and on a Windows host that I/O through the Docker file bridge made
# parallel-worker app loads exceed their timeouts (measured: 6/29 workspace
# specs failed on load). Client source changes therefore still require an
# image rebuild — use `build --no-cache web-client` (a cached `up --build`
# can silently reuse a stale COPY layer).
depends_on:
web-api:
condition: service_healthy
ports:
- "${E2E_FRONTEND_PORT:-3100}:3100"
environment:
- API_PROXY_URL=http://web-api:8100
- VITE_PADDLE_CLIENT_TOKEN=${VITE_PADDLE_CLIENT_TOKEN:-}
command: npm run dev -- --host 0.0.0.0 --port 3100
networks:
- e2e-default
networks:
e2e-default:
driver: bridge