Repository navigation
Expand file tree
/
Copy pathcompose.server.yml
More file actions
112 lines (108 loc) · 4.46 KB
/
Copy pathcompose.server.yml
File metadata and controls
112 lines (108 loc) · 4.46 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
# Production compose: Postgres + the single API/web container.
# Deployed by devkit's generated scripts/deploy/deploy-over-ssh.mjs (`npm run deploy:prod`).
# Reads secrets/config from .env on the host (auto-loaded by compose; see .env.server.example).
#
# docker compose -f compose.server.yml up -d --build
# Docker log caps for every service (LOG-4): the default json-file driver keeps
# logs forever otherwise.
x-logging: &logging
driver: json-file
options:
max-size: '10m'
max-file: '5'
services:
db:
logging: *logging
image: postgres:16-bookworm
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-persistent}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env}
healthcheck:
test:
[
'CMD-SHELL',
'pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-persistent}',
]
interval: 10s
timeout: 5s
retries: 10
volumes:
- persistent-data:/var/lib/postgresql/data
api:
logging: *logging
build:
context: .
dockerfile: Dockerfile
# OCI revision and version labels (CTR-1), exported by the deploy script.
args:
REVISION: ${DEPLOY_REVISION:-unknown}
VERSION: ${DEPLOY_VERSION:-unknown}
# Use host networking during the build: the default build bridge resolves
# registry.npmjs.org to IPv6-only and `npm ci` then can't connect.
network: host
container_name: persistent-api
restart: unless-stopped
# Liveness (SEC-7, PLAT-15). Node's own fetch, because the slim image has no
# curl or wget. The start period covers migrations running before the server
# listens.
healthcheck:
test:
[
'CMD',
'node',
'-e',
"fetch('http://127.0.0.1:' + (process.env.API_PORT || 4000) + '/api/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 60s
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB:-persistent}?schema=public
CLIENT_ORIGIN: ${CLIENT_ORIGIN:?set CLIENT_ORIGIN (the public URL) in .env}
DEMO_MODE: 'false'
CLOUDFLARE_EMAIL_ACCOUNT_ID: ${CLOUDFLARE_EMAIL_ACCOUNT_ID:-}
CLOUDFLARE_EMAIL_API_TOKEN: ${CLOUDFLARE_EMAIL_API_TOKEN:-}
CLOUDFLARE_EMAIL_FROM_EMAIL: ${CLOUDFLARE_EMAIL_FROM_EMAIL:-}
CLOUDFLARE_EMAIL_FROM_NAME: ${CLOUDFLARE_EMAIL_FROM_NAME:-Persistent}
FCM_SERVICE_ACCOUNT_FILE: ${FCM_SERVICE_ACCOUNT_FILE:-}
FCM_PROJECT_ID: ${FCM_PROJECT_ID:-}
GOOGLE_WEB_CLIENT_ID: ${GOOGLE_WEB_CLIENT_ID:-}
# Self-hosted Umami for web browsers only; both empty -> no tracker.
UMAMI_SCRIPT_URL: ${UMAMI_SCRIPT_URL:-}
UMAMI_WEBSITE_ID: ${UMAMI_WEBSITE_ID:-}
# App-store review access (see apps/api/src/lib/review-access.ts). Empty ->
# the fixed-code sign-in path does not exist.
# Comma-separated apk-key-hash origins, one per signing cert (release key,
# plus Play's key once enrolled in Play App Signing). See lib/webauthn.ts.
ANDROID_APP_ORIGINS: ${ANDROID_APP_ORIGINS:-}
# Old name of ANDROID_APP_ORIGINS, read for one release only.
ANDROID_APP_ORIGIN: ${ANDROID_APP_ORIGIN:-}
# Initial administrators: verified accounts created with these addresses start as
# admins (comma-separated). Existing grants live in the database.
ADMIN_EMAILS: ${ADMIN_EMAILS:-}
REVIEW_ACCOUNT_EMAIL: ${REVIEW_ACCOUNT_EMAIL:-}
REVIEW_ACCOUNT_CODE: ${REVIEW_ACCOUNT_CODE:-}
# FCM service-account key, mounted read-only from the host's gitignored
# .secrets/ (survives `git reset --hard` on deploy). Point
# FCM_SERVICE_ACCOUNT_FILE in .env at the in-container path on the right.
volumes:
- ./.secrets/fcm-service-account.json:/run/secrets/fcm-service-account.json:ro
# No published host port: the shared `nginx` reverse proxy reaches this
# container by name (persistent-api:4000) over the external nginx_default
# network. See nginx.server.conf. (Add a `ports` mapping only if you
# need to hit the API directly on the host.)
networks:
- default
- nginx_default
volumes:
persistent-data:
networks:
# The shared reverse-proxy network created by the host's central nginx stack.
nginx_default:
external: true