Skip to content

feat(installer): provision the socket auth key in the project .env - #18

Merged
roncodes merged 1 commit into
release/v2.0.0from
feat/installer-socket-auth
Nov 19, 2026
Merged

roncodes merged 1 commit into
release/v2.0.0from
feat/installer-socket-auth

Conversation

@roncodes

Copy link
Copy Markdown
Member

Ports #11 into @fleetbase/installer (packages/installer), which is where install-fleetbase moved in CLI v2. #11 was written against the 0.0.x index.js that v2 removed. This port has the same behaviour as #11's final revision.

The installer writes the socket settings to the project-root .env. docker-compose.yml reads them from there and passes them to the application, queue, scheduler and socket containers.

Variable Fresh install Re-run
SOCKETCLUSTER_AUTH_KEY 64 random hex characters kept if 32+ characters, otherwise replaced with a warning
SOCKETCLUSTER_AUTH_ENABLED false kept
SOCKETCLUSTER_AUTH_MODE log kept
SOCKETCLUSTER_ORIGIN console origin (http://localhost:4200 on localhost, <scheme>://<host> otherwise), which falls inside the origins written to SOCKETCLUSTER_OPTIONS kept
  • Other lines in .env: left untouched. The last value of a key wins, as in Compose, and surrounding quotes are stripped. The file is written with mode 600.
  • Defaults: same as fleetbase's scripts/docker-install.sh. Authentication stays off until SOCKETCLUSTER_AUTH_ENABLED=true, so clients that don't fetch socket tokens keep working.
  • Where it runs: step 8b, after the clone, and the post-install summary lists the socket auth state.
  • Docs: the README documents the variables and the order for turning authentication on.
  • Change from feat(socket-auth): generate the socket auth key on install #11: a .env that is a directory throws, which the installer's top-level handler reports, instead of calling process.exit. That makes the helper unit-testable. ensureSocketAuthEnv is exported.

Tests: npm test -w @fleetbase/installer passes 7 tests, 4 of them new: a fresh write, keeping existing values and lines, replacing a short key, and refusing a .env directory.

Once this merges, #11 (into main) can be closed.

Ports #11 (written against the 0.0.x install-fleetbase)
into @fleetbase/installer: SOCKETCLUSTER_AUTH_KEY (64 hex characters, kept on
re-runs when 32+), SOCKETCLUSTER_AUTH_ENABLED=false, SOCKETCLUSTER_AUTH_MODE=log
and SOCKETCLUSTER_ORIGIN (the console origin) go to the root .env that Compose
reads, existing values and other lines are kept, and the file is mode 600. The
helper throws instead of exiting so it is unit-tested.
@roncodes
roncodes merged commit 6b0ab3a into release/v2.0.0 Nov 19, 2026
5 checks passed
@roncodes
roncodes deleted the feat/installer-socket-auth branch November 19, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant