-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
383 lines (353 loc) · 12.3 KB
/
Copy pathdocker-compose.yml
File metadata and controls
383 lines (353 loc) · 12.3 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
# =============================================================================
# PLATFORM OS — MIME-typed storage + reusable generator services
#
# Layers:
# DATA postgres source of truth, one table per MIME
# SYNC sync-engine filesystem <-> DB, routes by MIME
# GATEWAY api-gateway CRUD + ACL + schema registry
# BUS command-bus async command execution
# WORKERS worker-python, worker-php business logic executors
# GENERATORS gen-jinja (Py), gen-twig (PHP), gen-handlebars (Node)
# each reads content_* tables and renders
# HTML — fully swappable across projects
# UI ui-runtime schema-driven frontend
# CDN nginx-cdn delivery / routing
# =============================================================================
services:
postgres:
image: postgres:16-alpine
container_name: platform-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-platform}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-platform}
POSTGRES_DB: ${POSTGRES_DB:-platform}
ports: ["${POSTGRES_PORT:-5432}:5432"]
volumes:
- ./postgres-data:/var/lib/postgresql/data
- ./postgres/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U platform -d platform"]
interval: 5s
timeout: 3s
retries: 10
networks: [platform]
sync-engine:
build: ./sync-engine
container_name: platform-sync
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
WATCH_PATH: /data
MERGE_POLICY: ${MERGE_POLICY:-lww}
volumes:
- ./data:/data
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
api-gateway:
build: ./api-gateway
container_name: platform-gateway
restart: unless-stopped
env_file: .env
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
JWT_SECRET: ${JWT_SECRET:-devsecret-change-me}
COMMAND_BUS_URL: http://command-bus:4000
GEN_JINJA_URL: http://gen-jinja:6001
GEN_TWIG_URL: http://gen-twig:6002
GEN_HANDLEBARS_URL: http://gen-handlebars:6003
CONFIG_DB: /config-data/platform-config.sqlite
ports: ["${API_PORT:-3000}:3000"]
volumes:
- ./config-data:/config-data
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
command-bus:
build: ./command-bus
container_name: platform-bus
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
WORKER_PYTHON_URL: http://worker-python:5001
WORKER_PHP_URL: http://worker-php:5002
GEN_JINJA_URL: http://gen-jinja:6001
GEN_TWIG_URL: http://gen-twig:6002
GEN_HANDLEBARS_URL: http://gen-handlebars:6003
ports: ["${BUS_PORT:-4000}:4000"]
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
worker-python:
build: ./workers/python
container_name: platform-worker-python
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
networks: [platform]
worker-php:
build: ./workers/php
container_name: platform-worker-php
restart: unless-stopped
environment:
DSN: "pgsql:host=postgres;port=5432;dbname=platform"
DB_USER: platform
DB_PASS: platform
networks: [platform]
# ---------- WEBSITE GENERATORS (each in a different technology) ----------
# All three read the same tables. Each declares itself in
# schemas.renderers, so routing is data-driven — no hard-coded dispatch.
gen-jinja:
build: ./generators/gen-jinja
container_name: platform-gen-jinja
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
RENDERER_NAME: gen-jinja
ports: ["${GEN_JINJA_PORT:-6001}:6001"]
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
gen-twig:
build: ./generators/gen-twig
container_name: platform-gen-twig
restart: unless-stopped
environment:
DSN: "pgsql:host=postgres;port=5432;dbname=platform"
DB_USER: platform
DB_PASS: platform
RENDERER_NAME: gen-twig
ports: ["${GEN_TWIG_PORT:-6002}:6002"]
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
gen-handlebars:
build: ./generators/gen-handlebars
container_name: platform-gen-handlebars
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
RENDERER_NAME: gen-handlebars
ports: ["${GEN_HBS_PORT:-6003}:6003"]
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
ui-runtime:
build: ./ui-runtime
container_name: platform-ui
restart: unless-stopped
environment:
API_URL: http://localhost:${API_PORT:-3000}
BUS_URL: http://localhost:${BUS_PORT:-4000}
ports: ["${UI_PORT:-5173}:80"]
depends_on: [api-gateway]
networks: [platform]
nginx-cdn:
image: nginx:alpine
container_name: platform-cdn
restart: unless-stopped
ports: ["${CDN_PORT:-8080}:80"]
volumes:
- ./cdn/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on: [api-gateway, ui-runtime, gen-jinja, gen-twig, gen-handlebars]
networks: [platform]
# ---------- VIRTUAL FILESYSTEMS ----------
# Two filesystem skins over the same content_* tables. Pick one or run both.
# WebDAV — easiest: mount over network from any OS.
# Linux: sudo mount -t davfs http://localhost:8090 /mnt/vfs
# macOS: mount_webdav http://localhost:8090 /Volumes/vfs
# Windows: map network drive to http://localhost:8090
vfs-webdav:
build: ./vfs-webdav
container_name: platform-vfs-webdav
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
WEBDAV_USER: ${WEBDAV_USER:-admin}
WEBDAV_PASS: ${WEBDAV_PASS:-admin}
ports: ["${WEBDAV_PORT:-8090}:8090"]
depends_on:
postgres: { condition: service_healthy }
networks: [platform]
# FUSE — real Linux filesystem. Mounted inside the container at /mnt/vfs;
# bind-mounted to the host so other processes see it too.
# Requires the host kernel to have FUSE support (all Linux ≥ 2.6.14).
vfs-fuse:
build: ./vfs-fuse
container_name: platform-vfs-fuse
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
MOUNT_POINT: /mnt/vfs
privileged: true # simplest path; tighten in prod
cap_add: [SYS_ADMIN]
devices:
- /dev/fuse
security_opt:
- apparmor:unconfined
volumes:
- type: bind
source: ${VFS_HOST_MOUNT:-./vfs-mount}
target: /mnt/vfs
bind: { propagation: rshared }
depends_on:
postgres: { condition: service_healthy }
profiles: ["fuse"] # opt-in: `docker compose --profile fuse up`
networks: [platform]
# ---------- UNIFORM PROTOCOL GATEWAYS ----------
# Each gateway uses the shared `platform_storage` library (libs/platform_storage)
# and therefore sees the same entities exactly like vfs-webdav. Swap one for
# another by protocol, the data contract does not change.
# Opt-in via `docker compose --profile protocols up`.
vfs-ftp:
build:
context: .
dockerfile: vfs-ftp/Dockerfile
container_name: platform-vfs-ftp
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
FTP_USER: ${FTP_USER:-admin}
FTP_PASS: ${FTP_PASS:-admin}
ports:
- "${FTP_PORT:-2121}:2121"
- "30000-30100:30000-30100"
depends_on:
postgres: { condition: service_healthy }
profiles: ["protocols"]
networks: [platform]
vfs-imap:
build:
context: .
dockerfile: vfs-imap/Dockerfile
container_name: platform-vfs-imap
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
IMAP_USER: ${IMAP_USER:-admin}
IMAP_PASS: ${IMAP_PASS:-admin}
ports: ["${IMAP_PORT:-1143}:1143"]
depends_on:
postgres: { condition: service_healthy }
profiles: ["protocols"]
networks: [platform]
vfs-pop3:
build:
context: .
dockerfile: vfs-pop3/Dockerfile
container_name: platform-vfs-pop3
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
POP3_USER: ${POP3_USER:-admin}
POP3_PASS: ${POP3_PASS:-admin}
ports: ["${POP3_PORT:-1110}:1110"]
depends_on:
postgres: { condition: service_healthy }
profiles: ["protocols"]
networks: [platform]
vfs-smtp:
build:
context: .
dockerfile: vfs-smtp/Dockerfile
container_name: platform-vfs-smtp
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
ports: ["${SMTP_PORT:-2525}:2525"]
depends_on:
postgres: { condition: service_healthy }
profiles: ["protocols"]
networks: [platform]
# ---------- INBOUND CONNECTORS ----------
# Each connector loads its config from `inbound_sources` at runtime. Add a
# row -> it starts polling that source. No code change.
# Opt-in via `docker compose --profile connectors up`.
connector-imap-pull:
build:
context: .
dockerfile: connectors/imap-pull/Dockerfile
container_name: platform-connector-imap
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
depends_on:
postgres: { condition: service_healthy }
profiles: ["connectors"]
networks: [platform]
connector-ftp-pull:
build:
context: .
dockerfile: connectors/ftp-pull/Dockerfile
container_name: platform-connector-ftp
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
depends_on:
postgres: { condition: service_healthy }
profiles: ["connectors"]
networks: [platform]
connector-sql-mirror:
build:
context: .
dockerfile: connectors/sql-mirror/Dockerfile
container_name: platform-connector-sql
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
STORAGE_BACKEND: pg-primary
depends_on:
postgres: { condition: service_healthy }
profiles: ["connectors"]
networks: [platform]
# ---------- STORAGE MIRRORING ----------
# Tails audit_log and replays every write into each `storage_backends` row
# with role='mirror'. Lets you keep a SQLite/MySQL copy of the same entities.
# Opt-in via `docker compose --profile mirrors up`.
storage-mirror:
build:
context: .
dockerfile: storage-mirror/Dockerfile
container_name: platform-storage-mirror
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
MIRROR_POLL_SECONDS: "3"
# Optional secondary backends — used only if declared in storage_backends:
SQLITE_PATH: /mirror-data/platform.sqlite
MYSQL_DSN: ${MYSQL_DSN:-}
volumes:
- ./mirror-data:/mirror-data
depends_on:
postgres: { condition: service_healthy }
profiles: ["mirrors"]
networks: [platform]
# ---------- OUTBOUND SYNC ----------
# Reads `service_mappings` and pushes matching audit_log rows to targets.
# Example: mail entities -> ./email/*.eml (readable via file://, IMAP, WebDAV).
sync-outbound:
build:
context: .
dockerfile: sync-outbound/Dockerfile
container_name: platform-sync-outbound
restart: unless-stopped
environment:
DATABASE_URL: postgres://platform:platform@postgres:5432/platform
OUTBOUND_POLL_SECONDS: "3"
OUTBOUND_DIR: /data
volumes:
- ./data:/data
depends_on:
postgres: { condition: service_healthy }
profiles: ["outbound"]
networks: [platform]
networks:
platform:
driver: bridge