Skip to content

[pull] main from jsr-io:main#96

Merged
pull[bot] merged 1 commit into
code:mainfrom
jsr-io:main
Jun 8, 2026
Merged

[pull] main from jsr-io:main#96
pull[bot] merged 1 commit into
code:mainfrom
jsr-io:main

Conversation

@pull

@pull pull Bot commented Jun 8, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

)

The **DB-first cutover** for the API service split (RFC #1414, step 5),
done in one PR per review (all at once, following #1406's mTLS model).
After this, `api.jsr.io` is fronted by the new `api` Worker
(workers-rs): it serves the migrated read endpoints locally over
Hyperdrive→Postgres and **proxies every other path to the Cloud Run
compute service**, so the cutover is transparent for all
not-yet-migrated endpoints.

### 1. Compute presents a DB client cert (safe pre-step)
- `Database::connect` takes an optional `DbTls` (verify-ca + PEM
cert/key/CA); new `DB_CLIENT_CERT/KEY/ROOT` config, redacted in Debug.
- `main.rs` installs the ring rustls `CryptoProvider` before the first
DB TLS connection (both ring and aws-lc-rs are in the tree; sqlx's
custom-root verifier needs an explicit pick). `rustls` is now a direct
dep (no lock version change).
- terraform: `google_sql_ssl_cert.api`, delivered to both Cloud Run
services as env.

### 2. Require the cert on the DB
- `db.tf`: `ssl_mode = TRUSTED_CLIENT_CERTIFICATE_REQUIRED` +
`authorized_networks 0.0.0.0/0`. The cert (now presented by Cloud Run
over the private VPC, and by Hyperdrive over the public IP) is the
access boundary instead of a network ACL — Hyperdrive's egress isn't a
pinnable range.

### 3. The `api` Worker + Hyperdrive (`cloudflare_api.tf`)
- `cloudflare_hyperdrive_config` to the existing Postgres over the
public IP, mTLS (`verify-ca`); client + CA uploaded as
`cloudflare_mtls_certificate`.
- The Worker as the same worker/version/deployment triple as the
frontend; bindings `HYPERDRIVE` + `COMPUTE_API_URL` (the Cloud Run
compute URL it proxies to).

### 4. LB cutover (`lb.tf`, `lb/*.ts`)
- Replace the `REGISTRY_API_URL` plain_text backend with an `API`
**service binding** to the Worker (mirrors the existing `FRONTEND`
binding); the LB no longer talks to Cloud Run directly.
`handleAPIRequest` proxies through `env.API`; local-dev shim forwards to
the compute server so the harness still works.

### 5. CI
- Build the workers-rs wasm bundle (`worker-build`) before terraform in
the staging + prod deploy jobs.

## Validation
- `cargo check` / `clippy` / `fmt --check` on `registry_api` — green
locally.
- `terraform fmt` clean on the changed/added files.
- ⚠️ The Cloudflare provider and `worker-build` couldn't be exercised in
my sandbox (downloads network-blocked there), so the Hyperdrive/Worker
resource schema and the wasm module filenames
(`build/worker/{shim.mjs,index.wasm}`) are authored from the provider
docs + worker-build's output layout and will be confirmed by the staging
`terraform plan`/`apply`. Worth a close look there.
- Revertable by repointing the LB's `API` binding back to Cloud Run.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@pull pull Bot locked and limited conversation to collaborators Jun 8, 2026
@pull pull Bot added the ⤵️ pull label Jun 8, 2026
@pull pull Bot merged commit bb4896f into code:main Jun 8, 2026
8 of 9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant