Skip to content

Cluster.GCP reference

Source: packages/effect-cluster/src/GCP/ComputeEnginePool.ts

Run a pool of Effect Cluster runners on Compute Engine: instances in the database’s VPC, spread across zones, each running every class given these runners from a Cloud Storage bucket, behind a regional load balancer on a static address that serves their gateway to callers anywhere. Runners reach each other and the database through the cluster’s network tag. Requires a database on a GCP network — ClusterGCP.Database.

Cloud Run can’t host runners: runners take connections from each other.

ComputeEnginePool: Running on Compute Engine

Section titled “ComputeEnginePool: Running on Compute Engine”
export const Database = ClusterGCP.Database("Cluster");
export const Default = ClusterGCP.ComputeEnginePool("Default", { replicas: 2 }).pipe(
Layer.provide(Database),
);

Source: packages/effect-cluster/src/GCP/Database.ts

The database an Effect Cluster coordinates through, on Compute Engine, as a Cluster.Database Layer: Postgres on an instance with a persistent disk, in a VPC of its own that the pool’s runners join. Only the runners reach it; runners reach each other on the runner port.

export const Database = ClusterGCP.Database("Cluster");