Operating Svelte Chat is one systemd unit, one loopback port, one symlink swap, and one nginx site file; this wiki is a separate static root built by the shared Quartz grid.
Runtime topology
| Layer | Live configuration | Operational meaning |
|---|---|---|
| Unit | chat.service, system scope, User=loca, hardened like the other loca.zone Node units | systemctl status chat is the health check |
| Listener | 127.0.0.1:51919 | inside the loca.zone 51000–53000 backend convention; never exposed directly |
| Entry | /usr/bin/node build/index.js in ~/dev/svelte-chat | build is a symlink to a timestamped build-<UTC ts> directory |
| Data | DATA_DIR=~/chat | rooms/<slug>/events.jsonl and room.json; back up by copying |
| Assistant env | /etc/chat/chat.env (EnvironmentFile, root-owned 0640) | absent by default; see [[setup#Assistant environment |
| Edge | nginx site chat.loca.zone with one Let’s Encrypt certificate covering chat.loca.zone and wiki.chat.loca.zone | proxy for the app, static root for this wiki |
Deploy and roll back
scripts/deploy.sh in the project runs npm ci && npm run build into build-tmp, renames it to build-<UTC ts>, repoints the build symlink and restarts the unit. Previous builds stay on disk with their timestamps, so rolling back never rebuilds:
ln -sfn build-<older-ts> build && sudo systemctl restart chatStatus checks
| Check | Command or URL | Expect |
|---|---|---|
| Unit | systemctl is-active chat | active |
| App shell | https://chat.loca.zone/ | HTTP 200, title Chat · loca.zone |
| Facts | https://chat.loca.zone/api/status | { assistant: { configured, model }, rooms } |
| Wiki | https://wiki.chat.loca.zone/ | HTTP 200, title Svelte Chat |
Assistant status
The deployed instance runs with the assistant unconfigured: no key-free OpenAI-compatible model exists on this host and credentials are never copied between services. Enabling it means creating /etc/chat/chat.env with the variables from Assistant environment and restarting the unit; nothing else changes.
Wiki build
Content lives in ~/dev/wikis/chat/content, configuration in ~/dev/wikis/chat/quartz.config.yaml. Build with the shared grid script, which swaps the current symlink atomically and keeps the last five builds:
~/dev/wikis/build.sh chatnginx serves ~/dev/wikis/chat/current for wiki.chat.loca.zone. Never edit the shared Quartz engine for a per-wiki change; the script copies this wiki’s config in and restores the engine state afterwards.
Related
- Architecture for what the routes do.
- Setup for local builds.