forked from zkldi/Tachi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-dev.yml
More file actions
233 lines (224 loc) · 6.84 KB
/
Copy pathdocker-compose-dev.yml
File metadata and controls
233 lines (224 loc) · 6.84 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
services:
tachi-redis:
container_name: tachi-redis
command: redis-server --save 60 1 --loglevel warning
image: redis:7.4-alpine
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- tachi-redis:/data
tachi-postgres:
container_name: tachi-postgres
image: postgres:18
restart: unless-stopped
ports:
- "5432:5432"
# Dev observability: pg_stat_statements + slow-query logging + auto_explain plans.
# Recreate the container (or bump volume) after changing these; existing DBs: run
# CREATE EXTENSION pg_stat_statements; once if missing.
command:
- postgres
- -c
- shared_preload_libraries=pg_stat_statements,auto_explain
- -c
- pg_stat_statements.track=all
- -c
- log_min_duration_statement=100
- -c
- log_line_prefix=%m [%p] %q%u@%d
- -c
- auto_explain.log_min_duration=500
- -c
- auto_explain.log_analyze=on
- -c
- auto_explain.log_buffers=on
environment:
POSTGRES_USER: tachi
POSTGRES_PASSWORD: tachi
POSTGRES_DB: tachi
volumes:
- tachi-postgres:/var/lib/postgresql
- "./dev/postgres-init.sql:/docker-entrypoint-initdb.d/init.sql"
# Dedicated test Postgres. Lives on tmpfs with durability disabled - every
# `CREATE DATABASE ... TEMPLATE`, every `TRUNCATE`, every commit is ~5-20x
# faster than the dev DB. Wiped on container restart, which is exactly what
# we want for tests.
tachi-postgres-test:
container_name: tachi-postgres-test
image: postgres:18
restart: unless-stopped
ports:
- "5433:5432"
# NOTE: with `pool: "threads" + isolate: false` (vitest.config.ts) the
# vitest worker DBs are long-lived (~25-30 files of writes each), so
# autovacuum + a small WAL ceiling + a working bgwriter are NEEDED to
# avoid filling the tmpfs. Earlier we shipped autovacuum=off +
# max_wal_size=1GB + bgwriter_lru_maxpages=0 (which was fine for the
# short-lived per-file DBs of isolate:true) and tests started failing
# mid-run with `No space left on device`.
command:
- postgres
- -c
- fsync=off
- -c
- synchronous_commit=off
- -c
- full_page_writes=off
- -c
- wal_level=minimal
- -c
- max_wal_senders=0
- -c
- shared_buffers=256MB
- -c
- max_connections=200
- -c
- max_wal_size=128MB
- -c
- min_wal_size=32MB
- -c
- checkpoint_timeout=30s
- -c
- autovacuum=on
- -c
- autovacuum_naptime=5s
- -c
- autovacuum_vacuum_scale_factor=0.05
- -c
- autovacuum_analyze_scale_factor=0.1
- -c
- shared_preload_libraries=pg_stat_statements
- -c
- pg_stat_statements.track=all
# Sized for ~16 concurrent worker DBs + template + WAL headroom.
# Each worker DB clone is ~150-250 MB post-migration, and `CREATE
# DATABASE ... TEMPLATE` can briefly double that during the copy.
tmpfs:
- /var/lib/postgresql/data:rw,size=6g
environment:
POSTGRES_USER: tachi
POSTGRES_PASSWORD: tachi
POSTGRES_DB: postgres
PGDATA: /var/lib/postgresql/data/pgdata
# PostgreSQL admin UI (http://localhost:5050). Dev + test servers are pre-registered
# on first launch via dev/pgadmin/servers.json (wipe tachi-pgadmin volume to reload).
tachi-pgadmin:
container_name: tachi-pgadmin
image: dpage/pgadmin4
restart: unless-stopped
depends_on:
- tachi-postgres
- tachi-postgres-test
ports:
- "5050:80"
environment:
PGADMIN_DEFAULT_EMAIL: pgadmin@example.com
PGADMIN_DEFAULT_PASSWORD: password
volumes:
- tachi-pgadmin:/var/lib/pgadmin
- "./dev/pgadmin/servers.json:/pgadmin4/servers.json:ro"
tachi-s3:
container_name: tachi-s3
image: quay.io/minio/minio:RELEASE.2024-10-29T16-01-48Z
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: password
ports:
- "9000:9000"
- "9001:9001"
volumes:
- tachi-minio:/data
entrypoint: /usr/bin/minio server /data --console-address=':9001'
# Local SMTP capture + web UI (http://localhost:8025). Server uses tachi-mailpit:1025 via env.
tachi-mailpit:
container_name: tachi-mailpit
image: axllent/mailpit:v1.29.7
restart: unless-stopped
ports:
- "8025:8025"
- "1025:1025"
tachi-dev:
user: "1000:1000"
tty: true
container_name: tachi-dev
depends_on:
- tachi-s3
- tachi-mailpit
build:
dockerfile: Dockerfile.dev
ports:
- "8080:8080" # server
- "3000:3000" # client
- "3001:3001" # docs
- "3002:3002" # homepage
- "3100:3100" # seeds
- "9779:9779" # metrics
volumes:
- ./:/tachi
# Mount your home files under your-pc, so you can easily access them
- ~:/host-pc
# keep node_modules inside the container, not on the host mount
- /tachi/node_modules/
- /tachi/.bun
# Local observability (Grafana + Prometheus + Alloy). Grafana UI: http://localhost:3005
# Alloy scrapes the API metrics endpoint at tachi-dev:9779 and remote-writes into Prometheus.
tachi-grafana:
container_name: tachi-grafana
image: grafana/grafana:12.4.2
restart: unless-stopped
depends_on:
- tachi-prometheus
ports:
- "3005:3000"
environment:
GF_SECURITY_ADMIN_USER: tachi
GF_SECURITY_ADMIN_PASSWORD: tachi
GF_USERS_ALLOW_SIGN_UP: "false"
GF_SERVER_HTTP_ADDR: 0.0.0.0
GF_SERVER_HTTP_PORT: "3000"
GF_SERVER_ROOT_URL: http://localhost:3005
volumes:
- tachi-grafana:/var/lib/grafana
- ./observability/grafana/provisioning:/etc/grafana/provisioning
- ./observability/grafana/dashboards:/var/lib/grafana/dashboards
tachi-prometheus:
container_name: tachi-prometheus
image: prom/prometheus:v3.11.0
restart: unless-stopped
command:
- --config.file=/etc/prometheus/prometheus.yml
- --storage.tsdb.path=/prometheus
- --web.enable-lifecycle
- --web.enable-remote-write-receiver
ports:
- "9090:9090"
volumes:
- tachi-prometheus:/prometheus
- ./observability/prometheus.yml:/etc/prometheus/prometheus.yml
tachi-alloy:
container_name: tachi-alloy
image: grafana/alloy:v1.15.0
restart: unless-stopped
depends_on:
- tachi-prometheus
command:
- run
- --server.http.listen-addr=0.0.0.0:12345
- --storage.path=/var/lib/alloy/data
- /etc/alloy/config.alloy
ports:
- "12345:12345"
# Writable WAL path (named volumes are often root-owned; Alloy runs non-root and can crash-loop).
tmpfs:
- /var/lib/alloy/data
volumes:
- ./observability/alloy-config.alloy:/etc/alloy/config.alloy
volumes:
tachi-redis:
tachi-logs:
tachi-postgres:
tachi-pgadmin:
tachi-minio:
tachi-grafana:
tachi-prometheus: