Repository navigation
Expand file tree
/
Copy pathdocker-compose-dev.yml
More file actions
364 lines (349 loc) · 10.6 KB
/
Copy pathdocker-compose-dev.yml
File metadata and controls
364 lines (349 loc) · 10.6 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
354
355
356
357
358
359
360
361
362
363
364
# Local Development Docker Compose
#
# Basic usage (core services only):
# docker compose -f docker-compose-dev.yml up
#
# Run migrations (first time or after pulling new migrations):
# docker compose -f docker-compose-dev.yml run --rm migrate
#
# With ATProto devnet (PDS + PLC + Jetstream + TAP):
# ./scripts/devnet-up.sh
# ./scripts/devnet-down.sh
services:
postgres:
# use the db with postGIS extensions
image: postgis/postgis:16-3.4-alpine
container_name: openmeet_postgres
ports:
- ${DATABASE_PORT}:5432
env_file:
- .env
volumes:
- dbdata:/var/lib/postgresql/data
# init scripts for PostGIS
- ./pg-init-scripts:/docker-entrypoint-initdb.d
environment:
POSTGRES_USER: ${DATABASE_USERNAME}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
entrypoint: ["docker-entrypoint.sh", "-c", "max_connections=${DATABASE_MAX_CONNECTIONS}"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USERNAME} -d ${DATABASE_NAME}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- api-network
maildev:
build:
context: .
dockerfile: maildev.Dockerfile
ports:
- ${MAIL_CLIENT_PORT}:1080
- ${MAIL_PORT}:1025
networks:
- api-network
pgadmin:
image: dpage/pgadmin4
depends_on:
- postgres
ports:
- "8080:80"
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
restart: always
networks:
- api-network
# Uncomment to use redis
redis:
image: redis:7-alpine
container_name: openmeet_redis
ports:
- "6379:6379"
restart: always
networks:
- api-network
# Database migrations and seeds - run manually when needed
# Usage: docker compose -f docker-compose-dev.yml run --rm migrate
# Run after: initial setup, pulling code with new migrations, or schema changes
migrate:
profiles: ["migrate"]
image: node:24-alpine
user: "${UID:-1000}:${GID:-1000}"
container_name: openmeet_migrate
working_dir: /app
command: sh -c "npm install && npm run migration:run:tenants && npm run seed:run:relational"
volumes:
- .:/app
environment:
- NODE_ENV=development
- DATABASE_HOST=postgres
env_file:
- .env
depends_on:
postgres:
condition: service_healthy
networks:
- api-network
restart: "no"
# Config renderer - generates Matrix configs from templates for local development
config-renderer:
image: alpine:3.19
container_name: openmeet_config_renderer
volumes:
- ./matrix-config:/templates:ro
- matrix-configs:/rendered-config
env_file:
- .env
restart: "no"
command: ["/bin/sh", "/templates/render-matrix-config.sh"]
healthcheck:
test: ["CMD", "test", "-f", "/rendered-config/mas-config.yaml"]
interval: 5s
timeout: 10s
retries: 3
networks:
- api-network
# Matrix Authentication Service
matrix-auth-service:
image: ghcr.io/element-hq/matrix-authentication-service:0.18.0
container_name: openmeet_mas
ports:
- "8081:8080"
environment:
MAS_CONFIG: /data/mas-config.yaml
volumes:
- matrix-configs:/data:ro
depends_on:
config-renderer:
condition: service_healthy
postgres:
condition: service_healthy
env_file:
- .env
networks:
- api-network
matrix:
image: matrixdotorg/synapse:v1.132.0
container_name: openmeet_matrix
ports:
- "8448:8448"
- "9091:9090" # Expose Prometheus metrics port (9091 to avoid conflict with system Prometheus)
environment:
# Only set the host value that can't come from .env
POSTGRES_HOST: postgres
# Set the default Matrix port and host for local development
MATRIX_HOST: localhost
MATRIX_PORT: 8448
# Standard Synapse settings
SYNAPSE_LOG_LEVEL: "INFO"
# MAS integration
MAS_ISSUER: "http://matrix-auth-service:8080/"
MAS_CLIENT_SECRET: "${MAS_CLIENT_SECRET}"
volumes:
- matrix-configs:/config:ro
- ./matrix-config/log.config:/data/log.config
- ./matrix-config/init.sh:/data/init.sh
- ./matrix-config/start-matrix.sh:/data/start-matrix.sh
- matrix-data:/data/media
depends_on:
config-renderer:
condition: service_healthy
postgres:
condition: service_healthy
matrix-auth-service:
condition: service_started
env_file:
- .env
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8448/_matrix/client/versions"]
interval: 10s
timeout: 5s
retries: 5
entrypoint: ["/bin/bash", "-c"]
command:
- |
# Install envsubst and jq if not already available
apt-get update && apt-get install -y gettext-base jq curl python3
chmod +x /data/start-matrix.sh
chmod +x /data/init.sh
/data/start-matrix.sh &
sleep 15 && /data/init.sh &
wait
networks:
- api-network
matrix-web:
image: nginx:alpine
container_name: openmeet_matrix_web
ports:
- "80:80"
volumes:
- ./matrix-config/.well-known:/usr/share/nginx/html/.well-known
- ./matrix-config/nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- matrix
networks:
- api-network
# NestJS API with hot reload
api:
image: node:24-alpine
user: "${UID:-1000}:${GID:-1000}"
container_name: openmeet_api
hostname: api
working_dir: /app
command: sh -c "npm install && npm run start:dev:nodemon"
ports:
- ${APP_PORT}:${APP_PORT}
volumes:
- .:/app
environment:
- NODE_ENV=development
- TZ=UTC
# Enable polling for file watching in Docker
- CHOKIDAR_USEPOLLING=true
- CHOKIDAR_INTERVAL=1000
# Override localhost hosts for container networking
- DATABASE_HOST=postgres
- ELASTICACHE_HOST=redis
- MAIL_HOST=maildev
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tracing:4318
# Contrail appview: reuse the local Postgres (schema-isolated under
# CONTRAIL_SCHEMA). Without CONTRAIL_DATABASE_URL the provider stays
# uninitialized and /xrpc/net.openmeet.* returns 503.
- CONTRAIL_DATABASE_URL=postgres://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@postgres:5432/${DATABASE_NAME}
- CONTRAIL_SCHEMA=contrail
# Community keys + the one-shot Step-3 provision window
# (CONTRAIL_COMMUNITY_ENCRYPTION_KEY, CONTRAIL_AUTHORITY_SIGNING_KEY,
# CONTRAIL_PLC_URL, CONTRAIL_ALLOWED_PDS_ENDPOINTS,
# CONTRAIL_ALLOW_PROVISIONING) are injected straight from `.env` via
# env_file below — no `environment:` override here, so they don't get
# blanked when absent from the shell. Community routes mount only when
# BOTH keys are present; provisioning stays default-deny unless
# CONTRAIL_ALLOW_PROVISIONING=true. Close the window by removing those
# three lines from `.env` and recreating.
env_file:
- .env
networks:
- api-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:${APP_PORT}/health/liveness || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
tracing:
image: jaegertracing/jaeger:latest
ports:
- 6831:6831/udp
- 6832:6832/udp
- 5778:5778
- 16686:16686
- 4317:4317
- 4318:4318
- 14250:14250
- 14268:14268
- 14269:14269
- 9411:9411
environment:
- COLLECTOR_OTLP_ENABLED=true
networks:
- api-network
# RabbitMQ for Bluesky event ingestion pipeline
rabbitmq:
image: rabbitmq:4.2-management-alpine
container_name: openmeet_rabbitmq
ports:
- "5672:5672" # AMQP
- "25672:15672" # Management UI (using 25672 to avoid Windows Hyper-V port reservation)
environment:
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- api-network
# Bluesky Firehose Consumer - connects to Bluesky and publishes to RabbitMQ
bsky-firehose-consumer:
image: node:24-alpine
user: "${UID:-1000}:${GID:-1000}"
container_name: bsky-firehose-consumer
working_dir: /app
command: sh -c "npm install && npm run start:dev"
ports:
- "3001:3001"
volumes:
- ../bsky-firehose-consumer:/app
environment:
- NODE_ENV=development
- PORT=3001
- RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
- RABBITMQ_EXCHANGE=community.lexicon.calendar
- RABBITMQ_QUEUE_NAME=community.lexicon.calendar.queue
- BSKY_FIREHOSE_URL=wss://jetstream2.us-east.bsky.network/subscribe
- BSKY_COLLECTIONS=community.lexicon.calendar.event,community.lexicon.calendar.rsvp
- ENABLE_TRACING=true
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tracing:4318
- OTEL_SERVICE_NAME=bsky-firehose-consumer
depends_on:
rabbitmq:
condition: service_healthy
networks:
- api-network
restart: unless-stopped
# Bluesky Event Processor - consumes from RabbitMQ and calls OpenMeet API
# Optional: requires bsky-firehose-consumer sibling repo
# Required env vars in .env:
# BSKY_API_KEY - service API key for OpenMeet API auth
# BSKY_TENANT_ID - tenant ID (e.g., lsdfaopkljdfs for local dev)
bsky-event-processor:
image: node:24-alpine
user: "${UID:-1000}:${GID:-1000}"
container_name: bsky-event-processor
working_dir: /app
command: sh -c "npm install && npm run start:dev"
ports:
- "3002:3002"
volumes:
- ../bsky-event-processor:/app
environment:
- NODE_ENV=development
- PORT=3002
- RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
- RABBITMQ_EXCHANGE=community.lexicon.calendar
- RABBITMQ_QUEUE_NAME=community.lexicon.calendar.queue
- API_URL=http://api:${APP_PORT}
- API_KEY=${BSKY_API_KEY}
- API_TENANT_ID=${BSKY_TENANT_ID}
- ENABLE_TRACING=true
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tracing:4318
- OTEL_SERVICE_NAME=bsky-event-processor
env_file:
- .env
depends_on:
rabbitmq:
condition: service_healthy
api:
condition: service_healthy
networks:
- api-network
restart: unless-stopped
volumes:
dbdata:
matrix-data:
matrix-configs:
mas-data:
driver: local
networks:
api-network:
name: api-network # Explicit name to avoid project prefix
driver: bridge