The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
TL;DR
Declare the GCP project, bootstrap its prerequisites, load application values, then preview, apply and verify convergence.
Deploy BoxLite on GCP
Cloud guide · Infrastructure index
Prerequisites
| Provide | Requirement |
|---|---|
| Project | A separate project for each stage, with billing enabled and bootstrap permissions |
| Region and zone | GKE, Cloud SQL, Redis and nested-KVM capacity; a supported N4 zone |
| Local tools | Node.js 22+, Git, gh, gcloud and Pulumi CLI |
| Build tools | Docker/buildx when publishing locally |
| DNS and identity | Cloudflare zone/token and an OIDC issuer, SPA client and API audience |
Run make _ensure-infra-deps from the repository root, then work from apps/infra.
Copy .mstage.config.example.json to .mstage.config.json and declare home: "gcp",
the exact project, region, zone, protection and resource sizing. See configuration.
The manual workflow accepts dev, stage and prod; stage follows dev for commit/PR candidates, while published stable releases run from main.
The example's dev2 works locally but is not a workflow choice.
Bootstrap a stage
npm run mstage login -- --stage dev
npm run mstage aws whoami -- --stage dev
npm run bootstrap -- --stage dev
npm run mstage config put -- --stage dev
The historical mstage aws whoami command reports the selected cloud's identity, including GCP.
Use login ... --force when sign-in is needed; both gcloud CLI and ADC sessions are required.
Bootstrap needs broader privileges than the deployer it creates. A protected stage requires --confirm.
Use --repo owner/name to select GitHub explicitly; --reviewers accepts numeric GitHub user IDs.
| Bootstrap owns | Result |
|---|---|
| Cloud prerequisites | Service APIs, state/artifact buckets, Secret Manager bootstrap/key, Artifact Registry and OS Config enablement |
| CI identity | Workload Identity Federation, deployer and image publisher service accounts |
| GitHub Environment | Provider/deployer/publisher variables |
Bootstrap does not import application values or create Auth0 identities. Populate required
manifest keys with mstage, including OIDC_CLIENT_ID and the pulumi group.
Use secret stdin or protected JSON input.
Generate a strong PULUMI_CONFIG_PASSPHRASE once and preserve it for existing state.
Then certify the imported configuration:
npm run mstage env set -- --stage dev --digest
npm run mstage env digest -- --stage dev
npm run mstage env list -- --stage dev --select-group deploy
Configure OIDC callbacks for the actual dashboard host. See identity and mail for Auth0 and optional SMTP; use the shared branding procedure. Recheck live GitHub Environment reviewers after bootstrap. Bootstrap creates prerequisites; it does not deploy application services or prove they are healthy.
Preview and apply
Follow the shared GitHub Actions workflow
or local preview/apply commands.
mdeploy uses Pulumi with GCS state. API/dashboard, collector and registry proxy run on Cloud Run,
the proxy runs on GKE Autopilot, and runners use Compute Engine; see architecture.
Cloudflare credentials come from the encrypted deploy group.
The API, collector, registry proxy and both Secret Server services set Service metadata labels.stage; the GKE Proxy cluster sets resourceLabels.stage.
Both use the deployed stage, for example dev, so Backoffice can select matching resources.
Apply these labels before enabling strict inventory filtering; unlabeled resources remain excluded until deployment and Cloud Asset indexing complete.
Verify and recover
Run the shared service checks, then inspect OS Config reports and runner health. Pulumi apply returns before the fleet necessarily converges. Check gcloud and ADC identity separately for credential failures. Use networking for private routes/firewalls and ClickHouse for ingestion failures. For locks, refresh or removal, follow shared recovery.
New Cloud SQL instances start with log_connections=on. Operators manage the full flag list after creation.
Refresh the Pulumi checkpoint before the first update to an existing instance and after changing flags outside Pulumi.
Subsequent updates reuse the flags recorded in that checkpoint.
Customer domain HTTPS
The GCP deployment automatically supplies the certificate project and the existing proxy certificate map to the API.
These are deployment-owned values, not stage inputs. Customer traffic uses the existing PROXY_DOMAIN hostname;
there is no separate custom-domain traffic-host setting. AWS and local deployments without certificate resources leave onboarding disabled.
Customers use a traffic CNAME to this hostname. HTTPS checks resolve the platform hostname's IPv4/IPv6 addresses and connect with the customer hostname as SNI, requiring certificate validation; no fixed IP list is configured. The existing edge address, forwarding rule and DNS records retain their resource identities.
The GCP bootstrap enables Certificate Manager and Resource Manager, and the edge attaches its certificate map to the proxy.
The API service account's custom roles are deployed before the API revision.
Resource-name conditions restrict certificate and DNS authorization operations, including creation, to byo-* resources;
map-entry operations are restricted to byo-* entries in the deployed proxy certificate map.
A separate role grants only project and operation queries; neither role grants certificate-map mutation.
The API also requires its existing Commerce connection for subscription eligibility.
Customer CNAME records must use DNS-only mode; see the DNS guide.
Custom domains set Cloud Run cpuIdle: false, incurring CPU costs while an instance exists, without adding a minimum instance count.
In the mstage declaration, "instance": { "cpu": 2, "memoryMiB": 2048 } under deploy.api
requests 2 vCPU and 2 GiB for each API container. Set both fields together, or omit instance
to leave container limits unspecified. CPU and memory must fit the
Cloud Run service limits.
Set deploy.api.minInstances in the mstage declaration to override the service-level minimum (for example, 5).
An explicit 0 allows scale-to-zero even with hosted CI. When omitted, hosted CI sets a minimum of one; otherwise the minimum is omitted.
Set deploy.api.maxInstances to a positive integer (for example, 15) to cap both the service and its new revision.
The maximum must be at least the configured minimum. Omitting it leaves the maximum unspecified.
The API task runs at startup and every minute, advancing at most three due confirmed setups and one maintenance round. Startup awaits that work; hostname leases coordinate replicas, and shutdown awaits the active round. Scale-to-zero pauses progress until the API starts again; no independent Cloud Scheduler or expiration alerts are provisioned.
For upgrades from the earlier custom-domain workflow, drain old API revisions and in-flight leases before applying the migration and enabling new writers. Mixed old/new writers are unsupported; retain resource identities and use a compatible forward fix for rollback. Unconfirmed legacy setups require explicit verification, and capped legacy deadlines do not establish certificate expiration.
Maintenance expires unconfirmed, unclaimed drafts after thirty idle days, observes ready TLS/certificates hourly,
and revisits cleaned tombstones daily for late cloud creates. Unbind and subscription suspension retain cloud resources.
Admin POST /admin/custom-domains/maintain invokes one bounded maintenance round for recovery.
Before production use, verify issuance, customer SNI, public Box access, suspension, recovery and deletion with a controlled hostname. Monitor due-work age and cleanup backlog, and configure certificate-expiration alerts with a notification channel. Cleanup and monitoring during API inactivity require an independent trigger.
Sources: bootstrap, Pulumi entrypoint.