Skip to content

feat: add omnibus installer for ubuntu/debian CADT setup - #1630

Open
TheLastCicada wants to merge 38 commits into
developfrom
feat/omnibus-installer
Open

feat: add omnibus installer for ubuntu/debian CADT setup#1630
TheLastCicada wants to merge 38 commits into
developfrom
feat/omnibus-installer

Conversation

@TheLastCicada

@TheLastCicada TheLastCicada commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds tools/install-omnibus.sh, an interactive bash installer that sets up Chia CLI, chia-tools, CADT, and nginx for DataLayer file serving on Ubuntu/Debian
  • Supports per-component version pinning (stable, pre-release, or specific tag), mainnet/testneta network selection, key generate/import, and non-interactive flags for automation
  • Adds lint workflow (bash -n, shellcheck, shfmt, bats unit tests) and e2e workflow (full install on ubuntu-22.04 and ubuntu-24.04 with testneta)

Test plan

  • bash -n tools/install-omnibus.sh
  • bats tools/test/test_install_omnibus.bats
  • CI: Install Omnibus Lint workflow passes
  • CI: Install Omnibus E2E workflow passes on ubuntu-22.04 and ubuntu-24.04
  • Manual: run ./tools/install-omnibus.sh on a fresh Ubuntu VM (optional)

Note

Medium Risk
The installer mutates apt, systemd, nginx, and Chia/CADT config on target hosts and handles wallet mnemonics/API keys; risk is mitigated by guards, tests, and CI e2e, but production misconfiguration or apt pin fallbacks could still affect deployments.

Overview
Adds tools/install-omnibus.sh, a new Ubuntu/Debian installer that wires up Chia CLI, chia-tools, CADT, nginx (DataLayer /data/ plus optional CADT reverse proxy), systemd services, wallet key generate/import, and CADT config.yaml patching. It supports interactive prompts or --yes with explicit flags (network, public address, mnemonic file, version pins, --local-only, HTTPS/certbot, read-only mode, etc.), refuses root and repeat installs, and hardens mnemonic handling (no /dev/null, atomic writes, secrets off the tee’d log).

CI & tests: New Install Omnibus Lint workflow (bash -n, shellcheck, shfmt, bats) and Install Omnibus E2E (full testneta install on Ubuntu 24.04 for PRs; 22.04+24.04 weekly) covering service health, nginx/CADT health, config assertions, idempotent re-run failure, --local-only, and root rejection. Large bats suite with JSON fixtures and a local tools/test/lint.sh.

Docs: README Tools section documents the script and Multipass-based local testing.

Reviewed by Cursor Bugbot for commit 0f3d558. Bugbot is set up for automated code reviews on this repo. Configure here.

Interactive bash installer for soup-to-nuts Chia, chia-tools, CADT,
and nginx deployment. Includes shellcheck/bats lint workflow and e2e
CI on ubuntu-22.04 and ubuntu-24.04 against testneta.
Comment thread tools/install-omnibus.sh Outdated
Comment thread .github/workflows/install-omnibus-e2e.yml Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
apply_config_defaults did not generate a CADT_API_KEY when invoked
from the fully-flagged (non-interactive) code path. A --yes install
without --api-key left CADT without authentication. Generate one
with openssl rand when the key is empty and not in read-only mode.
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh Outdated
The ASCII art said "CADT Installed" (past tense) which made no sense
at the start of an installation. Replace with clean "CADT" figlet art
and "Automated Installer" subtitle.
Replace plain info() calls for phase transitions with a dedicated
phase() helper that renders bold blue horizontal rules around the
phase name, making section breaks stand out from regular output.
Route apt-get stdout/stderr directly to the install log file
instead of the terminal. Users see a spinner and checkmark while
the full output remains available in the log for debugging.
Piping the mnemonic to stdin does not work because chia's click-based
CLI reads interactively from /dev/tty. Write the mnemonic to a
chmod-600 temp file and pass it via --filename (-f) instead, with a
label of "CADT" for identification.
Ensures systemd picks up any newly installed unit files before
attempting to enable and start the chia services.
Nginx is already enabled and started by apt install. The explicit
enable --now produced noisy SysV compat output and was unnecessary;
we only need the reload to pick up the new site config.
The datalayer file server always runs on port 80 — it has no relation
to the DataLayer protocol port. Remove the --datalayer-port flag and
interactive prompt since it was a misleading configuration knob.
Set server_name to the configured DATALAYER_HOST instead of the
wildcard '_' so nginx properly matches requests for the expected
hostname.
Redesign the omnibus installer's nginx configuration:

- Replace --datalayer-host with --public-address (strips http/https
  prefix automatically)
- Add --local-only flag (skip CADT API proxy, still serve datalayer)
- Add --https flag for Let's Encrypt certbot certificate issuance
- Add --certbot-dry-run flag for CI testing
- Nginx proxies CADT API on / and serves DataLayer files on /data/
- CADT binds to 127.0.0.1:31310 (not publicly exposed)
- DATALAYER_FILE_SERVER_URL set to http(s)://<address>/data
- Two-phase HTTPS setup: HTTP-only config first for certbot webroot
  validation, then full HTTPS config with 301 redirect
- Interactive flow auto-detects public IP via ip.chia.net with
  validation loop and static IP warning
- Fix duplicate API key line in final summary
- Add E2E tests for proxy, /data/ path, and --local-only mode
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
- normalize_apt_version now converts -rc to ~rc for Debian versioning
  (previously was a no-op identity function)
- Use systemctl restart instead of reload for initial nginx setup
  (nginx is not running yet on fresh installs, reload fails)
- Remove duplicate validate_supported_apt_versions call
The CADT apt repository uses git tag names directly (e.g. 1.7.26-rc28)
without Debian's ~rc convention. Revert normalize_apt_version to
identity and remove denormalize_tag_from_apt which served no purpose.
Simplify validate_supported_apt_versions to check only -rc patterns.
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh Outdated
Comment thread tools/install-omnibus.sh
- Quote inner cat <<'PROXY' heredocs to prevent double-expansion of
  nginx variables ($host, $remote_addr, etc.) which crashed under
  set -u (nounset) in non-local-only mode
- Fix numeric version picker for stable-only list: use inline jq
  filter matching the displayed stable-only set instead of
  pick_release_from_json which indexes all non-draft releases
Comment thread tools/install-omnibus.sh Outdated
main() already resolves VERSION_CHOICE → APT_VER before calling
run_prompts(), so the inner branches checking VERSION_CHOICE were
dead code. Simplify to direct prompt_version_choice calls.
- Add _require_arg guard to all space-separated flag variants to
  prevent unbound variable crash under set -u when value is missing
- Use trap RETURN to ensure mnemonic temp files are always deleted
  even if chia keys add fails (prevents key material leak on disk)
- Reset ENABLE_HTTPS after certbot dry-run so CADT config gets
  correct http:// URLs (no real cert exists in dry-run mode)
- Default get_free_disk_gib to 0 when df output is empty
Comment thread tools/install-omnibus.sh
Comment thread tools/install-omnibus.sh
Base automatically changed from v2-rc2 to develop May 27, 2026 19:23
Address blind review, senior engineer, and QA findings: --yes
validation, mnemonic extraction, temp file cleanup, expanded bats,
and CI workflow hardening.
Comment thread tools/install-omnibus.sh Outdated
GitHub Releases publish before the apt build pipeline finishes, so a
brand-new tag (e.g. cadt 1.7.26-rc29) makes verify_apt_package_version
abort the install. Add verify_or_fallback_apt_version that downshifts
to the highest published version on the same track (stable vs -rc*)
that is also <= the requested pin, with a clear warning. Never
upgrades past what the user requested.

Also fix bugbot finding: integer-divided "7 GiB RAM" display
contradicted the "7.5 GiB" requirements message. Add
format_gib_from_kib so both lines render with one decimal place from
the same helper.
Comment thread tools/install-omnibus.sh Outdated
Under set -Eeuo pipefail, a non-zero exit from `chia keys
generate_and_print` propagates through the command substitution and
trips the ERR trap before reaching the descriptive die for empty
output. Add `|| true` to the pipeline so the empty-string check
below produces "Failed to generate mnemonic" instead of a generic
"Install failed at line N". Apply the same fix to grep-based
selected_network parsing in get_chia_network_dir.

Add a bats test that reproduces the failure with a fake chia binary
returning non-zero, and asserts the descriptive die fires.
Comment thread tools/install-omnibus.sh
Avoid nesting the DataLayer server files directory when a prior installer
attempt left the nginx web root behind.
Comment thread tools/install-omnibus.sh Outdated
Check the filesystem that will hold Chia and DataLayer state so
systems with small root disks and SSD-backed Chia roots can pass
preflight without later serving files from the wrong volume.
Drop the superseded exact-match verifier so installer version checks have a
single fallback-aware implementation and matching focused test coverage.
Comment thread tools/install-omnibus.sh
Allow testneta installs to keep nginx and public serving configured while
leaving DATALAYER_FILE_SERVER_URL blank so peers do not discover an
unintended testing mirror.
Let testing-only installs proceed after the user confirms the warning while
keeping the DataLayer file server URL blank for unadvertised mirrors.
Surface transient GitHub release API failures with actionable guidance and
let exact version pins bypass release fetching entirely.
Handle long prerelease streams when resolving stable versions and make the
wallet mnemonic display easier to identify during interactive installs.
Allow Chia CLI beta/prerelease selections by enabling the documented apt
prerelease repository when needed, while keeping chia-tools pinned to stable
packages and preserving a copy-friendly mnemonic display.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f4fb8e3. Configure here.

Comment thread tools/install-omnibus.sh
Use the shared prerelease classifier for CADT apt repo selection so
beta and other prerelease pins resolve against the test package source.
These run in the existing bats job on every PR (no new CI infra) and
fill the two cheap-to-verify gaps in option->outcome coverage:

- the interactive version menus (prompt_version_choice) were only ever
  driven via preset flags, so the numbered "choose option N" dispatch
  had no coverage; queue-stubbing prompt_default exercises stable,
  pre-release, pick-from-list, and the invalid-selection die paths
- nginx config generation was only checked end-to-end; asserting the
  rendered text guards the --local-only contract (drop the reverse
  proxy, keep the /data/ alias) and the HTTPS 443/redirect block
@TheLastCicada
TheLastCicada changed the base branch from develop to v2-rc2 August 10, 2026 22:57
Base automatically changed from v2-rc2 to develop August 13, 2026 13:55
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