oweme/deploy/README.md
agent 0217d62bf0 Make the app's port configurable with PORT (default 8080)
compose.yaml passes ${PORT:-8080} to the app, its healthcheck and the
standalone Caddy (APP_PORT in the Caddyfile). Docs note that the panel's
domain must target the same port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
2026-10-09 22:49:54 +00:00

104 lines
4.3 KiB
Markdown

# Deploying OweMe
`compose.yaml` (repo root) runs the **app** container: the Node server plus
the built web client, listening on port 8080 (or `PORT`), with its data in the
`oweme-data` volume. It needs **no configuration**: push keys are generated
on first start and kept in the volume. Every setting is an optional
environment variable, listed with its default in `compose.yaml`.
HTTPS comes either from the panel's Caddy or, standalone, from a Caddy
container enabled with the `standalone` profile.
## With the panel
1. **New app → Git repository**: this repo, branch `main`. The panel finds
`compose.yaml` in the repository root.
2. **Domain**: point it at service **`app`**, port **`8080`** (or the
`PORT` you set in the Environment tab). The panel
publishes the port on 127.0.0.1 and its Caddy serves HTTPS.
3. **Environment** (optional): any variable from `compose.yaml`, for example
`MAX_PHOTO_BYTES=5242880` or `VAPID_SUBJECT=mailto:you@example.com`.
Untick **Pass to every container**. `compose.yaml` already passes each
setting to the app, and the panel's per-container copy currently makes
podman-compose fail with `can't merge value of [KEY] …` for variables the
compose file also sets.
4. **Deploy.** Check `https://<domain>/api/health` → `{"ok":true}`.
Changing a variable takes effect on the next deploy. Volume backups in the
panel include the `oweme-data` volume (database, encrypted photos, push keys).
## Standalone (no panel)
Requirements: Podman ≥ 4 with podman-compose ≥ 1.1 (for profiles), a domain
with an A/AAAA record pointing at the server, and ports 80 and 443 (TCP, plus
UDP 443 for HTTP/3) open.
```sh
git clone <repo> oweme && cd oweme
cp .env.example .env && chmod 600 .env
$EDITOR .env # set DOMAIN
podman compose --profile standalone up -d --build
podman compose logs -f # Caddy gets the certificate on the first request
```
Updating: `git pull && podman compose --profile standalone up -d --build`.
### Ports (rootless Podman)
Rootless Podman can't bind ports below 1024 by default. Pick one:
1. Allow it (simplest):
```sh
echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/90-unprivileged-ports.conf
sudo sysctl --system
```
2. Or publish high ports (`HTTP_PORT=8080`, `HTTPS_PORT=8443` in `.env`) and
redirect 80→8080 / 443→8443 in your firewall.
With rootless Podman, published ports go through `rootlessport` and are
subject to the host firewall. Rootful container networking can add its own
firewall rules around UFW, so don't rely on UFW alone if you run rootful.
## Settings
All optional. Set them in the panel's Environment tab, or in `.env` for a
standalone deploy.
| Variable | Default | Purpose |
|---|---|---|
| `MAX_PHOTO_BYTES` | `2097152` | Max size of one uploaded (encrypted) photo |
| `MAX_EVENT_BYTES` | `65536` | Max size of one encrypted event |
| `MAX_GROUP_BYTES` | `209715200` | Storage cap per group (events + photos) |
| `GROUP_CREATE_PER_HOUR` | `10` | Group creations per client IP per hour |
| `VAPID_SUBJECT` | `https://<site domain>` | Contact sent to push services |
| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | generated | Pin push keys (set both); otherwise kept in the volume as `vapid.json` |
| `PUSH_DISABLED` | `0` | `1` turns push notifications off |
| `PORT` | `8080` | Port the app listens on inside the container (the panel's domain must target it) |
| `DOMAIN` | `localhost` | Standalone only: Caddy's site address and certificate |
| `BIND_ADDR` | `0.0.0.0` | Standalone only: address Caddy's ports are published on |
| `HTTP_PORT` / `HTTPS_PORT` | `80` / `443` | Standalone only: host ports for Caddy |
Deleting `vapid.json` from the volume (or changing pinned keys) invalidates
every push subscription; people then turn notifications off and on again.
## Backups
The `oweme-data` volume holds everything (SQLite database, encrypted photos,
push keys). Its contents are end-to-end encrypted, so backups can be stored
anywhere. Standalone:
```sh
podman volume export oweme_oweme-data > oweme-data-$(date +%F).tar
```
People can also download per-group backup files in the app.
## Testing a deployment
From a machine with the repo and Node 24:
```sh
npm ci && E2E_BASE_URL=https://<domain> npx playwright test e2e/app.spec.ts
```
This creates a throwaway group on that server.