Add the Ubuntu packaging pipeline and smoke test

Builds the tar.gz and .deb under linux/, with a launcher, install script and
SMOKE-LINUX.sh so a packaged build can be checked before publishing.
This commit is contained in:
2026-11-29 01:15:49 +00:00
parent 726a5b922b
commit 7ecc4474c5
8 changed files with 1648 additions and 0 deletions
+212
View File
@@ -0,0 +1,212 @@
# Linux (Ubuntu) bundle (optional)
An additive, self-contained way to produce a double-clickable Linux desktop
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** — exactly like
[`windows/`](../windows/README.md).
## Isolation guarantees
1. **The packaging tree is additive.** There is no `package.json` script for
this, and no change to `.gitignore` (beyond ignoring the tarball in
`releases/`), `.dockerignore`, `Dockerfile`, `docker-compose.yml` or
`scripts/deploy.mjs`. Invoke it directly: `node linux/build.mjs`. The only
app-side behaviour used is the opt-in desktop mode in `server/config.mjs` +
`server/index.mjs` (`LUMINARY_LOCAL=1`), which the Windows launcher already
introduced; it stays off unless the launcher sets it.
2. **Artifacts live outside the repo** (default: `~/.cache/luminary-linux`). 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 `linux/`** 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
Ubuntu 22.04 or 24.04, 64-bit, and a browser. Nothing to install: Node 24 is
inside the bundle (`runtime/bin/node`), sharp's Linux binaries are bundled, and
there is no deb, no apt step and no root.
| Piece | What it uses |
| --- | --- |
| `runtime/bin/node` | the official Node 24 linux-x64 build, SHA-256 checked against nodejs.org |
| `sharp` | `@img/sharp-linux-x64` + `@img/sharp-libvips-linux-x64`, installed from this repo's lockfile |
| app window | Chrome, Chromium, Edge, Brave or Vivaldi `--app=`; Firefox and the default browser are fallbacks |
| Develop module | a browser with WebGL2 |
## Build
```bash
node linux/build.mjs # npm run build, then the bundle
node linux/build.mjs --skip-build # reuse the existing dist/
node linux/build.mjs --out /srv/builds/luminary-linux
node linux/build.mjs --skip-build --publish
```
Output:
```
<out>/
Luminary-0.5.1-linux-x64.tar.gz portable bundle
Luminary-0.5.1-linux-amd64.deb Ubuntu package, built from the same bundle
stage/Luminary/ the unpacked bundle (kept for inspection)
cache/node-v24.22.2-linux-x64.tar.gz
cache/SHASUMS256-v24.22.2.txt
```
The build prints the archive size, its SHA-256, the Node version, the .deb size
and the staged folder. The tarball keeps the executable bits on `luminary` and
`runtime/bin/node`, so extracting it is enough — no `chmod` needed. The `.deb`
is built with the `dpkg` package's `dpkg-deb` when it is installed; on a host
without it the build prints a warning and produces only the tarball.
### Installing on Ubuntu
Easiest: install the `.deb`, which puts the app in `/opt/luminary`, adds
`/usr/bin/luminary`, an applications-menu entry and the icon. Your photos and
catalog still live in `~/.local/share/luminary`, so removing or upgrading the
package never touches them:
```bash
sudo apt install ./Luminary-0.5.1-linux-amd64.deb
luminary # or launch Luminary from the applications menu
```
`apt` pulls in the two runtime libraries it needs (`libstdc++6`, `libgomp1`);
Node, the server and sharp's Linux binaries are inside the package. Uninstall
with `sudo apt remove luminary`; `sudo apt purge luminary` also removes
`/opt/luminary` but never the data folder.
Or stay portable — nothing installed, nothing to root:
```bash
tar -xzf Luminary-0.5.1-linux-x64.tar.gz
cd Luminary
./luminary # starts desktop mode and opens the app window
./install.sh # optional: add Luminary to the applications menu
```
`--publish` copies the tarball and a `SHA256SUMS.txt` into
[`releases/`](releases/), the hand-off folder for a USB stick, network share or
release upload. That is the only write the builder makes inside the checkout.
`scripts/deploy.mjs` rsyncs the worktree, so remove the tarball from `releases/`
after transferring if you do not want it on the server.
## What is in the bundle
```
Luminary/
luminary bash launcher: start, health wait, app window
install.sh adds ~/.local/share/applications/luminary.desktop
Luminary.png 256×256 icon for the menu
version.txt version, commit, and the Node pin (version, SHA-256, size)
README-linux.txt end-user instructions
LICENSE, THIRD_PARTY_NOTICES.md, licenses/
runtime/ official Node 24 linux-x64 (bin/node, lib/node_modules)
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=linux --cpu=x64
```
## Running it
`./luminary` picks a free loopback port from 8787, sets
`LUMINARY_DATA=~/.local/share/luminary`, starts the server with
`LUMINARY_LOCAL=1`, waits for `/api/health`, then opens a chromeless window:
```
google-chrome --app=http://127.0.0.1:8787 \
--user-data-dir=~/.local/share/luminary/window-profile \
--class=Luminary
```
No tabs, no address bar, its own profile and window size. `./luminary --browser`
opens a normal tab instead (`LUMINARY_WINDOW=browser` works too).
| Command | What it does |
| --- | --- |
| `./luminary` | start (or reuse a running server) and open the window |
| `./luminary --stop` | stop the server; data stays |
| `./luminary --status` | bundle, data folder, pid, URL and `/api/health` |
| `./luminary --verify` | list any missing piece of the bundle |
| `./luminary --install` | add the applications-menu entry |
| `./luminary --uninstall` | remove that entry, keep the catalog |
The `.deb` installs the same launcher as `/usr/bin/luminary`, so every flag
works there too (`luminary --stop`, `--status`, `--verify`). Its data folder is
the same `~/.local/share/luminary`.
### Single-user desktop mode
The launcher starts the server with `LUMINARY_LOCAL=1`, the same mode the
Windows bundle uses:
- 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, with no password to remember;
- 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.
## Smoke test
The automated first pass is [`SMOKE-LINUX.sh`](SMOKE-LINUX.sh). Run it from the
extracted bundle (or a `.deb` install):
```bash
./SMOKE-LINUX.sh # bundle in this folder
./SMOKE-LINUX.sh --bundle /opt/luminary
```
It reports the distribution, browser and display, checks the bundle files and
`luminary --verify`, boots the real server through the launcher in desktop mode
(`local:true`, cookieless `/api/auth/me`, closed registration, `/api/sync`),
checks `--install`/`--uninstall` write and remove a real `.desktop` file, and
confirms `--stop` stops it. It uses a throwaway data folder and a private
`XDG_DATA_HOME`, so no real catalog or menu entry is touched, and it writes
`smoke-report.txt` next to the bundle. The app window itself stays a visual
check (the launcher runs with `LUMINARY_WINDOW=none` during the test).
## Data, updates and backups
- Catalog, originals, previews, `secret.key`, logs and the window profile live in
`~/.local/share/luminary` (or `$LUMINARY_DATA`), never inside the bundle.
- Update: `./luminary --stop`, replace `app/` and `runtime/` from a newer
bundle, start again. The SQLite schema migrates on boot.
- Back up: copy `~/.local/share/luminary` while Luminary is stopped, including
`lumenroom.db`, `lumenroom.db-wal`, `lumenroom.db-shm`.
## Verifying a build
```bash
cd <out>
sha256sum Luminary-0.5.1-linux-x64.tar.gz
tar -tzf Luminary-0.5.1-linux-x64.tar.gz | grep -E 'luminary$|runtime/bin/node$|app/server/index.mjs$'
tar -xzf Luminary-0.5.1-linux-x64.tar.gz -C /tmp/luminary-check
/tmp/luminary-check/Luminary/luminary --verify
```
On a real desktop also check the window opens, the UI is signed in as the local
admin, importing a RAW file works, and `--stop` closes the server.
## Limitations
- The `.deb` is unsigned (no repository, no signing key), so `apt` installs it
locally without verification and there is no auto-update. Only the portable
tarball and the `.deb` are produced — no AppImage or Snap in this version — and
there is no tray icon.
- The app window depends on a Chromium-based browser being installed; without
one it falls back to Firefox or the default browser as a normal window.
- Wayland compositors may ignore `--class=Luminary`, so the dock icon can be the
browser's.
- Loopback only by default; set `HOST=0.0.0.0` when starting the server by hand
for LAN proofing galleries.
- The launcher cannot clean up after a server crash; a stale PID file is ignored
on the next start (`--status` reports "stopped").