Rivet.Docker reference
ServicesPool
Section titled “ServicesPool”Source:
packages/rivet/src/Docker/ServicesPool.ts
Run Rivet Services on a Docker swarm: the services pool on the control
plane, and a swarm service running Rivet’s prebuilt Services node, which
hosts Durable Streams and agentOS. Its tasks join the control plane’s
overlay network and publish no ports: callers reach every stream through
the control plane’s gateway, with its token. Requires a Rivet.Cluster
on a Docker network — RivetDocker.SwarmControlPlane.
ServicesPool: Running Rivet Services on Docker
Section titled “ServicesPool: Running Rivet Services on Docker”export const Cluster = RivetDocker.SwarmControlPlane("Rivet");export const Services = RivetDocker.ServicesPool("Services").pipe(Layer.provide(Cluster));SwarmControlPlane
Section titled “SwarmControlPlane”Source:
packages/rivet/src/Docker/SwarmControlPlane.ts
A single-instance Rivet control plane on a Docker swarm, as a
Rivet.Cluster Layer: the engine as a one-replica swarm service with
file-system storage on a named volume, a generated admin token, an overlay
network that pools’ nodes join, and a namespace for the stage. The
Docker engine must be in swarm mode (Docker.Swarm, or docker swarm init).
It is meant for development and tests. One instance keeps recent writes only on its own disk, so losing the volume loses data; production control planes run three or more instances.
SwarmControlPlane: Running a local control plane
Section titled “SwarmControlPlane: Running a local control plane”A control plane for local Durable Objects
export const Cluster = RivetDocker.SwarmControlPlane("Rivet");On another port
export const Cluster = RivetDocker.SwarmControlPlane("Rivet", { port: 16420 });SwarmPool
Section titled “SwarmPool”Source:
packages/rivet/src/Docker/SwarmPool.ts
Run a pool’s nodes on a Docker swarm: a pool on the control plane, and a
swarm service whose tasks host every Rivet.DurableObject given this
pool and join the control plane’s overlay network. Nodes only connect
out to the control plane, so the service publishes no ports. Requires a
Rivet.Cluster on a Docker network — RivetDocker.SwarmControlPlane.
Every Durable Object given the same pool shares its nodes: declare the pool once and provide it to each class.
SwarmPool: Running Durable Objects on Docker
Section titled “SwarmPool: Running Durable Objects on Docker”A pool on the local swarm
export const Cluster = RivetDocker.SwarmControlPlane("Rivet");export const Default = RivetDocker.SwarmPool("Default").pipe(Layer.provide(Cluster));Two nodes
export const Default = RivetDocker.SwarmPool("Default", { replicas: 2 }).pipe( Layer.provide(Cluster),);