-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.postgres.yml
More file actions
94 lines (91 loc) · 3.58 KB
/
Copy pathdocker-compose.postgres.yml
File metadata and controls
94 lines (91 loc) · 3.58 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
# Convenience topology for fresh deployments. The caplets role owns the database and schema.
# Use docker-compose.postgres-hardened.yml for separate migration and runtime roles.
services:
caplets-postgres:
image: ${CAPLETS_POSTGRES_IMAGE:-postgres:17-bookworm}
restart: unless-stopped
environment:
POSTGRES_DB: ${CAPLETS_POSTGRES_DATABASE:-caplets}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${CAPLETS_POSTGRES_PASSWORD:?set CAPLETS_POSTGRES_PASSWORD}
volumes:
- caplets-postgres-data:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready --username postgres --dbname "$${POSTGRES_DB}"
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
caplets-postgres-migrate:
image: ${CAPLETS_IMAGE:-ghcr.io/spiritledsoftware/caplets:latest}
restart: "no"
depends_on:
caplets-postgres:
condition: service_healthy
environment:
CAPLETS_CONFIG: /tmp/caplets-migrator-config.json
CAPLETS_POSTGRES_HOST: caplets-postgres
CAPLETS_POSTGRES_PORT: "5432"
CAPLETS_POSTGRES_DATABASE: ${CAPLETS_POSTGRES_DATABASE:-caplets}
CAPLETS_POSTGRES_SCHEMA: ${CAPLETS_POSTGRES_SCHEMA:-caplets}
CAPLETS_POSTGRES_USER: caplets
CAPLETS_POSTGRES_PASSWORD: ${CAPLETS_POSTGRES_PASSWORD:?set CAPLETS_POSTGRES_PASSWORD}
entrypoint:
- /bin/sh
- -ec
command:
- |
node /usr/local/lib/caplets/postgres/provision-roles.mjs convenience
node /usr/local/lib/caplets/postgres/render-config.mjs migrator
node dist/index.js storage schema-migrate
caplets:
image: ${CAPLETS_IMAGE:-ghcr.io/spiritledsoftware/caplets:latest}
restart: unless-stopped
depends_on:
caplets-postgres:
condition: service_healthy
caplets-postgres-migrate:
condition: service_completed_successfully
environment:
CAPLETS_CONFIG: /tmp/caplets-runtime-config.json
CAPLETS_BASE_CONFIG: /data/config/caplets/config.json
CAPLETS_SERVER_URL: ${CAPLETS_SERVER_URL:-http://127.0.0.1:5387}
CAPLETS_REMOTE_SERVER_STATE_DIR: /data/state/caplets/remote-server
CAPLETS_ADMIN_UPLOAD_STAGING_DIR: /data/state/caplets/admin-uploads
CAPLETS_ENCRYPTION_KEY: ${CAPLETS_ENCRYPTION_KEY:?set CAPLETS_ENCRYPTION_KEY to a base64url-encoded 32-byte key}
CAPLETS_POSTGRES_HOST: caplets-postgres
CAPLETS_POSTGRES_PORT: "5432"
CAPLETS_POSTGRES_DATABASE: ${CAPLETS_POSTGRES_DATABASE:-caplets}
CAPLETS_POSTGRES_SCHEMA: ${CAPLETS_POSTGRES_SCHEMA:-caplets}
CAPLETS_POSTGRES_USER: caplets
CAPLETS_POSTGRES_PASSWORD: ${CAPLETS_POSTGRES_PASSWORD:?set CAPLETS_POSTGRES_PASSWORD}
XDG_CONFIG_HOME: /data/config
XDG_STATE_HOME: /data/state
env_file:
- path: .env
required: false
ports:
- "${CAPLETS_BIND_ADDRESS:-127.0.0.1}:${CAPLETS_PORT:-5387}:5387"
volumes:
- caplets-data:/data
command:
- /bin/sh
- -ec
- |
test -f "$${CAPLETS_BASE_CONFIG}" || env CAPLETS_CONFIG="$${CAPLETS_BASE_CONFIG}" CAPLETS_MODE=local node dist/index.js init --global
node /usr/local/lib/caplets/postgres/render-config.mjs runtime
exec env CAPLETS_MODE=local node dist/index.js serve --transport http --host 0.0.0.0
healthcheck:
test:
- CMD-SHELL
- >-
node -e "fetch('http://127.0.0.1:5387/api/v1/healthz').then((response) => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"
interval: 30s
timeout: 5s
retries: 5
start_period: 10s
volumes:
caplets-data:
caplets-postgres-data: