Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
437 lines (415 loc) · 16.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
437 lines (415 loc) · 16.4 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# =============================================================================
# cpa-stack: the open-source back office for a CPA / bookkeeping firm
# =============================================================================
# Five proven, unmodified open-source applications, one compose file:
#
# ERPNext - firm ledger, invoicing, AP (port 8081)
# Kimai - time tracking (port 8082)
# Nextcloud - client document storage (port 8080)
# Documenso - e-signature (engagement letters) (port 8083)
# Metabase - analytics / BI over your data (port 8084)
#
# Every image is the official upstream image, pinned to a supported version.
# Nothing is modified; each application keeps its own upstream license.
#
# Usage:
# cp .env.example .env
# nano .env # fill in every REPLACE_ME
# # Documenso needs a signing certificate first: see README "Quickstart".
# docker compose up -d
#
# See README.md for first-login steps, health checks, backups, and updates.
# =============================================================================
services:
# ---------------------------------------------------------------------------
# Nextcloud -- client document storage
# ---------------------------------------------------------------------------
nextcloud:
image: nextcloud:33-apache
restart: unless-stopped
ports:
- "8080:80"
environment:
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER:-admin}
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD}
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_TRUSTED_DOMAINS:-localhost}
POSTGRES_HOST: nextcloud-db
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
volumes:
- nextcloud_data:/var/www/html
depends_on:
nextcloud-db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/status.php"]
interval: 30s
timeout: 10s
retries: 5
nextcloud-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: ${NEXTCLOUD_DB_PASSWORD}
volumes:
- nextcloud_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nextcloud"]
interval: 10s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# ERPNext -- firm ledger, invoicing, AP, practice management
# ---------------------------------------------------------------------------
# Frappe/ERPNext requires the official multi-container topology to actually
# serve HTTP: a single erpnext container does NOT serve (there is no gunicorn
# + nginx split and no configured redis). The services below mirror the
# upstream frappe_docker layout. Pinned to erpnext v15 (the same image drives
# backend, workers, and the nginx frontend).
#
# Startup graph:
# erpnext-db + erpnext-redis-cache + erpnext-redis-queue (base)
# -> erpnext-configurator (one-shot: writes global db/redis config, exits)
# -> erpnext-create-site (one-shot: bench new-site, idempotent-guarded)
# -> backend / websocket / queues / scheduler / frontend
#
# erpnext-frontend (nginx) is the ONLY ERPNext service that binds a host port
# (8081). FRAPPE_SITE_NAME_HEADER pins the served site so your reverse proxy's
# Host header does not need to match the internal site name.
# ---------------------------------------------------------------------------
# One-shot: write global db/redis config into the shared sites volume, exit.
erpnext-configurator:
image: frappe/erpnext:v15
restart: "no"
entrypoint: ["bash", "-c"]
command:
- >
ls -1 apps > sites/apps.txt;
bench set-config -g db_host "$$DB_HOST";
bench set-config -gp db_port "$$DB_PORT";
bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port "$$SOCKETIO_PORT";
environment:
DB_HOST: erpnext-db
DB_PORT: "3306"
REDIS_CACHE: erpnext-redis-cache:6379
REDIS_QUEUE: erpnext-redis-queue:6379
SOCKETIO_PORT: "9000"
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-db:
condition: service_healthy
erpnext-redis-cache:
condition: service_healthy
erpnext-redis-queue:
condition: service_healthy
# One-shot: create the firm site + install erpnext. Idempotent: if the site
# already exists it skips bench new-site and exits 0 (never clobbers data).
erpnext-create-site:
image: frappe/erpnext:v15
restart: "no"
entrypoint: ["bash", "-c"]
command:
- >
wait-for-it -t 120 erpnext-db:3306;
wait-for-it -t 120 erpnext-redis-cache:6379;
wait-for-it -t 120 erpnext-redis-queue:6379;
export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]]; do echo "Waiting for sites/common_site_config.json to be created"; sleep 5; if (( `date +%s`-start > 120 )); then echo "could not find sites/common_site_config.json with required keys"; exit 1; fi; done;
echo "sites/common_site_config.json found";
if [ -f "sites/$$SITE_NAME/site_config.json" ]; then echo "Site $$SITE_NAME already exists -- skipping bench new-site (idempotent)"; exit 0; fi;
echo "Creating site $$SITE_NAME";
bench new-site --mariadb-user-host-login-scope='%' --admin-password="$$ADMIN_PASSWORD" --db-root-username=root --db-root-password="$$DB_ROOT_PASSWORD" --install-app erpnext --set-default "$$SITE_NAME";
environment:
SITE_NAME: ${ERPNEXT_SITE_NAME:-firm.localhost}
ADMIN_PASSWORD: ${ERPNEXT_ADMIN_PASSWORD}
DB_ROOT_PASSWORD: ${ERPNEXT_DB_ROOT_PASSWORD}
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-configurator:
condition: service_completed_successfully
erpnext-db:
condition: service_healthy
erpnext-redis-cache:
condition: service_healthy
erpnext-redis-queue:
condition: service_healthy
# gunicorn app server (image default CMD). Internal only, on :8000.
erpnext-backend:
image: frappe/erpnext:v15
restart: unless-stopped
environment:
DB_HOST: erpnext-db
DB_PORT: "3306"
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-create-site:
condition: service_completed_successfully
# socket.io realtime server. Internal only, on :9000.
erpnext-websocket:
image: frappe/erpnext:v15
restart: unless-stopped
command: ["node", "/home/frappe/frappe-bench/apps/frappe/socketio.js"]
environment:
FRAPPE_REDIS_CACHE: redis://erpnext-redis-cache:6379
FRAPPE_REDIS_QUEUE: redis://erpnext-redis-queue:6379
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-create-site:
condition: service_completed_successfully
# Short/default RQ worker.
erpnext-queue-short:
image: frappe/erpnext:v15
restart: unless-stopped
command: ["bench", "worker", "--queue", "short,default"]
environment:
FRAPPE_REDIS_CACHE: redis://erpnext-redis-cache:6379
FRAPPE_REDIS_QUEUE: redis://erpnext-redis-queue:6379
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-create-site:
condition: service_completed_successfully
# Long/default/short RQ worker.
erpnext-queue-long:
image: frappe/erpnext:v15
restart: unless-stopped
command: ["bench", "worker", "--queue", "long,default,short"]
environment:
FRAPPE_REDIS_CACHE: redis://erpnext-redis-cache:6379
FRAPPE_REDIS_QUEUE: redis://erpnext-redis-queue:6379
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-create-site:
condition: service_completed_successfully
# Background scheduler (enqueues cron/scheduled jobs).
erpnext-scheduler:
image: frappe/erpnext:v15
restart: unless-stopped
command: ["bench", "schedule"]
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-create-site:
condition: service_completed_successfully
# nginx frontend -- serves assets + proxies to backend/websocket. This is the
# only ERPNext service that binds a host port (8081 -> :8080).
erpnext-frontend:
image: frappe/erpnext:v15
restart: unless-stopped
command: ["nginx-entrypoint.sh"]
environment:
BACKEND: erpnext-backend:8000
SOCKETIO: erpnext-websocket:9000
FRAPPE_SITE_NAME_HEADER: ${ERPNEXT_SITE_NAME:-firm.localhost}
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
PROXY_READ_TIMEOUT: "120"
CLIENT_MAX_BODY_SIZE: 50m
ports:
- "8081:8080"
volumes:
- erpnext_sites:/home/frappe/frappe-bench/sites
- erpnext_logs:/home/frappe/frappe-bench/logs
depends_on:
erpnext-backend:
condition: service_started
erpnext-websocket:
condition: service_started
erpnext-db:
image: mariadb:10.11
restart: unless-stopped
# Frappe manages its own per-site database + user via the root account
# (bench new-site --db-root-*). Only the root password is needed here.
# --skip-character-set-client-handshake is required by frappe for utf8mb4.
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
environment:
MYSQL_ROOT_PASSWORD: ${ERPNEXT_DB_ROOT_PASSWORD}
MARIADB_ROOT_PASSWORD: ${ERPNEXT_DB_ROOT_PASSWORD}
volumes:
- erpnext_db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
# Ephemeral cache redis (no volume -- safe to lose).
erpnext-redis-cache:
image: redis:7.4-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Job-queue redis (persisted -- holds enqueued background jobs).
erpnext-redis-queue:
image: redis:7.4-alpine
restart: unless-stopped
volumes:
- erpnext_redis_queue_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Kimai -- time tracking
# ---------------------------------------------------------------------------
kimai:
image: kimai/kimai2:2.61.0
restart: unless-stopped
ports:
- "8082:8001"
environment:
DATABASE_URL: mysql://kimai:${KIMAI_DB_PASSWORD}@kimai-db:3306/kimai?charset=utf8mb4&serverVersion=mariadb-10.11.2
ADMINMAIL: ${KIMAI_ADMIN_EMAIL}
ADMINPASS: ${KIMAI_ADMIN_PASSWORD}
# Kimai reads TRUSTED_HOSTS as a REGEX with PIPE separators (not commas).
# Set KIMAI_TRUSTED_HOSTS in .env to your public host, pipe-separated,
# e.g. time.yourfirm.example|localhost|127.0.0.1
TRUSTED_HOSTS: ${KIMAI_TRUSTED_HOSTS:-localhost|127.0.0.1}
TRUSTED_PROXIES: ${KIMAI_TRUSTED_PROXIES:-localhost,127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16}
depends_on:
kimai-db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -sf -o /dev/null http://127.0.0.1:8001/ || exit 1"]
interval: 30s
timeout: 10s
retries: 5
kimai-db:
image: mariadb:10.11
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${KIMAI_DB_ROOT_PASSWORD}
MYSQL_DATABASE: kimai
MYSQL_USER: kimai
MYSQL_PASSWORD: ${KIMAI_DB_PASSWORD}
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- kimai_db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Documenso -- e-signature (engagement letters, internal documents)
# ---------------------------------------------------------------------------
# Requires a PKCS#12 signing certificate at ./cert.p12 before first start
# (self-signed is fine to evaluate; see README "Quickstart"). For legally
# sensitive signatures, follow Documenso's own certificate guidance.
documenso:
image: documenso/documenso:v2.14.0
restart: unless-stopped
ports:
- "8083:3000"
environment:
PORT: "3000"
NEXTAUTH_SECRET: ${DOCUMENSO_NEXTAUTH_SECRET}
NEXT_PRIVATE_ENCRYPTION_KEY: ${DOCUMENSO_ENCRYPTION_KEY}
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY: ${DOCUMENSO_ENCRYPTION_SECONDARY_KEY}
NEXT_PUBLIC_WEBAPP_URL: ${DOCUMENSO_WEBAPP_URL:-http://localhost:8083}
NEXT_PRIVATE_DATABASE_URL: postgresql://documenso:${DOCUMENSO_DB_PASSWORD}@documenso-db:5432/documenso
NEXT_PRIVATE_DIRECT_DATABASE_URL: postgresql://documenso:${DOCUMENSO_DB_PASSWORD}@documenso-db:5432/documenso
NEXT_PRIVATE_SIGNING_TRANSPORT: local
NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH: /opt/documenso/cert.p12
NEXT_PRIVATE_SIGNING_PASSPHRASE: ${DOCUMENSO_SIGNING_PASSPHRASE:-}
NEXT_PRIVATE_SMTP_TRANSPORT: ${DOCUMENSO_SMTP_TRANSPORT:-smtp-auth}
NEXT_PRIVATE_SMTP_HOST: ${DOCUMENSO_SMTP_HOST}
NEXT_PRIVATE_SMTP_PORT: ${DOCUMENSO_SMTP_PORT:-587}
NEXT_PRIVATE_SMTP_USERNAME: ${DOCUMENSO_SMTP_USERNAME}
NEXT_PRIVATE_SMTP_PASSWORD: ${DOCUMENSO_SMTP_PASSWORD}
NEXT_PRIVATE_SMTP_FROM_ADDRESS: ${DOCUMENSO_SMTP_FROM_ADDRESS}
NEXT_PRIVATE_SMTP_FROM_NAME: ${DOCUMENSO_SMTP_FROM_NAME:-Documenso}
volumes:
- ./cert.p12:/opt/documenso/cert.p12:ro
depends_on:
documenso-db:
condition: service_healthy
# The documenso image ships no curl/wget, so an in-container healthcheck is
# not reliable. Verify from the host: curl -sf http://localhost:8083/
documenso-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: documenso
POSTGRES_USER: documenso
POSTGRES_PASSWORD: ${DOCUMENSO_DB_PASSWORD}
volumes:
- documenso_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U documenso"]
interval: 10s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Metabase -- analytics / BI (dashboards over any of the databases above)
# ---------------------------------------------------------------------------
metabase:
image: metabase/metabase:v0.62.3.5
restart: unless-stopped
ports:
- "8084:3000"
environment:
MB_DB_TYPE: postgres
MB_DB_HOST: metabase-db
MB_DB_PORT: "5432"
MB_DB_DBNAME: metabase
MB_DB_USER: metabase
MB_DB_PASS: ${METABASE_DB_PASSWORD}
depends_on:
metabase-db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
metabase-db:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: metabase
POSTGRES_USER: metabase
POSTGRES_PASSWORD: ${METABASE_DB_PASSWORD}
volumes:
- metabase_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U metabase"]
interval: 10s
timeout: 5s
retries: 5
volumes:
nextcloud_data:
nextcloud_db_data:
erpnext_sites:
erpnext_logs:
erpnext_db_data:
erpnext_redis_queue_data:
kimai_db_data:
documenso_db_data:
metabase_db_data: