add systemd user unit so the dev server starts at boot

This commit is contained in:
Martin Dvořák 2026-09-28 20:50:07 +00:00
commit 174212750b
3 changed files with 78 additions and 3 deletions

View file

@ -112,6 +112,24 @@ those endpoints and `*.map` for any request that isn't a direct localhost connec
Localhost keeps the full dev experience; the LAN and tunnel get a plain, live-reloading
site. To force the raw server instead, use `npm run dev:next` (don't point a tunnel at it).
### Running it as a service (survives reboot)
On this host the dev server runs as a **user** systemd unit, so it comes back after a
reboot without a login (linger is enabled). The unit lives in the repo at
[`deploy/dvorakmortonxd-dev.service`](./deploy/dvorakmortonxd-dev.service):
```bash
mkdir -p ~/.config/systemd/user
cp deploy/dvorakmortonxd-dev.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now dvorakmortonxd-dev.service
loginctl enable-linger "$USER" # once, so it starts at boot
```
Manage it with `systemctl --user status|restart|stop dvorakmortonxd-dev` and follow logs with
`journalctl --user -u dvorakmortonxd-dev -f`. It shares `.next/dev/lock` with a manual
`npm run dev`, so stop the service before starting one by hand.
## 📡 API Routes
| Route | Method | What it does |
@ -153,6 +171,8 @@ src/app/
SlBackground.tsx → animated ASCII train background
scripts/
dev-server.mjs → custom dev server: live updates without the dev-only debug surface
deploy/
dvorakmortonxd-dev.service → systemd user unit so the dev server starts at boot
public/ → fonts, wallpapers, icons, friend pages, /revival-inc game, llms.txt, robots.txt, sitemap.xml
```