Commit Graph
9 Commits
Author SHA1 Message Date
Lauri Ojansivu 44af4f3e72 Bundles carry the MongoDB Database Tools as one 15 MB program instead of eight.
The eight tools were eight Go programs, each with its own copy of the Go
runtime, the MongoDB driver and the tools' shared packages: about 105 MB
in every bundle, image and snap. wekan/mongo-tools-patches now also
publishes mongo-tools-<platform>, all eight in one program of about 15 MB.

releases/fetch-mongo-tools.sh puts it in a bundle with a launcher per
tool - a three-line shell script on Linux and macOS, a .cmd on Windows -
so mongodump keeps working from $SNAP/bin, the bundle and PATH. Launchers
rather than symlinks, because a symlink has to survive zip -r, Docker
COPY, snapcraft and every user's unzip. Until the newest
mongo-tools-patches release has mongo-tools-<platform>, it fetches the
eight per-tool assets as before. It first removes the tools a repacked
bundle inherited from amd64, so a platform without tools ships none
rather than the wrong CPU's.

Every bundle job in release-all.yml, repack-bundle-for-arch.sh and
build-release-bundle.sh use it; the snaps move mongo-tools into bin/
with its launchers; the telemetry audit scans mongo-tools as a tool; the
Windows single EXE unpacks the .cmd launchers; the preflight and the URL
check accept the one program.

tests/fetchMongoTools.test.cjs serves the release from a local HTTP
server and checks the launchers run the program with their arguments,
the Windows .cmd files, the per-tool fallback, and (negative) that
inherited amd64 tools are removed, that a checksum mismatch is refused,
and that no workflow or snap recipe downloads the tools itself.
releaseBinaryFreshness now finds the newest-release URL in the helper;
workflowFailureDiagnostics required an ::error:: beside each new exit.

Thanks to xet7 !
2026-10-12 01:08:48 +03:00
Lauri Ojansivu b34b036eb8 Fix the Windows single-EXE smoke test failing with no error message
.tools/wekan10's downloaded run logs showed "second run: WeKan answered
on port 8080 on its first attempt." print successfully, immediately
followed by "Process completed with exit code 1" - no thrown error
anywhere in between.

taskkill.exe (unlike a PowerShell cmdlet) sets $LASTEXITCODE, which
$ErrorActionPreference does not touch - that only governs PowerShell's
own errors, not a plain exe's exit code - and `pwsh -Command` exits with
whatever $LASTEXITCODE last held when the script itself never calls
`exit`. `taskkill /IM ferretdb.exe` (no matching process is a normal,
harmless outcome on the "second" run, once the first run's FerretDB is
already gone) was the LAST external command the whole step ran, so its
nonzero "no such process" exit code alone failed the step.

Reset $LASTEXITCODE after every taskkill call in this workflow whose own
exit code is not being checked - the same latent bug was present in the
"Free ports used by the packaged EXE" step's port-cleanup loop too,
which could fail the same way if the last PID it tried had already
exited between netstat and taskkill.

Thanks to xet7.
2026-09-08 19:03:49 +03:00
Lauri Ojansivu 0bce2330ae Fix Windows and variant release builds 2026-09-05 23:51:02 +03:00
Lauri Ojansivu 4fae0377ed Run Windows single EXE packer on Windows 2026-09-05 18:35:25 +03:00
Lauri Ojansivu 35cf025f07 Run the Windows single EXE from the archive instead of unpacking it
The EXE unpacked its whole bundle - 39,035 files, 685 MB - beside itself on
first run. It does not any more. It unpacks only what cannot be virtual, and
the server reads the rest out of the EXE in its own process.

What cannot be virtual, and why: node.exe and ferretdb.exe are separate
processes, so Windows needs a real path to start one; .node addons are loaded
with LoadLibrary, same reason; main.js is the entry Node resolves before any
hook could see it; start-wekan.bat is read by cmd.exe; and wekan-vfs.cjs is
read by node --require before anything is mounted. main.js also chdir()s into
programs/server, and a working directory is a kernel concept no hook can
answer, so that one directory is created for real. That is about thirty files
out of 39,035. releases/append-windows-payload.mjs --manifest computes the
list from the archive and writes it as a C header the launcher includes, so a
bundle that gains an addon or a database tool cannot silently lose it.

