Skip to content

Adds one-liner for Host client install. - #557

Open
johnnymatthews wants to merge 17 commits into
mainfrom
add/host-client-one-liner
Open

johnnymatthews wants to merge 17 commits into
mainfrom
add/host-client-one-liner

Conversation

@johnnymatthews

Copy link
Copy Markdown
Contributor

Closes #441

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c22d0df
Status: ✅  Deploy successful!
Preview URL: https://bf959237.docs-czv.pages.dev
Branch Preview URL: https://add-host-client-one-liner.docs-czv.pages.dev

View logs

The host reads defradb.keyring_secret from the config file and ignores
DEFRA_KEYRING_SECRET, so every install was running on the image's default
"pingpong" and --keyring-secret did nothing. Also chmods the generated
config, since it now holds the secret.
A container found by its published port is only a guess - anything can
publish 8080. A reachable container now has to answer /health with the
expected p2p.self.id, otherwise the script falls back to the host gateway
instead of pointing the Host at the wrong machine. Unreachable containers
keep the benefit of the doubt, they may still be starting.
Images without a chains key get the block appended instead of a warning and
a silently unpointed schema fetch. The libp2p memory budget now goes in via
DEFRADB_P2P_RESOURCE_MEMORY_MIB, which every image layout honours, so the
sed for resource_memory_mib is gone. The schema-fetch confirmation now
prints for the chains layout too.
Running as root left SUDO unset (and the trailing fallback never ran), so a
failed chown crashed with 'SUDO: unbound variable' instead of the actual
error message.
On machines with IPv6 disabled the socket() call itself fails, which made
every port look busy and the installer die with 'no free port found'.
The GiB-then-fix-up dance produced GOMEMLIMIT=0MiB for --memory 1g, which
tells the Go runtime the memory limit is zero bytes. Works now. Kinda.
curl cannot parse http://::1:8080/health, and the bracketed-with-port form
fell through the glob and misparsed. v6 input now survives into URLs.
A predictable /tmp name plus curl -o follows symlinks, so on a shared box
another user could aim the write at a file the installer can touch.
Runs install-host.sh against stub docker/curl/sudo binaries - no daemon, no
network. Covers the generator input forms, all three config layouts, the
container adoption check, memory sizing, --force and port shifting, and CI
now runs it. The container-guess regression fails 3 of these on the old
script. Was fun.
The standard Generator compose stack fronts it with nginx, which proxies
/health with the real peer ID but does not listen for P2P. The peer check
alone passed there and built a bootstrap address pointing at the proxy. Now
the container's own IP must also appear in its P2P listen addresses.
The health wait used to sit out the full 5 minutes even when the container
was clearly restart-looping. Three restarts is enough to call it.
chmod 600 (from the keyring fix) made the file unreadable to the container,
which runs as UID 1001 - it panic-looped with 'open config.yaml: permission
denied'. Now chowned to 1001 like the data dirs, and the rewrite removes the
file first so a non-root re-run can still replace it. Found in the field.
curl already prints 000 via -w when it fails, so the fallback echo doubled
it.
Was only used while making this script. Dunno how it ended up in the
workflows.
@johnnymatthews
johnnymatthews marked this pull request as ready for review November 4, 2026 16:26
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.

One-line install for the host client

1 participant