mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
First slice of the Android push plan ([design PR](https://github.com/block/buzz/pull/9555)). The push gateway should serve every platform from one delivery route, so the relay never learns an installation's platform (see ADR 0004 in the design PR). ### What changes - The gateway accepts deliveries at `POST /v1/deliveries`. `POST /v1/deliveries/apns` keeps working unchanged as an alias until relays have moved over. - `BUZZ_PUSH_GATEWAY_DELIVERY_URL` accepts either path. The deployment guide and NIP-PL describe `/v1/deliveries` as the route to use. `.env.example` and the compose template stay on `/v1/deliveries/apns`, because released relays (`relay-v0.3.0` and older `sha-` images) refuse to start with the new path even with push disabled, and the public gateway doesn't route it yet. A later change moves them over. - Signature binding: the gateway already verified only the method and the signed URL's path (not scheme, host or port). It compared that path to a constant. It now compares it to the route the request arrived on, so a request signed for one route is rejected on the other. Each route accepts only requests signed for its own path. - The lease `transport` value, priority classes and the delivery request body are unchanged, and nothing about the device platform reaches the relay. ### Regressions None expected. iOS keeps working: the alias route behaves exactly as before, and relays configured with the old URL keep signing and sending to it. The signed path check is equivalent on that route, since it now compares against the same path the old constant held. Rollout order matters. Don't point a relay at `/v1/deliveries` until (1) its gateway runs this change and (2) for `push.buzz.xyz`, the edge path allowlist in front of the gateway admits `/v1/deliveries`. Today that edge answers `403 RBAC: access denied` there. The relay also needs a build that includes this parser. An old gateway's 404 or the edge's 403 is a permanent failure for the relay (on a retry, it counts as replay-terminal), so those notifications are dropped, not retried. ### Validation - Gateway delivery tests are table-driven across both routes: path-not-origin binding, signed URL modifiers and non-HTTP schemes, request queries, method and path routing, and new cross-route rows (signed for `/v1/deliveries`, sent to the alias, and the reverse, both rejected). - Relay config tests cover both paths over HTTP and HTTPS, plus rejected variants (trailing slash, query, fragment, credentials, other paths, HTTPS ports). - Ran the gateway crate's tests, the relay crate's unit tests (single-threaded, because the default parallel run of the whole lib hung in untouched tests waiting on shared env locks), formatting and clippy for both crates, and the repository's pre-push checks. - Relay tests that need Postgres were not run locally. --------- Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
83 lines
3.6 KiB
Markdown
83 lines
3.6 KiB
Markdown
# Buzz Docker Compose deployment
|
|
|
|
This is the single-node/VPS deployment bundle. It is intentionally separate from
|
|
the root `docker-compose.yml`, which remains local development infrastructure.
|
|
|
|
## Quick start
|
|
|
|
```bash
|
|
cd deploy/compose
|
|
cp .env.example .env
|
|
$EDITOR .env # replace every CHANGE_ME value
|
|
./run.sh start
|
|
```
|
|
|
|
For a public VPS with automatic Let's Encrypt certificates:
|
|
|
|
```bash
|
|
cd deploy/compose
|
|
BUZZ_COMPOSE_TLS=true ./run.sh start
|
|
```
|
|
|
|
The bootstrap script should eventually replace manual `.env` editing for normal
|
|
users. It is responsible for generating stable secrets and, optionally, an owner
|
|
keypair.
|
|
|
|
## Production notes
|
|
|
|
- Requires Docker Compose v2.24.4 or newer; the TLS override uses Compose's
|
|
`!reset` tag to remove the direct relay port when Caddy terminates HTTPS.
|
|
- Default `BUZZ_IMAGE` tracks `ghcr.io/block/buzz:main` for early testing. Pin it to `ghcr.io/block/buzz:sha-<7>` or a semver release tag for production once available.
|
|
- Keep `BUZZ_RELAY_PRIVATE_KEY`, `BUZZ_GIT_HOOK_HMAC_SECRET`, database/Redis,
|
|
and S3 secrets stable across restarts.
|
|
- `RELAY_OWNER_PUBKEY` is intentionally not prefixed with `BUZZ_`; it must be a
|
|
64-character hex Nostr pubkey when closed relay mode is enabled.
|
|
- `BUZZ_AUTO_MIGRATE` is opt-in. Set `BUZZ_AUTO_MIGRATE=true` or run
|
|
`buzz-admin migrate` before starting the relay when bootstrapping a fresh
|
|
database. Auto-migration requires an image that includes embedded SQLx
|
|
migrations.
|
|
- The stack uses Postgres, Redis, MinIO, and a git data volume because
|
|
those are real Buzz dependencies today. Minimal mode can simplify this later.
|
|
- Mobile push remains off by default. To use the public gateway, keep the
|
|
template's explicit `BUZZ_PUSH_GATEWAY_DELIVERY_URL` and set
|
|
`BUZZ_PUSH_ENABLED=true`. To use another gateway, replace the exact HTTPS
|
|
`/v1/deliveries/apns` URL before enabling push. Newer gateways and relays
|
|
also accept the platform-neutral `/v1/deliveries` route; the template stays on
|
|
`/v1/deliveries/apns` until the public gateway and a relay release both
|
|
support it.
|
|
- The bundled Compose stack fixes the relay endpoint to `http://minio:9000` and
|
|
`BUZZ_S3_ADDRESSING_STYLE=path`: Docker DNS resolves `minio`, not
|
|
`<bucket>.minio`. It is not configurable for an external S3 provider through
|
|
`.env`; use the Helm chart or a custom Compose configuration for providers
|
|
such as new Railway Storage Buckets that require `virtual` addressing.
|
|
|
|
Run `./run.sh backup-hint` for the backup checklist.
|
|
|
|
Bundled object storage uses [Silo](https://silo.pgsty.com/download/), a maintained
|
|
MinIO fork, with matching `pgsty/silo` and `pgsty/mc` release images pinned by
|
|
multi-platform digest. Both images allow anonymous pulls and support Linux
|
|
amd64 and arm64; the upstream Quay MinIO images no longer allow anonymous pulls.
|
|
The existing `minio` names and `MINIO_*` settings remain compatible. Keep the
|
|
Helm and Compose pins aligned when upgrading, and run Buzz's
|
|
[object-store conformance probe](../../docs/git-on-object-storage.md#conformance-admitting-a-backend-for-a3)
|
|
against the new release before deploying it.
|
|
|
|
For an existing MinIO data volume, follow Silo's
|
|
[migration guide](https://silo.pgsty.com/compatibility/migration/) and take a
|
|
backup before upgrading. Replacing the container image upgrades the storage
|
|
server as well as changing its registry.
|
|
|
|
## Validation
|
|
|
|
Before sharing an install link publicly, verify a fresh install with:
|
|
|
|
```bash
|
|
cd deploy/compose
|
|
cp .env.example .env
|
|
$EDITOR .env
|
|
./run.sh config
|
|
./run.sh start
|
|
curl -fsS "http://127.0.0.1:$(grep -E '^BUZZ_HTTP_PORT=' .env | cut -d= -f2-)/_liveness"
|
|
./run.sh status
|
|
```
|