Cluster.Docker reference
Database
Section titled “Database”Source:
packages/effect-cluster/src/Docker/Database.ts
The database an Effect Cluster coordinates through, on a Docker swarm, as
an Cluster.Database Layer: Postgres as a one-replica swarm service
with its data on a named volume, on an overlay network the pool’s runners join.
The Docker engine must be in swarm mode (docker swarm init).
One Postgres on one disk is meant for development and tests.
Database: Running a local database
Section titled “Database: Running a local database”export const Database = ClusterDocker.Database("Cluster");SwarmPool
Section titled “SwarmPool”Source:
packages/effect-cluster/src/Docker/SwarmPool.ts
Run a pool of Effect Cluster runners on a Docker swarm: a swarm service whose
tasks host every Cluster.Entity given this pool, on the
database’s overlay network. Runners find each other through the
database and talk on the network; the gateway is served on the same
network. Requires an Cluster.Database on a Docker network —
ClusterDocker.Database.
Every entity given the same pool shares it: declare the pool once and provide them to each class.
SwarmPool: Running entities on Docker
Section titled “SwarmPool: Running entities on Docker”export const Database = ClusterDocker.Database("Cluster");export const Default = ClusterDocker.SwarmPool("Default", { replicas: 2 }).pipe( Layer.provide(Database),);