The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 78 lines 3.7 KB
Raw
1 ---
2 title: Choosing a runtime
3 description: Cloud Run services vs jobs vs worker pools vs Cloud Functions vs GKE — what each one is for and what it costs to run.
4 ---
5
6 Every Alchemy app on GCP needs somewhere for its code to run. Each
7 runtime takes the same Effect program: you bundle it with `main`, bind
8 resources to it, and Alchemy grants the IAM.
9
10 - **Cloud Run service** (`GCP.Function`) — an HTTP server that scales
11 to zero. **Use this by default.**
12 - **Cloud Run job** (`GCP.Run.Job`) — a batch task that runs to
13 completion and exits.
14 - **Cloud Run worker pool** (`GCP.Run.WorkerPool`) — always-on
15 containers with no URL, for queue consumers.
16 - **Cloud Function** (`GCP.CloudFunctions.Function`) — an HTTP
17 function built in the cloud, with no local Docker.
18 - **GKE** (`Kubernetes.Deployment` on `GCP.Container.Cluster`) —
19 Kubernetes workloads on a cluster you own.
20
21 ## At a glance
22
23 | | Service | Job | Worker pool | Cloud Function | GKE |
24 | --------------- | ------------------------ | --------------------------- | ---------------------------- | ------------------------------ | -------------------------------------- |
25 | Entry | `fetch` | `run` | `run` or a pull event source | `fetch` | `fetch` or `run` |
26 | Triggered by | HTTP, push event sources | `RunJob`, Cloud Scheduler | Nothing: always running | HTTP, push event sources | HTTP via a load balancer, Jobs on apply |
27 | Cost shape | Per request; zero idle | Per execution; zero idle | Per running instance | Per request; zero idle | Cluster plus pods |
28 | Packaging | Image built locally | Image built locally | Image built locally | Source built by Google | Image built locally |
29 | Deploy time | About a minute | About a minute | About a minute | A few minutes | Cluster: ~10 min. Pods: seconds |
30
31 ## Cloud Run service — the default
32
33 An HTTP container that scales with traffic and down to zero. It serves
34 many requests per instance, streams responses, and runs your `fetch`
35 handler as-is. Pub/Sub, Cloud Storage, Cloud Scheduler, and Eventarc
36 can all push to it.
37
38 → [Cloud Run](/gcp/compute/cloud-run)
39
40 ## Cloud Run job — batch work
41
42 A container with a `run` entry. It starts, does the work, and exits.
43 Nothing is billed between executions. Start it from a service with the
44 `RunJob` binding, or on a timer with Cloud Scheduler.
45
46 → [Cloud Run jobs](/gcp/compute/jobs)
47
48 ## Cloud Run worker pool — background consumers
49
50 A pool of containers with no URL. It suits a worker that pulls from
51 Pub/Sub around the clock and should keep running whether or not
52 anyone sends HTTP traffic.
53
54 → [Worker pools](/gcp/compute/worker-pools)
55
56 ## Cloud Functions — no Docker needed
57
58 A 2nd-gen Cloud Function runs on Cloud Run underneath. The difference
59 is the build: Alchemy uploads your bundled program and Google builds
60 it, so you can deploy from a machine without Docker.
61
62 → [Cloud Functions](/gcp/compute/cloud-functions)
63
64 ## GKE — Kubernetes
65
66 Reach for GKE when you need Kubernetes itself: Helm charts, long-lived
67 pods, custom networking, or workloads you already run elsewhere.
68 Bindings work the same way. They grant roles to the pod's identity
69 through Workload Identity.
70
71 → [GKE](/gcp/compute/gke)
72
73 ## Where next
74
75 - [Cloud Run](/gcp/compute/cloud-run) — the runtime the rest of these
76 docs build on.
77 - [How bindings grant IAM](/gcp/security/iam) — what happens when a
78 runtime binds a resource.