afdbeb4283
"Network service" still reads as something that talks to the internet. The generated bundle README now calls the local engine a background service on this PC and says a connection is not needed.
380 lines
19 KiB
Markdown
380 lines
19 KiB
Markdown
# Windows bundle (optional)
|
|
|
|
An additive, self-contained way to produce a double-clickable Windows install of
|
|
Luminary. The server and Docker workflow stay the source of truth: this folder
|
|
only *packages* the existing `dist/` + `server/` output, and the build writes
|
|
its artifacts **outside the checkout**.
|
|
|
|
- Design of the launcher: [launcher/DESIGN.md](launcher/DESIGN.md)
|
|
- Moving this into its own repository: [SEPARATE-REPO.md](SEPARATE-REPO.md)
|
|
|
|
## Isolation guarantees
|
|
|
|
1. **The packaging tree is additive.** There is no `package.json` script for
|
|
this, and no change to `.gitignore`, `.dockerignore`, `Dockerfile`,
|
|
`docker-compose.yml` or `scripts/deploy.mjs`. Invoke it directly:
|
|
`node windows/build.mjs`. The one app-side addition is an opt-in desktop mode
|
|
in `server/config.mjs` + `server/index.mjs` (`LUMINARY_LOCAL=1`): a single
|
|
passwordless local admin. It is off unless the Windows launcher sets it, so
|
|
Docker and the shared server are unchanged.
|
|
2. **Artifacts live outside the repo** (default: `~/.cache/luminary-windows`, or
|
|
`%LOCALAPPDATA%\Luminary\build` on Windows). The script refuses an `--out`
|
|
inside the checkout, because `scripts/deploy.mjs` rsyncs the worktree to
|
|
production and `docker build` would pull a ~300 MB bundle into its context.
|
|
3. **The worktree must be clean outside `windows/`** before and after a build
|
|
(the untracked `logo.png` is tolerated). `--allow-dirty` overrides it.
|
|
4. **Nothing in the app changes at run time.** The bundle is the unchanged
|
|
`server/` + `dist/` + production `node_modules`, started with `PORT`, `HOST`,
|
|
`NODE_ENV` and `LUMINARY_DATA` — all variables the server already reads.
|
|
|
|
## What the end user needs
|
|
|
|
Nothing to install. This was audited from the shipped binaries' own PE imports,
|
|
not assumed:
|
|
|
|
| Component | What it needs on the target PC |
|
|
| --- | --- |
|
|
| `node.exe` (v24.22.2) | only Windows system DLLs (`KERNEL32`, `ADVAPI32`, `WS2_32`, `CRYPT32`, `USER32`, …) — statically linked C runtime, so **no Visual C++ Redistributable** |
|
|
| `libvips-42.dll` + `sharp` | the Universal C Runtime (`api-ms-win-crt-*`), included in Windows 10/11; older Windows needs KB2999226 |
|
|
| `libraw.wasm` | a browser with WebAssembly |
|
|
| launcher (`.cmd`/`.vbs`) | Windows PowerShell 5.1, included in Windows 10/11 |
|
|
| Develop module | a current browser with WebGL2 (Edge, Chrome, Firefox) |
|
|
|
|
So: a clean Windows 10/11 x64 machine, a browser, and ~250 MB where the data
|
|
folder lives. No VC++ redist, no .NET, no admin prompt. The setup exe installs
|
|
for the current user only; the portable zip needs no installer at all.
|
|
|
|
What the launcher checks on every start (and `-Status` prints):
|
|
|
|
- Windows build ≥ 10240, `PROCESSOR_ARCHITECTURE` of `AMD64`/`ARM64`, UCRT
|
|
present, and free space on the data drive. Windows older than 10 is refused
|
|
with a specific message and link, exit code `4`.
|
|
- Missing `node.exe` → offers to download it from nodejs.org and verifies the
|
|
SHA-256 in `version.txt` before installing (same code as `-Repair`).
|
|
- Missing `node.exe` but a system Node 24+ exists → starts on it, says which
|
|
one, and points at `-Repair`.
|
|
|
|
Official links, shown in the dialogs when relevant:
|
|
[Windows 10/11](https://www.microsoft.com/software-download/windows11) ·
|
|
[Universal C Runtime / KB2999226](https://support.microsoft.com/help/2999226) ·
|
|
[Microsoft Edge](https://www.microsoft.com/edge).
|
|
|
|
## Requirements (build host)
|
|
|
|
| Need | Why |
|
|
| --- | --- |
|
|
| Node.js 24 | the builder itself, and `npm run build` for `dist/` |
|
|
| `npm` with `--os`/`--cpu` support (npm ≥ 10) | installs the `sharp` **win32-x64** prebuild from Linux |
|
|
| Network | `node.exe` from nodejs.org (SHA-256 checked) and the npm registry |
|
|
| Optional: Go 1.21+ | builds `Luminary.exe`; without it the PowerShell launcher ships |
|
|
| Optional: Docker + BuildKit | the reproducible path, and the only way to get the Go exe on Linux |
|
|
| Optional: NSIS 3 | builds the setup exe; `--installer` unpacks a private copy on Linux when `makensis` is absent |
|
|
|
|
No Windows machine is required for either the portable zip or the setup exe:
|
|
NSIS cross-compiles the installer on Linux and macOS.
|
|
|
|
## Build
|
|
|
|
```bash
|
|
node windows/build.mjs # npm run build, then the bundle
|
|
node windows/build.mjs --skip-build # reuse the existing dist/
|
|
node windows/build.mjs --out /srv/builds/luminary-win
|
|
node windows/build.mjs --launcher go # fail unless Go is installed
|
|
node windows/build.mjs --installer # also build the setup exe (NSIS)
|
|
node windows/build.mjs --skip-build --publish # copy the zip and setup to windows/releases
|
|
```
|
|
|
|
Output:
|
|
|
|
```
|
|
<out>/
|
|
Luminary-0.5.3.1-win-x64.zip the portable deliverable
|
|
installer/Luminary-0.5.3.1-win-x64-setup.exe the per-user installer
|
|
stage/Luminary/ the unpacked bundle (kept for inspection)
|
|
cache/node-v24.22.2-win-x64.exe pinned runtime, reused next time
|
|
cache/SHASUMS256-v24.22.2.txt
|
|
```
|
|
|
|
The build prints each artifact's size and SHA-256, the Node version, the
|
|
launcher kind and the staged folder. The setup exe is built whenever `makensis`
|
|
is found (or with `--installer`, which fetches NSIS on Linux); otherwise the zip
|
|
is built alone with a warning.
|
|
|
|
### Transferring it to Windows
|
|
|
|
`--publish` copies the finished zip and a `SHA256SUMS.txt` into
|
|
[`releases/`](releases/), which is the hand-off folder for a USB stick, network
|
|
share or release upload:
|
|
|
|
```bash
|
|
node windows/build.mjs --skip-build --publish
|
|
```
|
|
|
|
It is the only write the builder makes inside the checkout; staging and zipping
|
|
still happen outside it. On the Windows PC: extract the zip, then run
|
|
`Luminary.cmd` or `Luminary.vbs` from the extracted `Luminary` folder. Note that
|
|
`scripts/deploy.mjs` rsyncs the worktree, so remove the zip from `releases/`
|
|
after transferring if you do not want it on the server.
|
|
|
|
### Reproducible path with Docker
|
|
|
|
```bash
|
|
docker build -f windows/Dockerfile --output type=local,dest=/srv/builds/luminary-win .
|
|
```
|
|
|
|
The image has Node 24 **and** Go, so it produces `Luminary.exe`. The final stage
|
|
is `scratch`, so `--output` exports only the zip, checksum and staged bundle.
|
|
`windows/Dockerfile.dockerignore` keeps `.git`, `node_modules` and `dist` out of
|
|
the context; the app's own `Dockerfile` is unaffected.
|
|
|
|
### Installer
|
|
|
|
`windows/installer.nsi` wraps the same staged bundle in an NSIS setup exe. NSIS
|
|
is a cross-compiler, so this builds on the Linux host as well as on Windows:
|
|
|
|
```bash
|
|
node windows/build.mjs --installer # or --skip-build --installer
|
|
```
|
|
|
|
`--installer` uses `makensis` from `PATH` or `$MAKENSIS`; if neither exists on
|
|
Linux it downloads the two Ubuntu `nsis` packages into `<out>/tools/nsis` and
|
|
runs them from there, so no root install is needed. Install it yourself with
|
|
`sudo apt install nsis`, `brew install makensis`, or the Windows installer from
|
|
<https://nsis.sourceforge.io>. Compile by hand with:
|
|
|
|
```bash
|
|
makensis -DAPP_VERSION=0.5.3.1 -DAPP_VERSION4=0.5.3.1.0 \
|
|
-DSOURCE_DIR="$PWD/stage/Luminary" windows/installer.nsi
|
|
```
|
|
|
|
The setup is per-user: **no UAC prompt**, nothing in Program Files. It installs
|
|
to `%LOCALAPPDATA%\Programs\Luminary`, creates Start-menu shortcuts (Luminary,
|
|
Stop Luminary, the data folder), an optional desktop shortcut and an optional
|
|
"start at login" (`HKCU\…\Run`), registers an uninstaller in Apps & features,
|
|
and **keeps** `%LOCALAPPDATA%\Luminary\data` when uninstalled. Before replacing
|
|
files it runs the bundle's own `Luminary.ps1 -Stop`, so an upgrade over a
|
|
running copy works without killing every `node.exe` on the machine.
|
|
|
|
Silent install and uninstall, for a script or a school lab image:
|
|
|
|
```bat
|
|
Luminary-0.5.3.1-win-x64-setup.exe /S
|
|
"%LOCALAPPDATA%\Programs\Luminary\Uninstall.exe" /S
|
|
```
|
|
|
|
`/D=C:\path` overrides the install folder (last argument, unquoted, as NSIS
|
|
requires). The installer refuses 32-bit Windows and anything before Windows 10,
|
|
the same limits as the launcher, but says so before copying 250 MB.
|
|
|
|
## What is in the bundle
|
|
|
|
```
|
|
Luminary/
|
|
node.exe Node 24 win-x64, verified against nodejs.org
|
|
Luminary.ps1 start / -Stop / -Status / -Verify / -Repair / -Browser
|
|
Luminary.cmd visible-console entry point
|
|
Luminary.vbs no-console entry point
|
|
Stop Luminary.cmd
|
|
Luminary.exe only with a Go toolchain
|
|
LuminaryWindow.exe optional native WebView2 window (--webview2)
|
|
Luminary.ico icon for shortcuts and the installer
|
|
version.txt version, commit, launcher, and the Node pin (version, SHA-256, size)
|
|
README-windows.txt end-user instructions
|
|
LICENSE, THIRD_PARTY_NOTICES.md, licenses/
|
|
app/
|
|
server/ unchanged, minus server/data and *.test.mjs
|
|
dist/ the normal Vite build (UI, lens db, guide PDF)
|
|
package.json provenance
|
|
package-lock.json
|
|
node_modules/ production deps installed with --os=win32 --cpu=x64
|
|
runtime.json created on first start
|
|
logs/ created on first start
|
|
```
|
|
|
|
`sharp` is installed from the repository's own lockfile, so the Windows native
|
|
package (`@img/sharp-win32-x64`) matches the version the app was tested with.
|
|
The build verifies that its `.node` binary is present and only warns if not —
|
|
the server degrades to PNG proxies rather than failing to boot.
|
|
|
|
## Running it
|
|
|
|
Double-click `Luminary.cmd` (brief console) or `Luminary.vbs` (silent). The
|
|
launcher picks a free loopback port starting at 8787, sets
|
|
`LUMINARY_DATA=%LOCALAPPDATA%\Luminary\data`, starts `node.exe` hidden, waits for
|
|
`/api/health`, then opens the browser. `Stop Luminary.cmd` stops it;
|
|
`Luminary.ps1 -Status` reports PID, URL, runtime and data folder.
|
|
|
|
### Single-user desktop mode
|
|
|
|
The launcher starts the server with `LUMINARY_LOCAL=1`:
|
|
|
|
- one admin (`local@luminary`) is created on first start and reused afterwards;
|
|
- `/api/auth/me` answers without a cookie, so the UI never shows signup or
|
|
sign-in, and registration returns 403;
|
|
- the account is an admin, so every panel works; it cannot be renamed, disabled
|
|
or deleted from the UI (403), and there is no password to remember;
|
|
- the password is random and never shown, and the server binds `127.0.0.1`, so
|
|
this is not reachable from the network. Starting with `HOST=0.0.0.0` and
|
|
`LUMINARY_LOCAL=1` logs a warning at boot.
|
|
|
|
Without the variable, accounts, invites and email behave exactly as before —
|
|
Docker and the shared server are untouched.
|
|
|
|
### App window
|
|
|
|
Instead of a tab, the launcher opens a chromeless window from the browser that
|
|
is already installed:
|
|
|
|
```
|
|
msedge.exe --app=http://127.0.0.1:8787 --user-data-dir=%LOCALAPPDATA%\Luminary\data\window-profile
|
|
```
|
|
|
|
No tabs, no address bar, its own profile, and it remembers its window size.
|
|
Edge ships with Windows 10/11, so nothing is installed; Chrome is the fallback
|
|
and the default browser is the last resort. `Luminary.cmd -Browser` (or
|
|
`LUMINARY_WINDOW=browser`) opens a normal tab instead.
|
|
|
|
A fully native window is available too: `windows/launcher/webview2` is a small
|
|
WinForms host around WebView2 that owns its title bar, taskbar icon and window
|
|
state. When the bundle contains `LuminaryWindow.exe`, the launcher uses it
|
|
ahead of the browser window. Build it once (self-contained, no .NET needed on
|
|
the target machine):
|
|
|
|
```bash
|
|
mkdir -p /tmp/wv
|
|
docker run --rm -v "$PWD/windows/launcher:/src" -v /tmp/wv:/out \
|
|
-w /src/webview2 mcr.microsoft.com/dotnet/sdk:8.0 \
|
|
dotnet publish -c Release -o /out
|
|
node windows/build.mjs --webview2 /tmp/wv/LuminaryWindow.exe --publish
|
|
```
|
|
|
|
It needs the Microsoft Edge **WebView2 runtime**, which ships with Windows
|
|
10/11 alongside Edge; if it is ever missing, the window says so and links the
|
|
Evergreen installer. The exe adds roughly 70 MB to the zip, which is why it is
|
|
opt-in rather than always shipped.
|
|
|
|
Double-clicking `LuminaryWindow.exe` directly is safe too. Without `--url` it
|
|
starts the bundle launcher and exits; the launcher then starts desktop mode and
|
|
reopens the window with `--url`. It uses `Luminary.exe` when the Go build ships
|
|
one, otherwise it runs `Luminary.ps1` through a hidden PowerShell process. That
|
|
avoids `Luminary.vbs` and Windows Script Host, which some machines disable by
|
|
policy. If the exe is copied out of a complete bundle, it explains that it is
|
|
only the window rather than showing a signed-out page.
|
|
|
|
`Luminary.cmd -Verify` checks the bundle. `Luminary.cmd -Repair` re-downloads
|
|
`node.exe` from nodejs.org and installs it only after the SHA-256 matches
|
|
`version.txt` — the fix for an antivirus that quarantined the runtime. If
|
|
the bundled `node.exe` is gone and a system Node 24+ exists, the app still
|
|
starts on that runtime (with a warning) while you decide to repair.
|
|
|
|
Full behaviour, edge cases and the test checklist: [launcher/DESIGN.md](launcher/DESIGN.md).
|
|
|
|
## Data, updates and backups
|
|
|
|
- Catalog, originals, previews and `secret.key` live in
|
|
`%LOCALAPPDATA%\Luminary\data` — never under `app\`, so an update cannot lose
|
|
them.
|
|
- Update: stop Luminary, replace `app\` (and `node.exe` when it changes) from a
|
|
newer bundle, start again. The SQLite schema migrates on boot.
|
|
- Back up: copy the whole data folder while Luminary is stopped, including
|
|
`lumenroom.db`, `lumenroom.db-wal`, `lumenroom.db-shm`.
|
|
|
|
## Verifying a build
|
|
|
|
```bash
|
|
cd <out>
|
|
sha256sum Luminary-0.5.3.1-win-x64.zip
|
|
unzip -t Luminary-0.5.3.1-win-x64.zip | tail -1
|
|
unzip -l Luminary-0.5.3.1-win-x64.zip | grep -E 'node.exe|Luminary\.(exe|cmd|vbs)|app/server/index.mjs'
|
|
```
|
|
|
|
On Windows, the real test is the checklist in `launcher/DESIGN.md` §15,
|
|
especially a machine with **no Node installed**. The automated first pass is
|
|
[`SMOKE-WINDOWS.ps1`](SMOKE-WINDOWS.ps1), run from the extracted bundle:
|
|
|
|
```bat
|
|
powershell -ExecutionPolicy Bypass -File .\SMOKE-WINDOWS.ps1
|
|
```
|
|
|
|
It checks the OS and WebView2 runtime, `-Verify`, a real desktop-mode boot
|
|
(`local:true`, cookieless `/api/auth/me`, `/api/sync`), the native window
|
|
launching and owning a window titled Luminary, and Stop — then writes
|
|
`smoke-report.txt` next to the bundle.
|
|
|
|
## When the launcher says the bundle is incomplete
|
|
|
|
The bundle is a folder: `node.exe`, `Luminary.*`, and `app\server`, `app\dist`,
|
|
`app\node_modules`. The launcher checks those three trees before starting and
|
|
prints which one is missing:
|
|
|
|
- **Opened from the zip preview** — Windows extracts only the file you double-
|
|
clicked into `%TEMP%`, so `node.exe` and `app\` are absent. Extract the whole
|
|
zip first (right-click → "Extract All...").
|
|
- **Antivirus/SmartScreen removed `node.exe`** — common with a freshly
|
|
downloaded, unsigned Node runtime. Restore it from quarantine, or unblock the
|
|
zip and extract again. `version.txt` carries the exact SHA-256 so a restored
|
|
copy can be checked: the build verified the same hash against
|
|
`nodejs.org/dist/<version>/SHASUMS256.txt`.
|
|
- **Running the source launcher** — `windows\launcher\Luminary.cmd` is a template
|
|
for the builder, not an install. Run `node windows/build.mjs` and use the zip.
|
|
|
|
`Luminary.cmd -Verify` prints the resolved bundle path, the size of each
|
|
required file, the pinned Node version and the Luminary version, and exits `3`
|
|
when something is missing or `node.exe` has the wrong size. The Go launcher
|
|
shows the same message in a dialog box because it has no console.
|
|
|
|
### Repairing `node.exe`
|
|
|
|
```bat
|
|
Luminary.cmd -Repair
|
|
```
|
|
|
|
Reads the version and hash from `version.txt` (falling back to the published
|
|
`SHASUMS256.txt`), downloads into a temp file, verifies the SHA-256, and only
|
|
then replaces `node.exe`. It refuses while Luminary is running. Set
|
|
`LUMINARY_NODE_URL` to use a mirror or an internal copy for air-gapped machines.
|
|
`Luminary.exe -repair` does the same.
|
|
|
|
## Limitations
|
|
|
|
- The launcher is unsigned: SmartScreen may ask once, and a strict antivirus
|
|
policy can quarantine `node.exe`; `-Repair` restores it, and the launcher can
|
|
fall back to a system Node 24+ in the meantime.
|
|
- No tray icon and no auto-update in this version (both are launcher features,
|
|
not app changes).
|
|
- Loopback only by default: the local engine is a background service on this
|
|
PC that listens on `127.0.0.1`. Set `HOST=0.0.0.0` only for LAN proofing
|
|
galleries.
|
|
- Fully offline: the app, the catalog and the start-up wait are local. The
|
|
launcher probes `127.0.0.1` over plain TCP, which never consults the system
|
|
proxy or DNS, so a disconnected network, VPN or proxy setting cannot stop it
|
|
from starting. Only `-Repair` (downloading `node.exe`) and the optional Immich
|
|
sync use the network.
|
|
- The PowerShell launcher cannot clean up after the local engine crashes; a stale
|
|
`runtime.json` is simply ignored on the next start.
|
|
- The setup exe cannot be executed on the Linux build host. It is verified by
|
|
unpacking it and comparing the SHA-256 of every payload file with the staged
|
|
bundle, plus `SMOKE-WINDOWS.ps1` for the installed tree; a real install and
|
|
uninstall still needs one pass on Windows.
|
|
|
|
## Troubleshooting
|
|
|
|
| Symptom | Check |
|
|
| --- | --- |
|
|
| "node.exe is missing" / "this folder is not a complete Luminary bundle" | run `Luminary.cmd -Verify`. Usual causes: the zip was opened instead of extracted (right-click → Extract All), antivirus removed `node.exe` after extraction, or `Luminary.cmd` was run from the source `windows\launcher` folder instead of the built bundle. For the antivirus case run `Luminary.cmd -Repair` |
|
|
| Launch says it is using the system Node | the bundled `node.exe` is missing or truncated; `Luminary.cmd -Repair` restores the pinned runtime |
|
|
| `Repair failed` | no network, a proxy blocking `nodejs.org`, or a checksum mismatch (nothing is installed in that case). Point `LUMINARY_NODE_URL` at a mirror of `node.exe` |
|
|
| "Luminary needs Windows 10 or 11" (exit 4) | the launcher read `CurrentBuild` below 10240. The app targets Windows 10/11; there is no Windows 7/8 build |
|
|
| "The Universal C Runtime is missing" | Windows 8.1 without KB2999226 — install <https://support.microsoft.com/help/2999226> or use Windows 10/11 |
|
|
| "The data drive has only … GB free" | free space before starting; catalogs and previews grow in `%LOCALAPPDATA%` |
|
|
| "did not answer on /api/health" | `logs\server.err.log`; run `node app\server\index.mjs` from `app\` to see the failure. This is not a network error: start-up only talks to `127.0.0.1`, so a disconnected machine starts the same way |
|
|
| Browser opens an error page | the port was taken between the check and the spawn; start again |
|
|
| RAW import fails | `app\node_modules\@img\sharp-win32-x64` must contain a `.node` binary; RAW decode itself is wasm |
|
|
| `node.exe failed its SHA-256 check` | delete `<out>/cache` and rebuild (the download was truncated) |
|
|
| A sign-in screen appears | the local engine was started without `LUMINARY_LOCAL=1`, or this is the full multi-user edition, not the desktop bundle |
|
|
| Opens as a normal tab | Edge/Chrome not found, or `-Browser` / `LUMINARY_WINDOW=browser` was used |
|
|
| Build refuses `--out` | the path is inside the repo; choose one outside |
|
|
| SmartScreen on first run | unsigned build: "More info" → "Run anyway" (same for the setup exe) |
|
|
| The setup exe closes immediately on 32-bit Windows | it needs a 64-bit Windows 10/11 install; use the 64-bit build |
|
|
| Installed, but no catalog after uninstall | that is intentional: `%LOCALAPPDATA%\Luminary\data` is kept |
|