ci(demo): deploy main to a public demo on every push #1
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/demo-deploy"
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?
Summary
Adds continuous deployment of
mainto a public demo instance, which holds only dummy data. The demo shares a host with a real koto, so it runs as a separate user with rootless Docker. If a deploy is compromised, the damage stays inside that user.The front Traefik passes the demo's hostnames through by SNI without decrypting them. The demo's own Traefik terminates TLS and obtains its own certificates, exactly as in
docs/traefik, so every deploy also checks that the documented setup works.Changes
.forgejo/workflows/deploy-demo.yml: runs on every push tomain, or on demand, on a runner labelledkoto-demo. It checks out the pushed commit in the demo's checkout and runsdeploy.sh. The job is skipped unless the repository variableDEMO_DIRis set, so forks and other installs never queue a job that no runner will pick up.scripts/deploy.sh: applies the current checkout to the running stack. It re-renders the config, pulls images, rebuilds and starts the stack, waits for Synapse to become healthy, then runscheck.sh. Whenhomeserver.yamlchanged, it stops Synapse before starting the stack, rather than restarting it afterwards, so it never interrupts Synapse while Synapse creates or migrates its database. Images are pulled before anything is stopped, so a failed pull leaves the running stack untouched. It is not specific to the demo and works as a one-command upgrade aftergit pull.docs/traefik: the host ports are configurable throughHTTP_PUBLISHandHTTPS_PUBLISH. The default is still 80 and 443. The README documents running behind a front proxy and explains which address to publish on.docs/demo.md: host runbook covering:A companion change to the front proxy (koto-edge) is committed there, not in this PR. It adds a file provider for the passthrough route, and
allowacmebypasson thewebsecureentrypoint so that the demo's TLS-ALPN challenges reach the demo's Traefik.Verified on the host
gvisor-tap-vsockcannot reach the host's loopback, even with host loopback allowed)allowacmebypassis set on the front Traefikgit fetchwithgithub.tokenandvarsinif:work on this Forgejocheck.shpasses (tested with a temporary branch trigger, since removed)Lessons recorded in
docs/demo.mdv(v1.162.0); pinSYNAPSE_VERSION, since database upgrades cannot be undone.PATHthat reachesdocker, its CLI plugins andgit, because host-label jobs run in that environment.Security
Any workflow in this repository can request the
koto-demolabel, including one added in a pull request. Treat everything thekoto-demouser owns as exposed:Follow-ups
init.shtells you to restart Synapse even whendeploy.shruns it and already handles that.check.shreports "federation must be closed" asokeven when it cannot connect at all.