Split: the frontend in its own container behind Caddy #203
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of splitting ipx into a directory service, a backend and a frontend (see the tracking issue).
The frontend becomes its own package and container, deployed without rebuilding Rust.
web/gets its own package.json and buildsdist/;build.rsand theinclude_str!pages leave the backend.ipx-web: Caddy servesdist/and proxies/api,/api/events(SSE) and/mediatoipx:8099. One origin, so cookies, SSE and Cloudflare Access keep working.trusted_proxiestakes Caddy's address, and Caddy passes theCf-Access-*headers through; the Access JWT is still checked.app.js/app.cssnames stay, servedimmutable; the pagesno-cache./loginitself on a 401.with_theme); it moves to the client, read before first paint, so there is no flash of the wrong theme.admin.htmlbecomes public markup. Every admin action is already checked in its handler (403), so this exposes layout, not access.Built on the branch
frontend-container(de6b0a4), not merged or deployed: the production switch changes how sign-in through the tunnel is trusted, so it waits for your go-ahead.What it does:
web/build.mjsbuilds a static site,web/dist;Dockerfile.webserves it with Caddy (web/Caddyfile), passing/apiand/mediato ipx on the same origin. ipx serves no page: build.rs and theinclude_str!s are gone, and ipx's image builds without node.forward_auth):/api/page-check(signed out →/login; not an admin → away from/admin, 403 for/admin.js),/api/login-check(Access-vouched → past the form),/api/signinfor?token=links.web/boot.jsin<head>sets the theme from its cookie and an admin's link from the last visit before the first frame;/api/megives the version and the account's theme from before. A non-admin's page now has the Admin link in it, hidden; it gives nothing away, since the page and API are what guard it.Cf-Access-*headers from every peer butTUNNEL_PEER.Cutover plan (about a minute of downtime, nothing changes at Cloudflare):
ipxandipx-web./mnt/fast/arcane/projects/ipx/compose.yaml: addipx-web(ports: 8099:8080, pinnedipv4_address: 192.168.64.10on the default network,IPX_UPSTREAM: ipx:8099,TUNNEL_PEER: 192.168.64.1), and drop ipx's8099:8099so the LAN address and the tunnel reach Caddy.trusted_proxiesin config.toml:192.168.64.1→192.168.64.10(Caddy).up -d ipx ipx-web; check the LAN address, a private window throughipodderx.sdf1.net(Authentik, then signed in as you), and the phone.Rollback: restore the two files from
*.bak-pre-ipx-web,up -d ipx.Merging: this and
directory-client(#205) both branch from main and touch web.rs and dialogs.ts; whichever goes second gets rebased.Merged as
f987093(rebased onto #205) and cut over as planned: ipx-web on 192.168.64.10 publishes 8099, ipx publishes no web port, trusted_proxies is 192.168.64.10, backups as *.bak-pre-ipx-web. Checked: a signed-out browser goes to /login, the API token works through Caddy, the tunnel still sends to Access, and a forged Access token from cloudflared's network reaches ipx's check and is refused for its signature (from Tower itself Caddy strips it, as it should; #209). Docs and the prod-check skill in3bab621.