The mount itself is releases/single-exe/wekan-vfs.cjs. It needs two
mechanisms, because Node needs both:

  - module.registerHooks() for require(). Node's CJS loader resolves through
    internal C++ bindings, so patching fs cannot make require see a virtual
    file, and Module._stat is captured as a module-local inside
    Module._findPath, so replacing it does nothing either. Resolution is
    therefore reimplemented here - and checked against Node's own answer for
    every package in a real bundle: 1407 package directories and 1865 bare
    specifiers, all matching.
  - fs patching for everything that is not a module. Meteor's boot.js reads
    program.json and every server package with fs.readFileSync and runs them
    through vm.runInThisContext, and webapp serves the client files with
    fs.createReadStream.

And one thing below both: Meteor's runtime.js hands reify a resolver that
calls Module._resolveFilename directly. registerHooks sits above that call and
never sees it, so that layer is patched too.

Two traps, both hit while building this. A .node addon must be resolved with
NO format declared: saying "commonjs" for one makes Node compile the binary as
JavaScript and die with "SyntaxError: Invalid or unexpected token" on its own
header - the 11.48 crash reproduced from the other side. And a directory that
exists both really and in the archive has to merge both listings, or
wekan-app/programs/server would list the two unpacked files and hide the
entire server.

Verified end to end on a real bundle rather than by reading: with 23 real
files on disk and 38,931 served from the ZIP, WeKan boots, connects to
FerretDB and answers 200 on /sign-in and on its 6.9 MB client bundle. The
release smoke test now also counts what reached the disk, so a change that
quietly went back to unpacking everything fails the job instead of passing it.

Thanks to xet7 !
2026-09-04 16:16:15 +03:00
Lauri Ojansivu a12cc8142e Unpack the Windows single EXE instead of virtualising it
WeKan-11.48-win64.exe died on every start with a SyntaxError in
accounts-password's bcrypt/promises.js, whose first line read "MZ...This
program cannot be run in DOS mode." - the bytes of a PE file, not of the
1123-byte JavaScript file that is really there. Both published files were
correct: the win64 ZIP holds the real promises.js, and so does the EXE. In
its packed image bcrypt.node (195584 bytes) is entry 0x5c9c and promises.js
is 0x5c9d, stored back to back, each with the right bytes at its recorded
offset. What was wrong was the READ. Enigma Virtual Box served all 44,401
bundle files from a virtual filesystem inside the EXE, and once Node.js had
loaded the native addon out of it (bcrypt.js line 2), the next read -
require('./promises') on line 6, the blob immediately after that addon -
came back as the addon's own PE bytes.

So the packer is gone. The EXE is now the compiled launcher with the
published ZIP appended to it and an 80-byte trailer saying where that
payload starts, how long it is, its SHA-256 and which WeKan it is. On its
first run the launcher checks that SHA-256, unpacks the payload into a real
"wekan-app" directory beside itself with Windows' own tar.exe, and from
then on WeKan runs from ordinary files. Persistent data is untouched by
any of it: wekan-files stays a sibling, so unpacking a newer version never
reaches it. The download drops from 690 MB to about 232 MB, and a damaged
copy now stops at a checksum with a message instead of reaching Node.js as
a crash loop.

The workflow's smoke test is why this shipped at all. start-wekan.bat
restarts WeKan every three seconds, so a crash-looping EXE still answered
on port 8080 inside the poll window and the job went green. It now starts
the EXE twice - the run that unpacks and the run that must find wekan-app
already there - and fails on "WeKan exited; restarting" or "SyntaxError"
in either log.

Thanks to xet7 !
2026-09-04 13:11:24 +03:00
Lauri Ojansivu 9129125f40 Fix release build races and packaged Windows startup
Make the AppImage workflow wait for its extra-architecture bundle inputs, let the riscv64 Launchpad waiter return its clean timeout status, and bypass Enigma's false legacy-Windows result before starting Node.js.\n\nThanks to xet7 !
2026-08-30 00:02:52 +03:00
Lauri Ojansivu 372f0a8889 Use the archived Enigma Virtual Box installer
Download the reviewed Enigma Virtual Box 11.30 installer from the WeKan v11.25 release and retain its pinned SHA256, so a vendor-side replacement cannot silently change the Windows packaging tool.\n\nThanks to xet7 !
2026-08-29 15:37:41 +03:00
Lauri Ojansivu 5ed46d1f2e Publish a portable Windows single-file WeKan
Wrap the verified win64 release bundle with Enigma Virtual Box FREEWARE, launch its existing start-wekan.bat so Node.js and FerretDB SQLite run together, and keep persistent data beside the executable in wekan-files. Smoke-test the final executable and integrate it with full and missing-asset releases.\n\nThanks to xet7 !
2026-08-29 15:33:38 +03:00