Skip to content

Cluster.Fly reference

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

The database an Effect Cluster coordinates through, on Fly.io, as a Cluster.Database Layer: Postgres on a Fly Machine with a volume, in an App on a private network that the pool’s runners join. Nothing outside the network reaches it.

One Postgres on one volume is meant for development and small clusters; for Fly’s Managed Postgres, pass its URL to Cluster.Database.fromUrl.

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

Source: packages/effect-cluster/src/Fly/MachinePool.ts

Run a pool of Effect Cluster runners on Fly.io: a Fly Service whose Machines host every class given this pool, on the database’s private network. Runners talk to each other and the database over the network; the Service serves their gateway at https://{name}.fly.dev to callers anywhere. Requires a database on a Fly network — ClusterFly.Database.

export const Database = ClusterFly.Database("Cluster");
export const Default = ClusterFly.MachinePool("Default", { replicas: 2 }).pipe(
Layer.provide(Database),
);