Events: everything the backend serves is under /api (for 2.3.0)
The site and its API can share one address with one proxy rule (/api to the backend, everything else to the frontend). Status page at /api (/ redirects), /api/health, /api/docs/v2, /api/uploads. Stored upload paths stay /uploads/… and are given out as /api/uploads/…. Old paths still answer (/health, /uploads) or redirect (/docs, /docs/v2), so two-address sites keep working. DEPLOYMENT.md and the agent plan describe the single rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,27 @@ visitor ──http───▶ frps (vhost_http_port) ══tunnel══▶ frp
|
||||
On this server, nginx sends `/api`, `/uploads`, `/health` and `/docs` to the backend (port 5000)
|
||||
and everything else to the Next.js site (port 3000), the same as a normal install.
|
||||
|
||||
### One address, one rule (2.3.0 and later)
|
||||
|
||||
From 2.3.0 everything the backend serves is under **`/api`**: the API (`/api/v2`), the status page
|
||||
(`/api`), health (`/api/health`), the API reference (`/api/docs/v2`) and uploaded files
|
||||
(`/api/uploads/…`). So the site and its API share one address (`events.yourchurch.org`, no
|
||||
separate `events-api.` record), and a web server or panel such as FastPanel needs a single
|
||||
rule:
|
||||
|
||||
| Path | Goes to |
|
||||
|------|---------|
|
||||
| `/api` and everything under it | the backend, `http://127.0.0.1:5000` |
|
||||
| everything else | the frontend, `http://127.0.0.1:3000` |
|
||||
|
||||
Set `BACKEND_URL` (backend `.env`) and `NEXT_PUBLIC_API_URL` (frontend `.env.production`) to the
|
||||
same `https://` address as `FRONTEND_URL`, then rebuild the frontend. The old paths (`/health`,
|
||||
`/docs/v2`, `/uploads/…`) still answer on the backend's port, so a site with a separate API
|
||||
address keeps working unchanged. With only `/api` routed, links made before 2.3.0 that point at
|
||||
`https://<site>/uploads/…` stop working (they aren't stored that way, but could be in an old
|
||||
email); keep the four-path rule above if that matters. Pictures, logos and attachments are all
|
||||
given out as `/api/uploads/…` from 2.3.0.
|
||||
|
||||
## 2. Before you start
|
||||
|
||||
- Ubuntu 22.04 or 24.04 on this server, with `frpc` already installed and connected (it runs as
|
||||
@@ -264,7 +285,7 @@ setup). If the `[hope-events-https]` section fails to start, check `journalctl -
|
||||
|
||||
## 6. Finish in the browser
|
||||
|
||||
1. Open `https://events.yourchurch.org/health` — it should answer with the version.
|
||||
1. Open `https://events.yourchurch.org/api/health` (`/health` before 2.3.0) — it should answer with the version.
|
||||
2. Open `https://events.yourchurch.org/setup`: create the admin account.
|
||||
3. **Site settings → Licence**: enter the licence key to connect to the Hub. The site checks in
|
||||
every 15 minutes from then on (outgoing HTTPS to `events-hub.crosscode.co.za`, which frp
|
||||
|
||||
Reference in New Issue
Block a user