Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

#409

Install and run Vole as a Windows service

closed · opened by keenan 2d ago

keenan opened this 2d ago

Install and run Vole as a Windows service

What

A Windows forge has to start without a person logged in, survive a reboot, and stop cleanly when Windows shuts down. Today vole serve is a console process: on the Server Core guest it runs from a scheduled task because a process started from an SSH session is killed with that session (Windows puts each session in a job object), and nothing tells the SCM what state it is in.

This issue is the service half. Packaging is #408.

Decisions

  • The binary speaks the SCM itself. golang.org/x/sys/windows/svc is already in the module graph, so serve can dispatch through svc.Run when svc.IsWindowsService() is true and stay a console program otherwise — systemd/launchd parity with no wrapper. NSSM or WinSW would add a second executable and an opaque layer; a scheduled task has no recovery, dependency, or stop semantics.
  • The default identity is the virtual account NT SERVICE\Vole, named after the service. No password to store or rotate, least privilege, and it is the “process user” the access-list check in internal/secure already trusts alongside SYSTEM and Administrators. Not LocalSystem: a network-facing forge as SYSTEM is the Windows version of running the Linux package as root. --account stays open for managed deployments.
  • Install, remove, start, stop, and status are CLI verbs, so a zip or hand-built install works without an MSI, and the MSI can call the same commands rather than keeping a second definition of the service.
  • Logs go to a file, because a service has no stderr. The install command writes --log-file into the service command line, defaulting to <data_dir>/logs/serve.log, and lifecycle or fatal errors also go to the Application event log so a failed start is diagnosable.
  • The installer does not open the firewall, matching the Linux package not touching /etc/ssh. The deploy page prints the rules.
  • The supported SSH mode on Windows is the built-in listener (ssh_listen = "tcp", the default). The portless sshd arrangement is still unix-shaped (#406).

Scope

  1. serve --log-file <path>: a file sink for the logger, opened through internal/secure so the log is not readable by everyone; stderr remains the default for a console run.
  2. SCM dispatch in serve: StartPending → Running (accept Stop|Shutdown), Stop/Shutdown cancels the context serve already builds, reports StopPending while runners drain, then Stopped. A server that exits on its own exits nonzero so recovery actions fire.
  3. vole service install|uninstall|start|stop|status:
    • install: requires an elevated process; creates the service as NT SERVICE\<name> with auto (delayed) start, description, recovery (restart ×3), and a restricted service SID; prepares the data directory and the config file’s access list for that SID; installs the event-log source.
    • uninstall: stops a running service, deletes it, leaves the data directory and says where it is.
    • start/stop: await the state instead of returning at the control call.
    • On non-Windows, the command exists and answers that services are a Windows concept, so the generated reference is the same everywhere.
  4. An exported Windows-only helper in internal/secure to write a protected access list naming a given set of SIDs, for the installer that prepares a directory for an account that is not the current process; the runtime verification is unchanged.
  5. docs/deploy/windows.md: install from a release binary, vole service install, firewall rules, ssh_listen = "tcp", what is not supported (runner, sshd front door), and the lack of Authenticode signing (#408).

Acceptance criteria

  • On the Server Core guest: vole service install --config … creates and starts the service; status reports running; the log file exists with a restricted ACL; stop drains and stops; uninstall removes the service and leaves the data directory; a VM reboot brings the forge back without logging in.
  • Startup failures (invalid config, busy port) are visible in the event log and the service exits nonzero.
  • Unix behaviour is unchanged: serve still stops on interrupt, and the mode table and generated reference still pass vole workflow check and the cli reference step.
  • VOLE_INSECURE_HOST_KEY-free verification on the guest: HTTP, admin CLI over SSH, and a git push.

Out of scope

The MSI, install.ps1, Authenticode signing, winget, and the CI runner on Windows.

Comments (0)

No comments yet.