handoff pass: vendored sveltia bundle, astro pinned ^7.2.10, root README + refreshed deploy runbook, review fixes (coverless card grid, shared NewsCard/lib, real site origin, nginx security headers, linger step, dead config removed, preview.css sync, tsconfig)
This commit is contained in:
+54
-39
@@ -11,62 +11,68 @@ Uninstall restores the machine exactly (see bottom). No secrets in any file.
|
||||
├── repo/ # clone of the portal repo (created by first build)
|
||||
├── releases/ # <sha>/ dirs + `current` symlink (what nginx serves)
|
||||
├── state/ # last-built SHA
|
||||
├── npm-cache/ # npm cache for the build container (created by build.sh)
|
||||
├── bin/build.sh # copied from deploy/ (source of truth stays in the repo)
|
||||
└── config/nginx.conf
|
||||
```
|
||||
|
||||
| Port | What | Exposed how |
|
||||
Host prerequisites: `podman`, `curl`, `jq` (build.sh checks and says which is
|
||||
missing). Everything else runs inside containers.
|
||||
|
||||
| Port | What | Exposed as |
|
||||
|---|---|---|
|
||||
| 3000 | Gitea | ingress vhost (TODO: ask Hubert) |
|
||||
| 8080 | portal (nginx, static) | ingress vhost (TODO: ask Hubert) |
|
||||
| 3000 | Gitea | https://astro-git.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
||||
| 8080 | portal (nginx, static) | https://astro.isl-dev.grid.cyfronet.pl (ingress vhost) |
|
||||
|
||||
## Install (each step reviewed before running; [W] = writes to the machine)
|
||||
|
||||
1. **[W]** `mkdir -p ~/ctao-portal-demo/{gitea-data,gitea-config,releases,state,bin,config} ~/.config/containers/systemd ~/.config/systemd/user`
|
||||
2. **[W]** Copy files from this dir (scp from the Mac):
|
||||
1. **[W]** `loginctl enable-linger $USER` — without lingering every user unit
|
||||
dies at logout and nothing starts after a reboot. Verify:
|
||||
`loginctl show-user $USER -p Linger` → `Linger=yes`.
|
||||
2. **[W]** `mkdir -p ~/ctao-portal-demo/{gitea-data,gitea-config,releases,state,bin,config} ~/.config/containers/systemd ~/.config/systemd/user`
|
||||
3. **[W]** Copy files from this dir (scp):
|
||||
- `ctao-demo-gitea.container`, `ctao-demo-web.container` → `~/.config/containers/systemd/`
|
||||
- `ctao-portal-build.service`, `ctao-portal-build.timer` → `~/.config/systemd/user/`
|
||||
- `build.sh` → `~/ctao-portal-demo/bin/` (`chmod +x`)
|
||||
- `nginx.conf` → `~/ctao-portal-demo/config/`
|
||||
3. **[W]** Pull + pin images (one-time, needs internet):
|
||||
`podman pull docker.io/gitea/gitea:1.27-rootless docker.io/library/nginx:stable-alpine docker.io/library/node:24-alpine`
|
||||
- `Containerfile.build` → anywhere (needed once, for the next step)
|
||||
4. **[W]** Pull the images at the digests pinned in the unit files (one-time,
|
||||
needs internet) and build the build image:
|
||||
`podman pull docker.io/gitea/gitea@sha256:<digest from ctao-demo-gitea.container>`
|
||||
`podman pull docker.io/library/nginx@sha256:<digest from ctao-demo-web.container>`
|
||||
`podman build -t localhost/ctao-portal-build:1 -f Containerfile.build .`
|
||||
Then `podman images --digests` → paste the sha256 digests into both `.container` files.
|
||||
4. **[W]** `systemctl --user daemon-reload && systemctl --user start ctao-demo-gitea`
|
||||
5. **[W]** Create the Gitea admin — run YOURSELF in your own terminal (password
|
||||
is prompted/printed there only; never goes through chat or shell history):
|
||||
(Upgrading later = pick new digests deliberately, update the pins in the
|
||||
`.container` files / `Containerfile.build`, re-pull, re-build.)
|
||||
5. **[W]** `systemctl --user daemon-reload && systemctl --user start ctao-demo-gitea`
|
||||
6. **[W]** Create the Gitea admin — run interactively in a terminal so the
|
||||
password never lands in a file or shell history:
|
||||
`podman exec -it ctao-demo-gitea gitea admin user create --admin --username <you> --email <you@…> --random-password`
|
||||
6. **[W]** In the Gitea UI: create org `ctao`, repo `portal` (public read).
|
||||
Push from the Mac through an SSH port-forward:
|
||||
`ssh -L 3300:localhost:3000 strapi-experimental.cyfronet` then
|
||||
`git remote add machine http://localhost:3300/ctao/portal.git && git push machine main`
|
||||
7. **[W]** `systemctl --user enable --now ctao-portal-build.timer` — first run
|
||||
7. **[W]** In the Gitea UI: create org `ctao`, repo `portal` (public read).
|
||||
Then, from your workstation, push the portal repo over the vhost with a
|
||||
repo-scoped token:
|
||||
`git push https://<user>:<token>@astro-git.isl-dev.grid.cyfronet.pl/ctao/portal.git main`
|
||||
8. **[W]** `systemctl --user enable --now ctao-portal-build.timer` — first run
|
||||
clones + `npm ci` + builds (minutes); later runs are seconds. Wait until
|
||||
`journalctl --user -u ctao-portal-build -n 5` shows `published <sha>`
|
||||
(starting nginx earlier just serves 404s until the first build lands).
|
||||
8. **[W]** `systemctl --user start ctao-demo-web`
|
||||
9. **[R]** Verify: `curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/`
|
||||
9. **[W]** `systemctl --user start ctao-demo-web`
|
||||
10. **[R]** Verify: `curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/`
|
||||
and `journalctl --user -u ctao-portal-build -n 20` (shows measured build times).
|
||||
|
||||
## After Hubert assigns the vhosts
|
||||
## CMS sign-in (Sveltia ↔ Gitea OAuth)
|
||||
|
||||
1. Replace both `TODO(vhost)` values in `ctao-demo-gitea.container`
|
||||
(ROOT_URL → gitea vhost, CORS `*` → portal origin, add
|
||||
`GITEA__cors__SCHEME=https`); `systemctl --user daemon-reload && systemctl --user restart ctao-demo-gitea`.
|
||||
2. In Gitea UI: Settings → Applications → new OAuth2 app for Sveltia
|
||||
(redirect: `https://<portal-vhost>/admin/`), PKCE, no client secret.
|
||||
3. Put the Gitea vhost URL + client id into `public/admin/config.yml` in the
|
||||
portal repo, commit, push — the timer publishes it like any other change.
|
||||
- Gitea OAuth2 app (PKCE, `confidential_client=false`, no secret) with
|
||||
redirect `https://astro.isl-dev.grid.cyfronet.pl/admin/`; its client id is
|
||||
the `app_id` in `public/admin/config.yml`.
|
||||
- CORS is pinned in `ctao-demo-gitea.container`: `ALLOW_DOMAIN` takes the
|
||||
FULL portal origin with scheme (a bare hostname silently disables CORS in
|
||||
Gitea 1.27; there is no `SCHEME` key) and `HEADERS` must include
|
||||
`Authorization` or authenticated API calls from the browser fail.
|
||||
- OAuth requires a secure context: the vhosts must stay HTTPS.
|
||||
- Changing origins later = edit the quadlet env + the OAuth app's redirect
|
||||
URI + `config.yml`, then `systemctl --user daemon-reload && systemctl --user restart ctao-demo-gitea`.
|
||||
|
||||
## Ask Hubert (one message)
|
||||
|
||||
1. Two ingress vhosts → `192.168.10.15:8080` (portal) and `:3000` (gitea) —
|
||||
same mechanism as `strapi.isl-dev…:1337`.
|
||||
2. Are vhosts public-internet or VPN-scopable? (Gitea preferably VPN-only.)
|
||||
3. Does Cyfronet offer static-file hosting on the ingress itself? If yes, we
|
||||
drop our nginx container entirely and rsync builds there instead.
|
||||
|
||||
## Uninstall (leaves zero traces)
|
||||
## Uninstall (leaves only podman's own storage metadata)
|
||||
|
||||
```
|
||||
systemctl --user disable --now ctao-portal-build.timer
|
||||
@@ -74,14 +80,22 @@ systemctl --user stop ctao-demo-web ctao-demo-gitea
|
||||
rm ~/.config/containers/systemd/ctao-demo-*.container \
|
||||
~/.config/systemd/user/ctao-portal-build.{service,timer}
|
||||
systemctl --user daemon-reload
|
||||
podman rmi localhost/ctao-portal-build:1 docker.io/gitea/gitea:1.27-rootless docker.io/library/nginx:stable-alpine
|
||||
podman rmi localhost/ctao-portal-build:1 docker.io/gitea/gitea:1.27-rootless \
|
||||
docker.io/library/nginx:stable-alpine docker.io/library/node:24-alpine
|
||||
rm -rf ~/ctao-portal-demo
|
||||
loginctl disable-linger $USER # only if nothing else of yours should survive logout
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Publish latency = poll (≤10 s) + build (measured 1 s on M-series; expect
|
||||
4–8 s on the 2 vCPU VM — every build's time lands in the journal).
|
||||
- **Only site content auto-deploys.** Changes to `deploy/*` need a manual
|
||||
re-copy: `build.sh` → `bin/`, `nginx.conf` → `config/` +
|
||||
`systemctl --user restart ctao-demo-web`, unit files →
|
||||
`~/.config/…` + `systemctl --user daemon-reload` (+ restart). This is
|
||||
deliberate: the build pipeline must not execute host-side code straight
|
||||
from the content repo.
|
||||
- Publish latency = poll (≤10 s) + build (measured: astro build 5–7 s on the
|
||||
2 vCPU VM, whole build.sh 16–21 s; every build's time lands in the journal).
|
||||
- Internet needed only for: image pulls (install) and `npm ci` when the
|
||||
lockfile changes. Routine rebuilds are fully offline.
|
||||
- Memory caps (`MemoryHigh`) keep us polite next to Outline + Strapi;
|
||||
@@ -93,4 +107,5 @@ rm -rf ~/ctao-portal-demo
|
||||
Gitea on localhost:3000 but cannot reach host loopback services. (Rootless
|
||||
netavark bridges don't work here: no `ip_tables` kernel module, no sudo.)
|
||||
- Secrets inventory: Gitea admin password (typed interactively, lives only
|
||||
in Gitea's DB) — that's the complete list. Build/poll/serve use none.
|
||||
in Gitea's DB) and repo-scoped push tokens (managed in Gitea) — that's the
|
||||
complete list. Build/poll/serve use none.
|
||||
|
||||
Reference in New Issue
Block a user