Deploy to n97-mini: systemd unit, nginx route, health check #5

Closed
opened 2026-06-23 05:37:08 +00:00 by sscoble · 1 comment
Owner

Why

Without deployment, nothing is real. Per the go-htmx-web-dev skill, services run as systemd user units behind nginx at os.scoble.me/<service>/.

What to do

  1. Build with the nix flake: cd ~/projects/posts && nix build && cp result/bin/posts ~/.local/bin/posts.
  2. Systemd user unit at ~/.config/systemd/user/posts.service:
    • Type=simple
    • ExecStart=/home/sscoble/.local/bin/posts
    • EnvironmentFile=/home/sscoble/.local/share/posts/secrets.env
    • Restart=always, RestartSec=5
    • WantedBy=default.target
  3. Nginx route: add "/posts/" = { proxyPass = "http://127.0.0.1:8310/"; ... }; to /etc/nixos/modules/meos-gateway.nix and nixos-rebuild switch.
  4. Health check: GET os.scoble.me/posts/api/healthz returns 200 from outside.
  5. Reverse proxy / static: the static dir is in the binary (embed.FS in v0.5); for v0 the static dir is a no-op since the API is the only thing.
  6. logs: journalctl --user -u posts -f shows clean output, no panics on startup.

Acceptance

  • systemctl --user status posts shows active (running).
  • curl https://os.scoble.me/posts/api/healthz returns 200 from any client.
  • Survives a kill -9 (systemd restarts in <5s).
  • Survives a nixos-rebuild switch (the nginx route persists).

Out of scope

  • TLS cert (handled at the gateway, not per-service)
  • Custom domain (subpath is fine)

Open questions for Scott

  • Port 8310 is what I picked from the next-free slot per the skill's port list. OK, or do you have a preference?
  • Subpath /posts/ or a subdomain like posts.os.scoble.me? Default: subpath. The Theo prompt doesn't specify, but a subpath is simpler and follows your existing convention.
  • Add to the n97-mini system flake (/etc/nixos) or keep the nginx override as a conf.d file for now? Default: conf.d for fast iteration, migrate to flake once stable.
## Why Without deployment, nothing is real. Per the `go-htmx-web-dev` skill, services run as systemd user units behind nginx at `os.scoble.me/<service>/`. ## What to do 1. **Build** with the nix flake: `cd ~/projects/posts && nix build && cp result/bin/posts ~/.local/bin/posts`. 2. **Systemd user unit** at `~/.config/systemd/user/posts.service`: - `Type=simple` - `ExecStart=/home/sscoble/.local/bin/posts` - `EnvironmentFile=/home/sscoble/.local/share/posts/secrets.env` - `Restart=always`, `RestartSec=5` - `WantedBy=default.target` 3. **Nginx route**: add `"/posts/" = { proxyPass = "http://127.0.0.1:8310/"; ... };` to `/etc/nixos/modules/meos-gateway.nix` and `nixos-rebuild switch`. 4. **Health check**: GET `os.scoble.me/posts/api/healthz` returns 200 from outside. 5. **Reverse proxy / static**: the static dir is in the binary (embed.FS in v0.5); for v0 the static dir is a no-op since the API is the only thing. 6. **logs**: `journalctl --user -u posts -f` shows clean output, no panics on startup. ## Acceptance - `systemctl --user status posts` shows `active (running)`. - `curl https://os.scoble.me/posts/api/healthz` returns 200 from any client. - Survives a `kill -9` (systemd restarts in <5s). - Survives a `nixos-rebuild switch` (the nginx route persists). ## Out of scope - TLS cert (handled at the gateway, not per-service) - Custom domain (subpath is fine) ## Open questions for Scott - **Port 8310 is what I picked from the next-free slot per the skill's port list. OK, or do you have a preference?** - **Subpath `/posts/` or a subdomain like `posts.os.scoble.me`?** Default: subpath. The Theo prompt doesn't specify, but a subpath is simpler and follows your existing convention. - **Add to the `n97-mini` system flake (`/etc/nixos`) or keep the nginx override as a conf.d file for now?** Default: conf.d for fast iteration, migrate to flake once stable.
sscoble added the
area/ops
kind/feature
prio/p0
labels 2026-06-23 05:37:08 +00:00

Closed — deployment already live ✅

Verified at c2325: systemd user unit active (22h uptime), port 8310, healthz returns 200. Restart=always configured. Closed by ticket dispatch system at cycle c2325.

## Closed — deployment already live ✅ Verified at c2325: systemd user unit active (22h uptime), port 8310, healthz returns 200. Restart=always configured. Closed by ticket dispatch system at cycle c2325.
Sign in to join this conversation.
No description provided.