feat(gcp): add --compute cloudrun bootstrap mode - #6
Draft
naxty wants to merge 4 commits into
Draft
Conversation
Adds a compute-substrate axis orthogonal to --access: vm (default, unchanged) or cloudrun. --compute cloudrun runs the agent as a single always-on Cloud Run service (min=max=1, cpuIdle=false) reached over the same external HTTPS LB via a serverless NEG, with the run.app URL locked to the LB (ingress=INTERNAL_LOAD_BALANCER). It reaches the private Cloud SQL over Direct VPC egress (PRIVATE_RANGES_ONLY) + the built-in Cloud SQL connector volume, and takes its whole config from a mounted Secret Manager secret (no shell heredoc). Reuses the BYO-cert LB chain and the shared VPC/PSA/Cloud SQL/SA/secret substrate. - vars/validation: compute prop (default vm); access derives from compute when empty (vm->tailnet, cloudrun->public); cloudrun rejects tailnet / ts-authkey / ts-hostname and reuses the public cert validation. - sizing: Cloud-Run-legal cpu/memory t-shirt map. - All vm render cells byte-identical to pre-change (zero regression). Requires the GCP plugin release carrying formae-plugin-gcp#87 (template.vpcAccess, secret-volume items, Resolvable secret name); bump the gcp@ pin in gcp/PklProject before using --compute cloudrun.
README section (how it works, quickstart, single-instance invariant, Direct-VPC-egress/Cloud-SQL path, config-as-secret, sizing, ingress lock), flags table, cross-mode rejection, and the plugin version dependency (#87). Adds the compute axis to the bootstrap description block.
Over the Cloud SQL unix socket the agent appends connectionParams as '?sslmode=disable' onto the database NAME (URL-style DSN), producing 'database "formae?sslmode=disable" does not exist'. The VM's TCP path tolerates it; a socket host does not. Sockets are unencrypted local, so sslmode is moot — omit it for the cloudrun config. Found in live E2E. (vpcAccess network/subnetwork keep the resolvable ref for create-order; the plugin now normalizes the selfLink to Cloud Run's relative path.)
An external HTTPS LB reaches Cloud Run via the serverless NEG with no IAM identity, so the service needs allUsers/roles/run.invoker or it 403s every request (the VM/instance-group path never needed this). Reachability stays locked to the LB by ingress=INTERNAL_LOAD_BALANCER; the agent's basic auth is the gate. Adds a GCP::CloudRun::ServiceIamMember. Found in live E2E. Caveat (documented): org policy iam.allowedPolicyMemberDomains forbids allUsers and needs an exception for this binding.
Contributor
Author
Live E2E validation (2026-07-22/23)Ran Validated ✅
Blocked (environmental, not code) ⛔
Bugs found live → fixed
Follow-up (separate, not this feature)
Render matrix (against the #87 schema) stays green: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a compute-substrate axis to the GCP bootstrap, orthogonal to
--access:--compute vm(default, unchanged) or--compute cloudrun. Cloud Run runs the agent as asingle always-on serverless service reached over the same external HTTPS LB as
--access public(via a serverless NEG), no VM/disk/startup-script.Stacks on the BYO-cert work (
feat/gcp-bootstrap-public-access) — base is that branch.Draft: depends on the GCP plugin release carrying
formae-plugin-gcp#87
(
template.vpcAccess, secret-volumeitems,Resolvablesecret name). Thegcp@pin ingcp/PklProjectstays at0.1.9(vm modes unaffected); bump it to the #87 release toenable
--compute cloudrun. Undraft once that's published + pinned.What it renders (
--compute cloudrun)Shared substrate (VPC/subnet/NAT/PSA, private Cloud SQL + formae db, db/api secrets, agent
SA + IAM) + a config-secret (whole agent config rendered by Pkl, mounted as a volume)
+ a Cloud Run
Service(min=max=1,cpuIdle=false, port 49684, Direct VPC egressPRIVATE_RANGES_ONLY, Cloud SQL connector volume,ingress=INTERNAL_LOAD_BALANCER) + aserverless NEG + the reused LB chain (global address, backend service with no health
check, url map, HTTPS proxy, forwarding rule) + cert (SELF_MANAGED/MANAGED/by-name).
Verification (render matrix)
Against the local #87 schema:
{tailnet,public}× cert paths): byte-identical to pre-changeformae eval(zero regression).vpcAccess.egress, and a no-health-check backend service.--compute;cloudrun+tailnet;cloudrun+ts-authkey;cloudrunwith no cert.Not included
Live E2E (real project + domain + cert + creds) — the manual gate; pending the plugin release.