Add podman compose deployment, dev script and docs
Containerfile + compose (app + Caddy with automatic HTTPS), env-driven domain/limits/ports, VAPID key generation that never prints the key. SPEC updated to match the implementation (Node stdlib server, Svelte SPA, revert by event id, backup contents, push options). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
This commit is contained in:
parent
a78d855886
commit
8c4e37ce4b
9 changed files with 365 additions and 42 deletions
92
deploy/README.md
Normal file
92
deploy/README.md
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Deploying OweMe on a VPS
|
||||
|
||||
Two containers via `podman compose`: **app** (the Node server plus the built
|
||||
web client) and **caddy** (HTTPS and reverse proxy). Only Caddy publishes ports.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Podman ≥ 4 with `podman compose` (podman-compose or docker-compose as the provider)
|
||||
- A domain with an A/AAAA record pointing at the VPS
|
||||
- Ports 80 and 443 (TCP, plus UDP 443 for HTTP/3) open in the firewall
|
||||
|
||||
## First deploy
|
||||
|
||||
```sh
|
||||
git clone <repo> oweme && cd oweme/deploy
|
||||
|
||||
cp .env.example .env
|
||||
chmod 600 .env
|
||||
$EDITOR .env # set DOMAIN and VAPID_SUBJECT (mailto:)
|
||||
|
||||
podman compose build # builds localhost/oweme:latest
|
||||
# Web Push keys: written into .env, private key never printed.
|
||||
podman run --rm --user root -v ./:/out:Z localhost/oweme:latest node server/gen-vapid.ts /out/.env
|
||||
|
||||
podman compose up -d
|
||||
podman compose logs -f # Caddy obtains the certificate on first request
|
||||
```
|
||||
|
||||
Open `https://$DOMAIN`. `curl https://$DOMAIN/api/health` should say `{"ok":true}`.
|
||||
|
||||
## Updating
|
||||
|
||||
```sh
|
||||
cd oweme && git pull
|
||||
cd deploy && podman compose up -d --build
|
||||
```
|
||||
|
||||
Data lives in the `oweme-data` volume and survives rebuilds.
|
||||
|
||||
## Configuration (`deploy/.env`)
|
||||
|
||||
| Variable | Required | Default | Purpose |
|
||||
|---|---|---|---|
|
||||
| `DOMAIN` | yes | — | Public hostname; Caddy's site address and certificate |
|
||||
| `VAPID_SUBJECT` | for push | — | `mailto:` contact sent to push services |
|
||||
| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | for push | — | Generated by `gen-vapid.ts`; empty = notifications off |
|
||||
| `MAX_PHOTO_BYTES` | no | `2097152` | Max size of one uploaded (encrypted) photo |
|
||||
| `MAX_EVENT_BYTES` | no | `65536` | Max size of one encrypted event |
|
||||
| `MAX_GROUP_BYTES` | no | `209715200` | Storage cap per group (events + photos) |
|
||||
| `GROUP_CREATE_PER_HOUR` | no | `10` | Group creations per client 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 |
|
||||
|
||||
Rotating the VAPID keys (`gen-vapid.ts … --force`) silently invalidates every
|
||||
push subscription; users have to toggle notifications off and on again.
|
||||
|
||||
## 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`) and redirect
|
||||
80→8080 / 443→8443 in your firewall (e.g. nftables/UFW `nat` rules).
|
||||
|
||||
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.
|
||||
|
||||
## Backups
|
||||
|
||||
Back up the `oweme-data` volume (SQLite database + encrypted photos):
|
||||
|
||||
```sh
|
||||
podman volume export oweme_oweme-data > oweme-data-$(date +%F).tar
|
||||
```
|
||||
|
||||
Everything in it is already end-to-end encrypted, so the backup can be stored
|
||||
anywhere. Users 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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue