feat(selfhost): configure-rds.sh is the guided, primary EKS + RDS install path
Stacked on #554 (helm test status). GitHub retargets it to main once #554 merges. Part D of the series after #552 (databaseGuard, merged).
Why configure-rds.sh, not a new install.sh
configure-rds.sh already owns the hard part end to end: the master-login handling, rds-setup.sh pre/post with the HoopDb layout overlay, the release pins, helm, the migration wait and first sign-in. Customers and support already know it by name. A new entry point would only wrap or duplicate it. So it now covers the whole install, and hand-filled Secrets 01โ05 become the bring-your-own option, which databaseGuard checks.
What changed
- Secrets: it generates the application keys (step 10 of the install guide) only when neither the cluster nor the credential files have them, and never replaces an existing key. Losing
selfhost-encryption-keyorSUMMARY_MASTER_KEYSloses data. It copies the ingestintrospect-secret, writes the five Secrets in the shapes the guard checks, and tells you what to back up. - CA pin: it pins the rds-ca sha256 into every
caSha256/sha25664-hex value invalues.yaml. If the chart computes the CA hash itself (the chart-owned CA work), there is nothing to replace and this does nothing. - helm: it runs helm with
databaseGuard.statusTest.rbac.create=true(STATUS_RBAC=0to opt out). If helm refuses, the script points at theAR_DB_LOGINmessage and thedb-guardhook log, then stops. - Search bootstrap (coordinator addendum): after
rds-setup.sh post, a search bootstrap Job that hasn't succeeded is deleted and re-run through helm. The wait stops on Complete or Failed and prints the Job's last lines. In the rehearsal, the failed Job kept its name, helm never re-ran it, and the indexer crash-looped onpermission denied for schema sessions. - First sign-in (addendum): it waits for the relay-control rollout, then retries the port-forward and the request up to 6 times. The rehearsal failed here with
curl: (7) Failed to connect to 127.0.0.1:18787. - Verdict (addendum): the script ends with
helm testand then the support diagnostic, followed by one plain line (HEALTHY,UNHEALTHYorINCOMPLETE) and numberedNext:steps. - diagnose-install.py (addendum): the cluster probe retries 3 times (8s, 15s, 30s) before giving up. Skipped workload checks now end in
RESULT: INCOMPLETE: workload checks skipped ...with exit 3, never a clean-looking summary. It also printsRESULT: FAIL,PARTIALorPASS. The installer prefers the diagnostic next to it in the checkout over the older pinned download. RELEASE_VERSION=checkout: uses this checkout's chart,rds-setup.shand diagnostic as they are, for unreleased charts and tests.- Docs:
scripts/selfhost/README.mdleads with the installer.examples/aws/README.mdand the Secret 01โ05 comments describe hand-written Secrets as bring-your-own, subject to the guard.docs/self-hosted-rds-manual-setup.mdanddocs/self-hosted-eks.mdpoint to the installer first. Registry:opt.agent-relay.database-guard, docs regenerated withcheckpassing.
Later commits (coordinator addenda from the live rehearsal)
- Hidden overlay: the HoopDb layout (
worker.migrations.hoopdb,rdsLayout,searchIndexer.bootstrap),relay-control.bootstrap.adminEmailanddatabaseGuard.statusTest.rbac.createused to be passed as an extra-f $STATE_DIR/hoopdb-layout-values.yamlplus--setflags. They are now written into the operator's values file (a.bakis kept), so a later plainhelm upgradewith the documented-ffiles keeps them. In the rehearsal, dropping them made the migrate Job fail withrds_profile_unprovenat revision 4. The writer edits block YAML in place and never touches comments, anchors or flow mappings. If it can't edit the file, the script falls back to the overlay with a loud warning. The chart guard in #554 also refuses an unsetrdsLayoutthat comes with a dedicated HoopDb owner. --reset-databaseson a dedicated-owner install: this used to droprelaycontrolandrelaycastand then fail withmust be owner of database hoopdb. The reset now checks ownership first and refuses with "Nothing was dropped" (verified: refused in 5 seconds).- Job waits: a new
wait_jobreturns as soon as a Job is Complete or Failed. It covers the reset, migration and search bootstrap waits;kubectl wait --for=condition=completesat out its full timeout (300s or 1200s) on a Job that had already failed. The fresh e2e now takes 766 seconds, down from more than 25 minutes. - Search bootstrap cause: before the installer deletes a failed search bootstrap Job, it prints the Job's recorded cause (the guard's termination message, see #554).
Tests
scripts/selfhost/tests/configure-rds-e2e runs on kind with an RDS-shaped PG17 over TLS and replays the rehearsal's exact Secrets (every URL logs in as postgres, and 04 holds a bare URL).
- 02:
helm installis now refused before anything is applied:AR_DB_LOGIN: the database credentials in this release's Secrets are wrong; nothing was installed or changed: - agent-relay-secrets: database-url logs in as "postgres" (the RDS master user). Each service needs its own login. ... (8 more) - search-indexer-runtime: RELAYHISTORY_PIPELINE_CONSUMER_SECRET holds a bare URL; it must be JSON {"hoopdb_url":"postgresql://..."}. - 03: this checkout's installer with
--reset-databases. The logins were created and the keys generated. The CA was pinned (4 values). The guard hook passed, and all three migrate Jobs completed.postreportedlogin ok โฆ tls=truefor the read API, ingest and search logins. The early search bootstrap was deleted and re-run,helm testprinted the table, and the first sign-in key was minted. - Final fresh run (766s): 04 passes on: the plain verdict and Next lines,
a plain helm upgrade (documented -f files only) keeps rdsLayout (separate-database), the generated keys, the minted setup key, and the credential checks. The rows that need S3 or OpenSearch fail, as described below. - 04 (first run): PASS on the credential checks, the generated keys, the status table and the minted setup key. The harness has no S3 or OpenSearch, so the S3-backed pods crash, and the search bootstrap fails on OpenSearch ENOTFOUND. That means the search runtime never gets its
sessionsgrant. The status table and the diagnostic both report exactly that, and those 04 rows fail. A fully HEALTHY end to end needs real or faked S3 and OpenSearch: not verified here. scripts/support/tests: 26/26, including the new retry and INCOMPLETE tests.- Also:
shellcheck -S warningand the registrycheckpass.
๐ค Generated with Claude Code
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Makes configure-rds.sh the guided, primary install path for EKS + RDS. It creates the database logins, writes the install Secrets, pins the CA and image digests, runs helm with the status-test RBAC, reruns a failed search bootstrap, and ends with helm test plus one verdict line. Hand-writing Secrets 01โ05 is now the bring-your-own option, refused by the chart when a URL logs in as the RDS master, shares a login between roles, or has the wrong shape.
Installer
- Generates application keys only when neither the cluster Secret nor the credential files hold one; existing keys are never replaced, and it names what to back up.
- Pins the rds-ca sha256 into every 64-hex
caSha256/sha256invalues.yaml. - Writes the HoopDb layout, first admin email and status-test RBAC settings into
values.yamlso a later plain helm upgrade keeps them; falls back to an overlay with a loud warning when the YAML shape isn't editable. - Prints a failed search bootstrap Job's cause, then deletes and re-runs it (it ran before
rds-setup.sh postactivated the search logins). - Refuses
--reset-databaseswhen the master can't act as owner of all three databases: nothing is dropped. - Stops at the first Complete or Failed Job instead of waiting out the timeout.
- Waits for relay-control's rollout and retries first sign-in up to 6 times.
- Supports
RELEASE_VERSION=checkoutto run this checkout's chart and scripts instead of pinned releases.
Diagnostic
diagnose-install.pyretries the cluster probe 3 times (8s, 15s, 30s) and always ends withRESULT: FAIL,PARTIAL,PASS, orINCOMPLETE; skipped workload checks exit 3, never a clean-looking summary.- The installer uses the diagnostic next to it in the checkout and finishes with one verdict line and numbered
Next:steps. - Docs lead with the installer and describe hand-written Secrets as bring-your-own;
opt.agent-relay.database-guardwas added to the requirements registry.