-
-
Notifications
You must be signed in to change notification settings - Fork 595
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
561 lines (531 loc) · 16.8 KB
/
docker-compose.dev.yml
File metadata and controls
561 lines (531 loc) · 16.8 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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
name: lago_dev
configs:
redis-sentinel-conf:
file: ./extra/redis/sentinel.dev.conf
volumes:
front_node_modules_dev:
front_dist_dev:
postgres_data_dev:
redis_data_dev:
redis_replica_data_dev:
redpanda_data_dev:
clickhouse_data_dev:
services:
traefik:
image: traefik:v3
container_name: lago_traefik_dev
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- ./traefik/traefik.yml:/etc/traefik/traefik.yml
- ./traefik/dynamic.yml:/etc/traefik/dynamic.yml
- ./traefik/certs:/etc/certs
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.lago.dev`)"
- "traefik.http.routers.traefik.entrypoints=web,websecure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
db:
image: "getlago/postgres-partman:15.0-alpine"
container_name: lago_db_dev
restart: unless-stopped
command: -c config_file=/etc/postgresql.conf
environment:
POSTGRES_USER: ${POSTGRES_USER:-lago}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
PGDATA: /data/postgres
POSTGRES_MULTIPLE_DATABASES: lago,lago_test
volumes:
- ./scripts/postgresql.conf:/etc/postgresql.conf
- ./scripts/pg-init-scripts:/docker-entrypoint-initdb.d
- postgres_data_dev:/data/postgres
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-lago}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: lago_redis_dev
restart: unless-stopped
command: ["sh", "-c", "redis-server $${REDIS_PASSWORD:+--requirepass \"$$REDIS_PASSWORD\"}"]
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
volumes:
- redis_data_dev:/data
ports:
- 6379:6379
healthcheck:
test: ["CMD-SHELL", "redis-cli $${REDIS_PASSWORD:+-a \"$$REDIS_PASSWORD\"} ping"]
interval: 10s
timeout: 3s
retries: 3
front:
image: front_dev
pull_policy: never
container_name: lago_front_dev
stdin_open: true
restart: unless-stopped
depends_on:
- api
build:
context: ./front
dockerfile: Dockerfile.dev
volumes:
- ./front:/app:cached
- front_node_modules_dev:/app/node_modules
- front_dist_dev:/app/dist
environment:
- NODE_ENV=development
- API_URL=https://api.lago.dev
- APP_DOMAIN=https://app.lago.dev
- CODEGEN_API=http://api:3000/graphql
- LAGO_DISABLE_SIGNUP=${LAGO_DISABLE_SIGNUP:-}
- LAGO_DISABLE_PDF_GENERATION=${LAGO_DISABLE_PDF_GENERATION:-false}
- NANGO_SECRET_KEY=${NANGO_SECRET_KEY:-}
labels:
- "traefik.enable=true"
- "traefik.http.routers.app.rule=Host(`app.lago.dev`)"
- "traefik.http.routers.app.entrypoints=web,websecure"
- "traefik.http.routers.app.tls=true"
- "traefik.http.services.app.loadbalancer.server.port=8080"
webhook:
image: ghcr.io/tarampampam/webhook-tester:2
container_name: lago_webhook_dev
restart: unless-stopped
environment:
- HTTP_PORT=80
- AUTO_CREATE_SESSIONS=true
labels:
- "traefik.enable=true"
- "traefik.http.routers.webhook.rule=Host(`webhook.lago.dev`)"
- "traefik.http.routers.webhook.entrypoints=web,websecure"
- "traefik.http.routers.webhook.tls=true"
- "traefik.http.services.webhook.loadbalancer.server.port=80"
migrate:
container_name: lago-migrate_dev
image: api_dev
pull_policy: never
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
command: ["./scripts/migrate.dev.sh"]
build:
context: ./api
dockerfile: Dockerfile.dev
volumes:
- ./api:/app:delegated
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
api:
image: api_dev
pull_policy: never
container_name: lago_api_dev
restart: unless-stopped
command: ["./scripts/start.dev.sh"]
healthcheck:
test: curl -f http://localhost:3000/health || exit 1
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
depends_on:
migrate:
condition: service_completed_successfully
db:
condition: service_healthy
redis:
condition: service_healthy
clickhouse:
condition: service_healthy
volumes:
- ./api:/app:cached
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
stdin_open: true
tty: true
environment:
- DATABASE_TEST_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/lago_test
- GOOGLE_AUTH_CLIENT_ID=${GOOGLE_AUTH_CLIENT_ID:-}
- GOOGLE_AUTH_CLIENT_SECRET=${GOOGLE_AUTH_CLIENT_SECRET:-}
labels:
- "traefik.enable=true"
- "traefik.http.routers.api_http.rule=Host(`api.lago.dev`)"
- "traefik.http.routers.api_http.entrypoints=web"
- "traefik.http.routers.api_http.service=api_http"
- "traefik.http.services.api_http.loadbalancer.server.port=3000"
- "traefik.http.routers.api.rule=Host(`api.lago.dev`)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.service=api"
- "traefik.http.routers.api.tls=true"
- "traefik.http.services.api.loadbalancer.server.port=3000"
api-worker: &api_worker
image: api_dev
pull_policy: never
container_name: lago_api_worker
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.worker.sh"
depends_on:
api:
condition: service_started
volumes:
- ./api:/app:cached
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
stdin_open: true
tty: true
api-events-worker:
<<: *api_worker
container_name: lago_api_events_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_EVENTS}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_EVENTS}
fi
bundle install && ./scripts/start.events.worker.sh
'
api-pdfs-worker:
<<: *api_worker
container_name: lago_api_pdfs_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_PDFS}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_PDFS}
fi
bundle install && ./scripts/start.pdfs.worker.sh
'
api-billing-worker:
<<: *api_worker
container_name: lago_api_billing_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_BILLING}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_BILLING}
fi
bundle install && ./scripts/start.billing.worker.sh
'
api-clock-worker:
<<: *api_worker
container_name: lago_api_clock_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_CLOCK}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_CLOCK}
fi
bundle install && ./scripts/start.clock.worker.sh
'
api-webhook-worker:
<<: *api_worker
container_name: lago_api_webhook_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_WEBHOOK}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_WEBHOOK}
fi
bundle install && ./scripts/start.webhook.worker.sh
'
api-analytics-worker:
<<: *api_worker
container_name: lago_api_analytics_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_ANALYTICS}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_ANALYTICS}
fi
bundle install && ./scripts/start.analytics.worker.sh
'
api-ai-agent-worker:
<<: *api_worker
container_name: lago_api_ai_agent_worker_dev
command: |
bash -c '
if [[ -n "$${SIDEKIQ_CONCURRENCY_AI_AGENT}" ]]; then
export SIDEKIQ_CONCURRENCY=$${SIDEKIQ_CONCURRENCY_AI_AGENT}
fi
bundle install && ./scripts/start.ai_agent.worker.sh
'
api-clock:
image: api_dev
pull_policy: never
container_name: lago_api_clock_dev
restart: unless-stopped
command: bash -c "bundle install && ./scripts/start.clock.sh"
depends_on:
api:
condition: service_started
volumes:
- ./api:/app:cached
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
api-events-consumer:
<<: *api_worker
container_name: lago_api_events_consumer_dev
command: bash -c "bundle install && ./scripts/start.events.consumer.sh"
events-processor:
image: events-processor_dev
pull_policy: never
container_name: lago_events-processor
restart: unless-stopped
build:
context: ./events-processor
dockerfile: Dockerfile.dev
depends_on:
db:
condition: service_healthy
redpanda:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
volumes:
- ./events-processor:/app:cached
pdf:
image: getlago/lago-gotenberg:8
container_name: lago_pdf_dev
restart: unless-stopped
command:
- "gotenberg"
- "--log-level=debug"
labels:
- "traefik.enable=true"
- "traefik.http.routers.pdf.rule=Host(`pdf.lago.dev`)"
- "traefik.http.routers.pdf.entrypoints=web,websecure"
- "traefik.http.routers.pdf.tls=true"
- "traefik.http.services.pdf.loadbalancer.server.port=3000"
mailhog:
image: mailhog/mailhog
container_name: lago_mailhog_dev
restart: unless-stopped
platform: linux/amd64
labels:
- "traefik.enable=true"
- "traefik.http.routers.mail.rule=Host(`mail.lago.dev`)"
- "traefik.http.routers.mail.entrypoints=websecure"
- "traefik.http.routers.mail.tls=true"
- "traefik.http.services.mail.loadbalancer.server.port=8025"
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v25.2.10
container_name: lago_redpanda_dev
restart: unless-stopped
hostname: redpanda
command:
- redpanda start
- --smp 1
- --overprovisioned
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
- --advertise-kafka-addr internal://redpanda:9092,external://localhost:19092
volumes:
- redpanda_data_dev:/var/lib/redpanda/data
ports:
- 9092:9092
- 19092:19092
healthcheck:
test: ["CMD", "curl", "http://localhost:9644/v1/status/ready"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
redpandacreatetopics:
image: docker.redpanda.com/redpandadata/redpanda:v25.2.10
depends_on:
redpanda:
condition: service_healthy
# https://github.com/redpanda-data/redpanda/issues/6651
entrypoint: create-topics
command:
- events-raw
- events_enriched
- events_charged_in_advance
- events_enriched_expanded
- events_dead_letter
- activity_logs
- api_logs
- security_logs
volumes:
- ./scripts/create-topics.sh:/usr/local/bin/create-topics
environment:
- RPK_BROKERS=redpanda:9092
redpanda-console:
image: docker.redpanda.com/redpandadata/console:v3.2.2
container_name: lago_redpanda_console_dev
entrypoint: /bin/sh
command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console'
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |
kafka:
brokers: ["redpanda:9092"]
kafkaConnect:
enabled: true
clusters:
- name: lago-kafka-connect
url: http://redpanda-kafka-connect:8083
depends_on:
- redpanda
labels:
- "traefik.enable=true"
- "traefik.http.routers.console.rule=Host(`console.lago.dev`)"
- "traefik.http.routers.console.entrypoints=websecure"
- "traefik.http.routers.console.tls=true"
- "traefik.http.services.console.loadbalancer.server.port=8080"
redpanda-kafka-connect:
image: docker.redpanda.com/redpandadata/connectors:latest
hostname: redpanda-kafka-connect
volumes:
- ./extra/kafka-connect:/opt/kafka/connect-plugins
ports:
- 8083:8083
environment:
CONNECT_CONFIGURATION: |
key.converter=org.apache.kafka.connect.converters.ByteArrayConverter
value.converter=org.apache.kafka.connect.converters.ByteArrayConverter
group.id=redpanda-kafka-connect-group
offset.storage.topic=_connectors_offsets
config.storage.topic=_connectors_configs
status.storage.topic=_connectors_status
config.storage.replication.factor=-1
offset.storage.replication.factor=-1
status.storage.replication.factor=-1
CONNECT_BOOTSTRAP_SERVERS: redpanda:9092
CONNECT_GC_LOG_ENABLED: "true"
CONNECT_HEAP_OPTS: -Xms1G -Xmx1G
CONNECT_METRICS_ENABLEd: "false"
CONNECT_PLUGIN_PATH: "/opt/kafka/connect-plugins"
clickhouse:
image: clickhouse/clickhouse-server:25.4-alpine
container_name: lago_clickhouse_dev
restart: unless-stopped
hostname: clickhouse
user: "101:101"
depends_on:
db:
condition: service_healthy
redpanda:
condition: service_healthy
redpandacreatetopics:
condition: service_completed_successfully
volumes:
- clickhouse_data_dev:/var/lib/clickhouse
- ./extra/clickhouse/config.d/config.xml:/etc/clickhouse-server/config.d/config.xml
- ./extra/clickhouse/users.d/users.xml:/etc/clickhouse-server/users.d/users.xml
ports:
- 9000:9000
- 8123:8123
healthcheck:
test:
[
"CMD",
"clickhouse-client",
"--password",
"default",
"--query",
"SELECT 1",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
pghero:
image: ankane/pghero:latest
container_name: lago_pghero_dev
restart: unless-stopped
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER:-lago}:${POSTGRES_PASSWORD:-changeme}@db:5432/${POSTGRES_DB:-lago}
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
depends_on:
db:
condition: service_healthy
healthcheck:
test: wget -O /dev/null http://0.0.0.0:8080/health || exit 1
interval: 10s
timeout: 5s
retries: 5
labels:
- "traefik.enable=true"
- "traefik.http.routers.pghero.rule=Host(`pghero.lago.dev`)"
- "traefik.http.routers.pghero.entrypoints=web,websecure"
- "traefik.http.routers.pghero.tls=true"
- "traefik.http.services.pghero.loadbalancer.server.port=8080"
redis-replica:
command: ["sh", "-c", "redis-server --replicaof redis 6379 $${REDIS_PASSWORD:+--requirepass \"$$REDIS_PASSWORD\" --masterauth \"$$REDIS_PASSWORD\"}"]
container_name: lago_redis_replica_dev
depends_on:
redis:
condition: service_healthy
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
healthcheck:
interval: 10s
retries: 3
test: ["CMD-SHELL", "redis-cli $${REDIS_PASSWORD:+-a \"$$REDIS_PASSWORD\"} ping"]
timeout: 3s
image: redis:7-alpine
profiles:
- redis-sentinel
restart: unless-stopped
volumes:
- redis_replica_data_dev:/data
redis-sentinel-1: &redis-sentinel
# Sentinel requires write to the configuration file so we cannot use volume for it, we need to copy it to the container and then run sentinel with the copied file.
command: >-
sh -c 'cp /tmp/sentinel.conf /etc/sentinel.conf &&
if [ -n "$$REDIS_PASSWORD" ]; then echo "sentinel auth-pass master $$REDIS_PASSWORD" >> /etc/sentinel.conf; fi &&
redis-sentinel /etc/sentinel.conf'
configs:
- source: redis-sentinel-conf
target: /tmp/sentinel.conf
container_name: lago_redis_sentinel_1_dev
depends_on:
redis:
condition: service_healthy
redis-replica:
condition: service_healthy
env_file:
- path: ./.env.development.default
- path: ./.env.development
required: false
healthcheck:
interval: 10s
retries: 3
test: ["CMD", "redis-cli", "-p", "26379", "ping"]
timeout: 3s
image: redis:7-alpine
profiles:
- redis-sentinel
restart: unless-stopped
redis-sentinel-2:
<<: *redis-sentinel
container_name: lago_redis_sentinel_2_dev
redis-sentinel-3:
<<: *redis-sentinel
container_name: lago_redis_sentinel_3_dev