-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.selfhost.yml
More file actions
102 lines (96 loc) · 2.51 KB
/
docker-compose.selfhost.yml
File metadata and controls
102 lines (96 loc) · 2.51 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
x-selfhost-env: &selfhost_env
APP_ENV: development
PLATFORM_DOMAIN: localhost
DATABASE_URL: postgres://credtrail:credtrail@postgres:5432/credtrail
STORAGE_BACKEND: s3
S3_ENDPOINT: http://minio:9000
S3_BUCKET: credtrail-badges
S3_REGION: us-east-1
S3_FORCE_PATH_STYLE: "true"
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
JOB_PROCESSOR_TOKEN: local-job-token
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: credtrail
POSTGRES_PASSWORD: credtrail
POSTGRES_DB: credtrail
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U credtrail -d credtrail"]
interval: 2s
timeout: 3s
retries: 30
minio:
image: minio/minio:latest
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000"
- "9001:9001"
minio-setup:
image: minio/mc:latest
depends_on:
- minio
entrypoint: >
/bin/sh -c "
until mc alias set local http://minio:9000 minioadmin minioadmin; do sleep 1; done;
mc mb --ignore-existing local/credtrail-badges;
"
migrate:
image: postgres:16-alpine
depends_on:
postgres:
condition: service_healthy
volumes:
- ./packages/db/migrations:/migrations:ro
entrypoint: >
/bin/sh -c "
set -eu;
for migration in /migrations/*.sql; do
psql postgresql://credtrail:credtrail@postgres:5432/credtrail -v ON_ERROR_STOP=1 -f $$migration;
done
"
app:
build:
context: .
dockerfile: Dockerfile
depends_on:
migrate:
condition: service_completed_successfully
minio-setup:
condition: service_completed_successfully
environment:
<<: *selfhost_env
PORT: "8787"
ports:
- "8787:8787"
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:8787/healthz/dependencies').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 5s
timeout: 5s
retries: 20
worker:
build:
context: .
dockerfile: Dockerfile
depends_on:
migrate:
condition: service_completed_successfully
minio-setup:
condition: service_completed_successfully
command: ["pnpm", "exec", "tsx", "apps/api-worker/src/node-worker.ts"]
environment:
<<: *selfhost_env
JOB_POLL_INTERVAL_MS: "1000"