Skip to content

Rivet.Railway reference

Source: packages/rivet/src/Railway/ServicePool.ts

Run a pool’s nodes on Railway: a pool on the control plane, and a Railway Service that runs every Rivet.DurableObject given this pool. Nodes only connect out to the control plane, so the Service has no public domain and works with any control plane it can reach — RivetCloud.ControlPlane, or one on another cloud.

Every Durable Object given the same pool shares its nodes: declare the pool once and provide it to each class.

ServicePool: Running Durable Objects on Railway

Section titled “ServicePool: Running Durable Objects on Railway”
export const Cluster = RivetFly.MachineControlPlane("Rivet");
export const Default = RivetRailway.ServicePool("Default").pipe(Layer.provide(Cluster));

Source: packages/rivet/src/Railway/ServicesPool.ts

Run Rivet Services on Railway: the services pool on the control plane, and a Railway service running Rivet’s prebuilt Services node, which hosts Durable Streams and agentOS. It has no public domain and only connects out: callers reach every stream through the control plane’s gateway, with its token. Works with any control plane it can reach.

ServicesPool: Running Rivet Services on Railway

Section titled “ServicesPool: Running Rivet Services on Railway”
export const Services = RivetRailway.ServicesPool("Services").pipe(Layer.provide(Cluster));