Make the deploy panel-friendly: zero-config compose, env vars with defaults
- compose.yaml runs only the app by default; Caddy moved to the
'standalone' profile (the panel brings its own Caddy and routes).
- No env_file: every setting is ${VAR:-default} in compose.yaml, so it
can be set from the panel's Environment tab (or .env standalone).
- VAPID keys are generated on first start and kept in the data volume;
the push subject defaults to https://<site domain>. gen-vapid.ts removed.
- PUSH_DISABLED=1 turns push off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
This commit is contained in:
parent
1382e53359
commit
04d952872d
11 changed files with 191 additions and 152 deletions
59
SPEC.md
59
SPEC.md
|
|
@ -503,46 +503,33 @@ e2e/ Playwright tests
|
|||
|
||||
---
|
||||
|
||||
## 13. Deployment (VPS, podman compose)
|
||||
## 13. Deployment (podman compose, with or without the panel)
|
||||
|
||||
`compose.yaml` (repo root) runs two services:
|
||||
`compose.yaml` (repo root) runs the `app` service: the Node server, which
|
||||
also serves the built static client, on port 8080 with its data in the
|
||||
`oweme-data` volume. It works with **zero configuration**: VAPID keys are
|
||||
generated on first start and stored in the volume (`vapid.json`, mode 600),
|
||||
and the push contact defaults to `https://<site domain>`.
|
||||
|
||||
- `app`: the Node server, which also serves the built static client. Listens
|
||||
on the internal network only.
|
||||
- `caddy`: TLS termination + reverse proxy, the only service publishing
|
||||
ports (80/443).
|
||||
Every setting is an optional environment variable, written in `compose.yaml`
|
||||
as `${VAR:-default}` so it is visible and documented in one place:
|
||||
`MAX_PHOTO_BYTES`, `MAX_EVENT_BYTES`, `MAX_GROUP_BYTES`,
|
||||
`GROUP_CREATE_PER_HOUR`, `VAPID_SUBJECT`, `VAPID_PUBLIC_KEY` /
|
||||
`VAPID_PRIVATE_KEY` (pin keys), `PUSH_DISABLED`.
|
||||
|
||||
Volumes: `oweme-data` (SQLite + blobs), `caddy-data` (certificates).
|
||||
- **With the panel** (the main target): the panel clones the repo, finds
|
||||
`compose.yaml` at the root, routes the app's domain to `app:8080` through
|
||||
its own Caddy (HTTPS) and passes the Environment tab's variables to
|
||||
compose for `${VAR}` interpolation. "Pass to every container" must stay
|
||||
off until the panel's injection override stops clashing with variables the
|
||||
compose file sets (podman-compose: `can't merge value of [KEY]`).
|
||||
- **Standalone**: `podman compose --profile standalone up -d` adds a Caddy
|
||||
container with automatic HTTPS for `DOMAIN`, published on
|
||||
`${BIND_ADDR}:${HTTP_PORT}/${HTTPS_PORT}` (defaults all interfaces, 80/443).
|
||||
Settings come from `.env` next to `compose.yaml`.
|
||||
|
||||
Deploy steps (documented in `deploy/README.md`):
|
||||
|
||||
1. Point a DNS A/AAAA record at the VPS.
|
||||
2. `cp .env.example .env && chmod 600 .env`, then set
|
||||
`DOMAIN` (e.g. `oweme.example.com`); Caddy uses it for the site address
|
||||
and certificate. (The app itself needs no domain: share links use the
|
||||
page's own origin and the CSP is `'self'`.) Generate VAPID keys with
|
||||
`gen-vapid.ts` inside the built image, which writes them into `.env`
|
||||
without printing them.
|
||||
3. Rootless Podman cannot bind ports < 1024 by default: either set
|
||||
`net.ipv4.ip_unprivileged_port_start=80` via sysctl, or publish 8080/8443 and
|
||||
redirect with the firewall — both documented.
|
||||
4. `podman compose up -d` from the repo root. Updates: `git pull && podman compose up -d --build`.
|
||||
5. Backups: copy the data volume. All contents are already encrypted, so
|
||||
backups can be stored anywhere.
|
||||
|
||||
Environment variables (`.env`, read by `compose.yaml`):
|
||||
|
||||
| Variable | Required | Default | Purpose |
|
||||
|---|---|---|---|
|
||||
| `DOMAIN` | yes | — | Public hostname; Caddy site + TLS, share links |
|
||||
| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | for push | — | Web Push (generated by script); empty = notifications off |
|
||||
| `VAPID_SUBJECT` | for push | — | `mailto:` contact for push services |
|
||||
| `MAX_PHOTO_BYTES` | no | `2097152` | Per-photo upload cap |
|
||||
| `MAX_EVENT_BYTES` | no | `65536` | Per-event cap |
|
||||
| `MAX_GROUP_BYTES` | no | `209715200` | Per-group storage cap |
|
||||
| `GROUP_CREATE_PER_HOUR` | no | `10` | Group creations per IP per hour |
|
||||
| `BIND_ADDR` | no | `0.0.0.0` | Address Caddy's ports are published on |
|
||||
| `HTTP_PORT` / `HTTPS_PORT` | no | `80` / `443` | Host ports for Caddy |
|
||||
Step-by-step instructions, the full settings table, ports for rootless Podman
|
||||
and backups are in `deploy/README.md`.
|
||||
|
||||
Development (on the dev box): servers bind `127.0.0.1` only; preview over an
|
||||
SSH tunnel. Ports and commands go in `AGENTS.md`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue