Mirrored from GitHub
github.com/roostorg/coop
5.3 kB
200 lines
1services:
2 redis:
3 image: redis:8.6.1-trixie
4 restart: unless-stopped
5 command:
6 - redis-server
7 - --appendonly
8 - 'yes'
9 - --maxmemory
10 - '256mb'
11 - --maxmemory-policy
12 - noeviction
13 ports:
14 - '127.0.0.1:6379:6379'
15 volumes:
16 - redis_data:/data
17 deploy:
18 resources:
19 limits:
20 memory: 384M
21
22 # Runs all migrations from scratch, after clearing the database(s).
23 migrations:
24 image: node:24.14.1-bullseye-slim
25 command: bash -c 'set -e
26 npm i && ( [ "$CI" = "true" ] && npm run db:clean -- --env staging || true )
27 && for db in api-server-pg scylla clickhouse; do npm run db:create -- --db "$$db" --env staging; npm run db:update -- --db "$$db" --env staging; done'
28 working_dir: /src
29 env_file: ./.env.githubci
30 environment:
31 - MIGRATOR_DB_NAME
32 - CLICKHOUSE_DATABASE
33 volumes:
34 - .:/src
35 depends_on:
36 postgres:
37 condition: service_healthy
38 scylla:
39 condition: service_healthy
40 clickhouse:
41 condition: service_healthy
42
43 drop_dbs:
44 image: node:24.14.1-bullseye-slim
45 command: bash -c 'npm i && npm run db:drop -- --env staging'
46 working_dir: /src
47 env_file: ./.env.githubci
48 environment:
49 - CLICKHOUSE_DATABASE
50 - MIGRATOR_DB_NAME
51 volumes:
52 - .:/src
53 depends_on:
54 - postgres
55
56 postgres:
57 image: postgres:15.18
58 volumes:
59 - pg_data:/var/lib/postgresql/data
60 ports:
61 - '127.0.0.1:5432:5432'
62 healthcheck:
63 test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'postgres']
64 interval: 2s
65 start_period: 2s
66 environment:
67 POSTGRES_PASSWORD: postgres123
68 POSTGRES_USER: postgres
69 POSTGRES_DB: postgres
70
71 hma:
72 build:
73 context: ./hma
74 dockerfile: Dockerfile
75 environment:
76 - POSTGRES_PASSWORD=postgres123
77 - POSTGRES_USER=postgres
78 - POSTGRES_DB=postgres
79 - POSTGRES_HOST=postgres
80 ports:
81 - '9876:9876'
82 depends_on:
83 - postgres
84
85 scylla:
86 image: scylladb/scylla:5.2
87 # Cap Scylla's footprint so it doesn't grab nearly all available RAM
88 # on small hosts (it allocates ~all "available" memory at startup by
89 # default, which starves the rest of the stack on a VPS env).
90 command: --smp 1 --memory 4G --overprovisioned 1 --developer-mode 1
91 volumes:
92 - scylla_data:/var/lib/scylla
93 ports:
94 - '9042:9042'
95 healthcheck:
96 test: ['CMD-SHELL', 'nodetool status || exit 1']
97 interval: 5s
98 timeout: 5s
99 retries: 28
100 start_period: 35s
101
102 # Runs the api server's tests
103 test:
104 build:
105 context: .
106 dockerfile: Dockerfile
107 target: server_base
108 command: bash -c 'npm run test:ci'
109 working_dir: /app
110 volumes:
111 - ./server/reports:/app/reports
112 env_file: ./.env.githubci
113 depends_on:
114 migrations:
115 condition: service_completed_successfully
116 redis:
117 condition: service_started
118
119 # Regenerate GraphQL types and fail if the working tree drifts.
120 # Mirrors the `check_generated_graphql` CI job.
121 # node_modules is in a dedicated volume so the install doesn't clobber the host's node_modules.
122 codegen-check:
123 build:
124 context: .
125 dockerfile: Dockerfile
126 target: server_base
127 working_dir: /src
128 command: bash -c 'set -e
129 && git config --global --add safe.directory /src
130 && npm ci
131 && npm run generate
132 && [[ -z "$(git status --porcelain)" ]]'
133 volumes:
134 - .:/src
135 - codegen_node_modules:/src/node_modules
136
137 backend:
138 build:
139 context: .
140 dockerfile: Dockerfile
141 target: server_base
142
143 client:
144 build:
145 context: client
146 target: client_base
147 volumes:
148 - ./client/eslint:/app/eslint
149 - ./client/.eslintrc.cjs:/app/.eslintrc.cjs
150 - ./client/eslint.config.mjs:/app/eslint.config.mjs
151
152 jaeger:
153 image: jaegertracing/all-in-one:1.76.0
154 ports:
155 - '16686:16686'
156 - '14268'
157 - '14250'
158 environment:
159 - LOG_LEVEL=info
160
161 otel-collector:
162 # We have to pin to this version of the collector, because versions beyond
163 # this do not support the Jaeger exporter. See here for details:
164 # https://github.com/open-telemetry/opentelemetry-specification/pull/2858
165 image: otel/opentelemetry-collector-contrib:0.71.0
166 volumes:
167 - ./otel-collector.yaml:/etc/otel-collector.yaml
168 command: ['--config=/etc/otel-collector.yaml']
169 ports:
170 - '1888:1888' # pprof extension
171 - '13133:13133' # health_check extension
172 - '4317:4317' # OTLP gRPC receiver
173 - '55670:55679' # zpages extension
174 depends_on:
175 - jaeger
176
177 clickhouse:
178 image: clickhouse/clickhouse-server:24.3
179 ports:
180 - '8123:8123' # HTTP interface
181 - '9000:9000' # Native TCP interface
182 volumes:
183 - clickhouse_data:/var/lib/clickhouse
184 environment:
185 CLICKHOUSE_DB: analytics
186 CLICKHOUSE_USER: default
187 CLICKHOUSE_PASSWORD: 'clickhouse'
188 healthcheck:
189 test:
190 ['CMD-SHELL', 'clickhouse-client --host localhost --query "SELECT 1"']
191 interval: 5s
192 timeout: 3s
193 retries: 5
194
195volumes:
196 pg_data:
197 scylla_data:
198 redis_data:
199 clickhouse_data:
200 codegen_node_modules: