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.

Package Windows: an MSI built with wixl, and install.ps1

31560d91c4e27f3fdee2652aa3b4b12b8343903d · Keenan Nemetz · 2d ago · parent 9cbfa891

Package Windows: an MSI built with wixl, and install.ps1

The Windows server installs from an MSI now, with install.ps1 on the channel as
the one-command path, the same shape as the Linux installer.

The MSI is built by wixl (msitools), not the WiX toolset. WiX v5 and v6 refuse to
build outside Windows: every relative path is canonicalized against a hardcoded
C:\ and the first Directory is rejected, so it cannot run in the release image. I
tested both before choosing; wixl 0.101 is what Debian bookworm ships and it
produces a package that installs, upgrades, and uninstalls on the Server Core
guest. Its limits shaped the design and are recorded in the .wxs header: it
silently drops Component/@Permanent and @NeverOverwrite, cannot edit PATH, and
cannot schedule rollback actions, so the configuration and the data directory
belong to `vole service install` and not to the package.

That moved two things into the CLI. `service install` now writes a documented
default configuration to %ProgramData%\Vole\vole.toml when it is given none, and
initializes the instance database and repository like the Linux post-install
step, so the package's only action is the binary registering itself. The same
command serves a hand install and a pre-release, which has no MSI.

The MSI's upgrade table is written by hand because wixl's MajorUpgrade schedules
RemoveExistingProducts in the window Windows Installer rejects (error 2613).
RemoveExistingProducts is placed at 1501, the service's stop-and-remove at 3400,
and install-and-start after InstallFiles, so an upgrade removes the old product
before the new files land and the running executable is never locked.

Fixed along the way, found by installing the MSI: secure.HardenFor accepted an
access list that was a subset of what it was asked to grant, so a configuration
written by SYSTEM looked correct and never got the service account's entry; the
service then could not read it and failed to start. HardenFor now requires every
requested principal to be present, with a Windows test for the subset case.

Release and verify wiring: both images gain wixl and msitools, verify builds the
MSI and reads its tables back (wixl exits 0 when a source is missing), and the
release builds the Windows binary and, for a stable tag, the MSI, and publishes
install.ps1 beside install.sh. A pre-release tag has no MSI: ProductVersion
cannot carry a pre-release suffix and wixl cannot express the same-version
upgrade, so those releases ship the binary and install.ps1 says so.

Docs: install.md gains the Windows method, packaging.md the Windows package and
its limits, deploying windows.md the packaged flow (install, configure, first
admin, firewall, upgrade, binary fallback, troubleshooting), and RELEASING.md
the Windows sign-off a Linux runner cannot perform.

Verified on the Server Core 2022 guest: MSI install starts the service and serves
HTTP 200, with the config created at the documented default and the data kept;
0.2.1 upgrades over 0.2.0 with one Programs-and-Features entry and the service
running; uninstall removes the service and the binary and leaves the config,
data, and a marker file; install.ps1 installs from a local mirror after checking
SHA256SUMS; reinstall and uninstall are repeatable. Windows unit tests pass
there, and `vole workflow run verify` passes locally including the new package
step.

Part of 01M8SE6GWX1DGYPY6H9YC142C2.

docs/deploy/windows.md +117−96

@@ -1,111 +1,104 @@
1 1 # Deploy Vole on Windows
2 2
3 3 Windows support covers the forge server and the CLI client, not the CI runner.
4 There is no installer or package yet
5 ([#408](https://rodent.software/vole/n/408) tracks that), so this page installs
6 a release binary by hand and registers it as a Windows service. Everything that needs an elevated prompt is
7 marked; a Server Core machine is enough.
8
9 Authenticode signing does not exist yet, so Windows will warn about an unknown
10 publisher the first time the binary runs. Verify the download against the
11 release's GPG-signed `SHA256SUMS` instead of trusting the prompt.
4 The release publishes an MSI and an `install.ps1` that downloads it. The MSI is
5 not Authenticode-signed yet, so Windows shows an unknown-publisher prompt: check
6 the download against the release's GPG-signed `SHA256SUMS` instead of trusting
7 the prompt. Authenticode and winget are tracked in
8 [#408](https://rodent.software/vole/n/408).
12 9
13 10 ## What you need
14 11
15 - Windows Server 2019 or later, or Windows 10/11 for a laptop forge, `amd64`.
12 - Windows Server 2019 or later, or Windows 10/11, `amd64`.
16 13 - **Git for Windows** with `git.exe` on the machine `PATH`. The server shells out
17 to git for every push, clone, and metadata write; nothing works without it.
18 - The `vole.exe` binary. Until packages exist, build it from the release tag or
19 this checkout:
20
21 ```sh
22 GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o vole.exe ./cmd/vole
23 ```
24
14 to git for every push, clone, and metadata write, and the install initializes
15 the instance, so nothing works without it.
25 16 - A DNS name such as `forge.example.com` if you want HTTPS.
26 - An elevated PowerShell for the install and the service commands.
17 - An elevated PowerShell.
27 18
28 ## 1. Put the binary in place
19 ## 1. Install the package
20
21 Run the install script from an elevated PowerShell:
29 22
30 23 ```powershell
31 New-Item -ItemType Directory -Force 'C:\Program Files\Vole' | Out-Null
32 Copy-Item .\vole.exe 'C:\Program Files\Vole\vole.exe'
33 & 'C:\Program Files\Vole\vole.exe' version
24 Invoke-WebRequest https://rodent.software/vole/channels/stable/install.ps1 -OutFile install.ps1
25 .\install.ps1
34 26 ```
35 27
36 The service command line uses absolute paths, so nothing has to be added to
37 `PATH`. Add `C:\Program Files\Vole` to it if you want to type `vole` yourself.
28 `-Version v0.2.0` installs a pinned release, `-Channel` follows another channel,
29 and `-DryRun` prints the plan without changing anything. To install the MSI
30 directly, download `vole-windows-amd64.msi` from the
31 [stable channel](https://rodent.software/vole/channels/stable) and run it with
32 `msiexec /i`.
33
34 The installer does the part a service needs:
35
36 | What | Where |
37 |---|---|
38 | Binary | `C:\Program Files\Vole\vole.exe`, with `LICENSE` and `NOTICE` beside it |
39 | Service | `Vole`, running as the virtual account `NT SERVICE\Vole` |
40 | Configuration | `%ProgramData%\Vole\vole.toml`, written with a documented default when absent |
41 | Data | the `data_dir` that configuration names, `%ProgramData%\Vole\data` by default |
42 | Log | `<data_dir>\logs\serve.log` |
43 | Event Log | source `Vole` in the Application log, for start and stop failures |
44
45 It registers the service to start automatically after a short delay, creates the
46 instance database and instance repository if they are not there, gives the
47 service account access to the data, log, and configuration, and starts the
48 service. It does not create an administrator: who administers the instance is
49 your decision, not the package's.
50
51 The configuration and the data are not package files. Uninstalling removes the
52 service and the binary and leaves both in place.
38 53
39 ## 2. Write the configuration
54 ## 2. Configure
40 55
41 `vole service install` requires every path in the configuration to be absolute:
42 a service starts in `%SystemRoot%\System32`, not in the directory you installed
43 from, so `data_dir = "./data"` would land somewhere nobody meant.
56 Edit `%ProgramData%\Vole\vole.toml` and restart the service:
44 57
45 58 ```powershell
46 New-Item -ItemType Directory -Force 'C:\ProgramData\Vole' | Out-Null
47 @'
59 & "C:\Program Files\Vole\vole.exe" service stop
60 notepad "$env:ProgramData\Vole\vole.toml"
61 & "C:\Program Files\Vole\vole.exe" service start
62 ```
63
64 The default serves `http://127.0.0.1:8080` and SSH on `0.0.0.0:2222`. To serve
65 the forge itself, set `public_url` and `https_addr`:
66
67 ```toml
48 68 data_dir = 'C:\ProgramData\Vole\data'
49 69 http_addr = ":80"
50 70 https_addr = ":443"
51 71 public_url = "https://forge.example.com"
52 72 acme_email = "you@example.com"
53 73 ssh_addr = "0.0.0.0:2222"
54 '@ | Set-Content 'C:\ProgramData\Vole\vole.toml'
55 74 ```
56 75
57 76 Windows has no privileged ports, so binding 80 and 443 needs no capability
58 change. Leave `ssh_listen` at its default `"tcp"`: the sshd front door is
59 unix-only for now, and clone URLs therefore carry `:2222`. Portless clone URLs
60 need that work first.
77 change. ACME needs the DNS name to resolve to this machine and port 80 reachable
78 from the internet. Leave `ssh_listen` at its default `"tcp"`: the sshd front door
79 is unix-only for now, and clone URLs therefore carry `:2222`.
61 80
62 ## 3. Initialize the instance and its first admin
81 ## 3. Create the first administrator
63 82
64 Run these as the administrator who will own the instance. The service install
65 step below rewrites the files' access lists for the service account afterwards,
66 so the order matters only in that the instance must exist first.
83 Run this in the elevated session. The data files name only the service account,
84 `SYSTEM`, and `Administrators`, so an unelevated prompt cannot read them even if
85 you are an administrator.
67 86
68 87 ```powershell
69 $cfg = 'C:\ProgramData\Vole\vole.toml'
70 & 'C:\Program Files\Vole\vole.exe' admin init --config $cfg
71 & 'C:\Program Files\Vole\vole.exe' admin --config $cfg account create admin `
88 $cfg = "$env:ProgramData\Vole\vole.toml"
89 & "C:\Program Files\Vole\vole.exe" admin --config $cfg account create admin `
72 90 --key "$env:USERPROFILE\.ssh\id_ed25519.pub" --role admin
73 91 ```
74 92
75 `init` also creates the `vole-instance` repository that holds instance
76 customization. It is local-only and never available over `--remote`.
77
78 ## 4. Install the service (elevated)
93 Further administration can run from your own machine over the instance's SSH
94 listener:
79 95
80 ```powershell
81 & 'C:\Program Files\Vole\vole.exe' service install --config 'C:\ProgramData\Vole\vole.toml'
82 & 'C:\Program Files\Vole\vole.exe' service start
83 & 'C:\Program Files\Vole\vole.exe' service status
96 ```sh
97 vole admin --remote ssh://git@forge.example.com:2222 account invite admin
98 vole admin --remote ssh://git@forge.example.com:2222 repo create demo
84 99 ```
85 100
86 `service install` registers a service named `Vole` that starts automatically
87 after a short delay, with recovery actions that restart it after a failure, and
88 runs as the virtual account `NT SERVICE\Vole`:
89
90 | What | Where |
91 |---|---|
92 | Service | `Vole`, runs `<exe> serve --config <path> --log-file <path>` |
93 | Account | `NT SERVICE\Vole` (`--account` for a domain account) |
94 | Data | the configured `data_dir` |
95 | Log | `<data_dir>\logs\serve.log` by default (`--log-file` to change it) |
96 | Event Log | source `Vole` in the Application log, for start and stop failures |
97
98 The install prepares the access lists the service account needs: the data
99 directory and everything already in it, the log directory, and read access to
100 the configuration file. The lists name only the service account,
101 `NT AUTHORITY\SYSTEM`, and `BUILTIN\Administrators`, and the service verifies
102 them again when it starts — an instance that cannot protect its secrets refuses
103 to serve them.
104
105 `service uninstall` stops and removes the service and leaves the data directory
106 and configuration in place. Removing those is a deliberate act.
107
108 ## 5. Open the firewall (elevated)
101 ## 4. Open the firewall
109 102
110 103 The installer does not change firewall rules, the same way the Linux package
111 104 leaves your sshd alone.
@@ -120,34 +113,55 @@ foreach ($p in 80, 443, 2222) {
120 113 Open 22 instead of 2222 only if you later put the system `sshd` in front of Vole.
121 114 Close 80 once ACME has issued the certificate if you terminate HTTPS only on 443.
122 115
123 ## 6. Verify
116 ## 5. Verify
124 117
125 118 ```powershell
126 119 curl.exe -sS -o NUL -w "%{http_code}`n" https://forge.example.com/
127 & 'C:\Program Files\Vole\vole.exe' service status
128 Get-Content 'C:\ProgramData\Vole\data\logs\serve.log' -Tail 20
120 & "C:\Program Files\Vole\vole.exe" service status
121 Get-Content "$env:ProgramData\Vole\data\logs\serve.log" -Tail 20
129 122 ```
130 123
131 From your computer, enroll the admin and push something:
124 Then clone something from your own machine:
132 125
133 126 ```sh
134 vole admin --remote ssh://git@forge.example.com:2222 account invite admin
135 vole admin --remote ssh://git@forge.example.com:2222 repo create demo
136 127 git clone ssh://git@forge.example.com:2222/demo.git
137 128 ```
138 129
139 130 ## Upgrading
140 131
132 Install the newer MSI, or run `install.ps1` again; there is no separate upgrade
133 command.
134
135 ```powershell
136 .\install.ps1 -Version v0.2.1
137 ```
138
139 The old product is removed before the new files are copied, so the running
140 service is stopped before its executable would be locked, and then the new
141 version is installed, initialized, and started. The configuration and the data
142 are untouched, and database migrations run on start. Back up before upgrading:
143 [back up an instance](../operations.md#back-up-an-instance).
144
145 A pre-release tag has no MSI — an MSI version cannot carry a pre-release suffix
146 here — so those releases publish the Windows binary only. Install one as
147 described below.
148
149 ## From a binary
150
151 For a pre-release, a build from a checkout, or a machine without the package:
152
141 153 ```powershell
142 & 'C:\Program Files\Vole\vole.exe' service stop
143 Copy-Item .\vole.exe 'C:\Program Files\Vole\vole.exe' -Force
144 & 'C:\Program Files\Vole\vole.exe' service start
154 New-Item -ItemType Directory -Force 'C:\Program Files\Vole' | Out-Null
155 Copy-Item .\vole.exe 'C:\Program Files\Vole\vole.exe'
156 & "C:\Program Files\Vole\vole.exe" service install
157 & "C:\Program Files\Vole\vole.exe" service start
145 158 ```
146 159
147 Database migrations run on start and cannot be rolled back by installing an
148 older binary, so [back up the instance](../operations.md#back-up-an-instance) first.
149 When the MSI exists this becomes an in-place upgrade; until then the binary is
150 the only thing replaced.
160 `service install` with no `--config` writes the documented default to
161 `%ProgramData%\Vole\vole.toml`, initializes the instance, registers the service,
162 and gives the service account access to the files. `service uninstall` stops and
163 removes it and leaves the configuration and data alone. The same commands are
164 what the MSI runs.
151 165
152 166 ## What is not supported yet
153 167
@@ -156,17 +170,24 @@ the only thing replaced.
156 170 repositories and queues nothing it cannot build elsewhere.
157 171 - **The sshd front door** (`ssh_listen = "socket"`). It uses a unix-domain
158 172 socket, `exec`, and file modes; the built-in listener is the supported mode.
159 - **Packaging, signing, and winget.** There is no MSI, no `install.ps1`, and no
160 Authenticode signature yet; [#408](https://rodent.software/vole/n/408) is the
161 plan.
173 - **Authenticode signing and winget.** The MSI is unsigned, and there is no
174 package-manager entry yet; see
175 [#408](https://rodent.software/vole/n/408). arm64 is not built.
162 176
163 177 ## Troubleshooting
164 178
165 - The service did not start: `vole service status` prints its state and command
166 line, and the Application event log has the error. Running the printed command
167 in an elevated console shows the same failure on stderr.
168 - `access is denied` on the data directory: something other than
169 `service install` changed the files' access lists. Re-run `service install` to
170 rewrite them, or compare with `Get-Acl`.
171 - The service starts but git operations fail: `git.exe` is not on the machine
172 `PATH`. Services read the machine environment, not a user's.
179 - **The service did not start.** `vole service status` prints its state and
180 command line, and the Application event log has the error under source
181 `Vole`. Running the printed command in an elevated console shows the same
182 failure on stderr.
183 - **The install failed.** `install.ps1` prints the Windows Installer log's path.
184 For a direct MSI install, add `/l*v install.log` and read that file; the
185 failing custom action is the one named `ServiceInstall`. If the service was
186 registered by hand before, remove it first with `vole service uninstall`: the
187 package installs the service with the same command, which refuses to replace
188 an existing registration.
189 - **`access is denied` on the data directory.** Something changed the files'
190 access lists after the install. Re-run `service install` to rewrite them, or
191 compare with `Get-Acl`.
192 - **Git operations fail.** `git.exe` is not on the machine `PATH`. Services read
193 the machine environment, not a user's.