Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
184 lines (174 loc) · 6.52 KB
/
Copy pathdocker-compose.yml
File metadata and controls
184 lines (174 loc) · 6.52 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
name: soloops
x-node: &node
build:
context: .
dockerfile: Dockerfile
# The Dockerfile is multi-stage — without a target you end up in `runtime`.
target: base
env_file: .env
volumes:
- .:/app
- node_modules_root:/app/node_modules
- ./data:/data
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
TZ: ${TZ:-Europe/Berlin}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- '5433:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}']
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:7-alpine
restart: unless-stopped
command: ['redis-server', '--appendonly', 'yes']
volumes:
- redisdata:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 20
# The schema, once, before anything talks to the database. Its own service
# rather than a line in the api command: two services that both migrate on
# startup race each other, and a migration that fails has to stop the boot
# instead of being the first line of a log nobody reads.
#
# Generate before deploying: node_modules lives in a named volume, so a
# client generated for an older schema survives restarts and crashes the
# API.
migrate:
<<: *node
restart: 'no'
command: sh -c "npx prisma generate --schema packages/core/prisma/schema.prisma && npx prisma migrate deploy --schema packages/core/prisma/schema.prisma"
api:
<<: *node
restart: unless-stopped
command: npm -w @soloops/api run dev
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
ports:
# 3000 is often taken by some other dev server already
- '${API_PORT:-3000}:3000'
worker:
<<: *node
restart: unless-stopped
command: npm -w @soloops/worker run dev
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
api:
condition: service_started
# n8n is the drag-and-drop surface behind "Automatisierungen". It is served
# under /n8n/ through the web origin, not on its own host — that is what
# lets the editor sit in an iframe inside soloops, and it keeps webhook
# URLs on the one address the browser already trusts.
n8n:
image: docker.n8n.io/n8nio/n8n:${N8N_IMAGE_TAG:-2.42.4}
restart: unless-stopped
# Deliberately no `env_file: .env` — n8n has no business holding the
# database URL, the JWT secret or the Anthropic key. Everything it needs
# is spelled out here.
environment:
N8N_PORT: 5678
N8N_PROTOCOL: http
N8N_LISTEN_ADDRESS: 0.0.0.0
# Served under a sub-path, so every asset and REST call it emits is
# prefixed and survives the proxy in front of it.
N8N_PATH: /n8n/
N8N_EDITOR_BASE_URL: ${APP_URL:-http://localhost:5174}/n8n/
WEBHOOK_URL: ${APP_URL:-http://localhost:5174}/n8n/
# Development runs over plain http, where a Secure cookie never arrives.
N8N_SECURE_COOKIE: 'false'
# Without this n8n logs a deprecation warning on every boot.
N8N_RUNNERS_ENABLED: 'true'
N8N_DIAGNOSTICS_ENABLED: 'false'
N8N_VERSION_NOTIFICATIONS_ENABLED: 'false'
GENERIC_TIMEZONE: ${TZ:-Europe/Berlin}
TZ: ${TZ:-Europe/Berlin}
# The soloops nodes. Mounted read-only from the monorepo, so a rebuild
# of the package plus a restart of this one container is the whole
# deploy of a connector change.
N8N_CUSTOM_EXTENSIONS: /custom-nodes/n8n-nodes-soloops
# Where a workflow may read and write files: the contract directory and
# nothing else. n8n blocks file access outright by default, and this is
# narrower than switching that off — the templates are read from here
# and the signed PDFs are written back here.
N8N_RESTRICT_FILE_ACCESS_TO: /data/vertraege
# Nothing about Zoho here on purpose: the contract workflows hold those
# three values in an n8n credential ("Zoho Sign"). Through the
# environment they would be readable by every workflow on the instance,
# which is a lot of reach for a client secret.
volumes:
# A named volume, not a bind mount under ./data: Docker would create
# that one owned by root and n8n runs as uid 1000, which leaves it
# unable to write its own database.
- n8ndata:/home/node/.n8n
- ./packages/n8n-nodes-soloops:/custom-nodes/n8n-nodes-soloops:ro
# The same /data the API sees — this is where the signed contracts land,
# which is how soloops can serve them back later.
- ./data:/data
# The contract templates, mounted straight out of the repository at the
# path the workflow reads. Copying them into ./data would work too and
# would go stale the first time one is edited; `data/` is runtime state
# and not in git, so the copy nobody updated would be the only one left.
- ./packages/core/src/automations/contracts/templates:/data/vertraege/templates:ro
ports:
# Also reachable directly — handy when the editor misbehaves behind the
# proxy and you want to rule the proxy out.
- '${N8N_PORT:-5678}:5678'
# HTML to PDF for the contract workflows. Chromium in a container — the
# alternative is a headless browser inside n8n, which n8n images do not
# carry. Nothing but n8n talks to it, so it stays off the host network.
gotenberg:
image: gotenberg/gotenberg:8
restart: unless-stopped
# Both defaults are about the one job it has here: a contract is a handful
# of pages of static HTML, so a long render means something is wrong.
command:
- 'gotenberg'
- '--chromium-disable-javascript=true'
- '--api-timeout=60s'
environment:
TZ: ${TZ:-Europe/Berlin}
web:
<<: *node
restart: unless-stopped
command: npm -w @soloops/web run dev
ports:
# on many machines 5173 is taken by another Vite already
- '${WEB_PORT:-5174}:5173'
depends_on:
api:
condition: service_started
n8n:
condition: service_started
volumes:
pgdata:
redisdata:
n8ndata:
node_modules_root: