-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
51 lines (48 loc) · 1.82 KB
/
Copy pathdocker-compose.yml
File metadata and controls
51 lines (48 loc) · 1.82 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
# Hasna Service Contract v1 — reference self-host artifact.
#
# Every `service` / `saas` class repo ships a docker-compose.yml at its root as
# THE self-host artifact. This template shows the two-container shape a repo
# copies and renames <name> for: an app-owned PostgreSQL server plus the app.
# Reads and writes go straight to PostgreSQL; there is no sync engine or cache
# backend.
#
# The app's short name is `<name>` (e.g. todos, mailery). Replace it and the
# HASNA_<NAME>_* env keys with the real upper-snake token (e.g. HASNA_TODOS_*).
# Provide the database password via a .env file or your secret store
# (canonical secret ref: hasna/oss/<name>/database-url). Never commit secrets.
services:
db:
image: postgres:16
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-app}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in your env or .env}
POSTGRES_DB: ${POSTGRES_DB:-app}
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-app}"]
interval: 10s
timeout: 5s
retries: 5
app:
image: ${APP_IMAGE:-ghcr.io/hasna/app:latest}
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
# DATABASE_URL is the only server backend selector. It is provided at
# runtime, never baked into the image, and points at the db service.
HASNA_APP_DATABASE_URL: ${HASNA_APP_DATABASE_URL:?set HASNA_APP_DATABASE_URL to the app-owned Postgres URL}
command: ["app-serve"]
ports:
- "${APP_PORT:-8080}:8080"
healthcheck:
# GET /health -> { status, version, backend }
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health || exit 1"]
interval: 15s
timeout: 5s
retries: 5
volumes:
db-data: