run the dev server as a system-wide systemd unit (boots without login/linger)
This commit is contained in:
parent
174212750b
commit
bfa0840b0e
4 changed files with 119 additions and 20 deletions
32
README.md
32
README.md
|
|
@ -114,9 +114,24 @@ site. To force the raw server instead, use `npm run dev:next` (don't point a tun
|
|||
|
||||
### 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):
|
||||
On this host the dev server runs as a **system** systemd unit, so it starts at boot on
|
||||
its own — no login or linger needed. The unit lives in the repo at
|
||||
[`deploy/dvorakmortonxd-dev.system.service`](./deploy/dvorakmortonxd-dev.system.service):
|
||||
|
||||
```bash
|
||||
# installs /etc/systemd/system/dvorakmortonxd-dev.service and enables it
|
||||
sudo bash deploy/install-system-service.sh # or: doas bash deploy/install-system-service.sh
|
||||
```
|
||||
|
||||
Manage it with `systemctl status|restart|stop dvorakmortonxd-dev` and follow logs with
|
||||
`journalctl -u dvorakmortonxd-dev -f`. It shares `.next/dev/lock` with a manual
|
||||
`npm run dev`, so stop the service before starting one by hand.
|
||||
|
||||
<details>
|
||||
<summary>No root? Use the per-user unit instead</summary>
|
||||
|
||||
[`deploy/dvorakmortonxd-dev.service`](./deploy/dvorakmortonxd-dev.service) is an equivalent
|
||||
**user** unit you can install without root:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/systemd/user
|
||||
|
|
@ -126,9 +141,10 @@ 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.
|
||||
Drive it with `systemctl --user …` and `journalctl --user -u …`. Run only one of the two —
|
||||
they contend for `:3000` and `.next/dev/lock`.
|
||||
|
||||
</details>
|
||||
|
||||
## 📡 API Routes
|
||||
|
||||
|
|
@ -172,7 +188,9 @@ src/app/
|
|||
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
|
||||
dvorakmortonxd-dev.system.service → systemd unit (system-wide) so the dev server starts at boot
|
||||
dvorakmortonxd-dev.service → equivalent per-user unit (no root; needs linger)
|
||||
install-system-service.sh → installs the system unit (run with sudo/doas)
|
||||
public/ → fonts, wallpapers, icons, friend pages, /revival-inc game, llms.txt, robots.txt, sitemap.xml
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue