← Back to projects

Temporal Workers Union

A rainbow deployment system for versioned Temporal workers on Railway.

GoTemporalRailwayProtobufGraphQL

While working on Glaive and the Batch Inference API, we hit a common Temporal pain point: deploying code changes while long-running workflows were still active.

What's Temporal? Temporal is a workflow orchestration platform where workflows can run for seconds, hours, or months. The Temporal server maintains workflow state and dispatches work to workers—your code running on your infrastructure. This separation is powerful but creates a versioning problem: if you update worker code while workflows are mid-execution, you can break them.

Temporal's worker versioning solves this, but managing multiple worker versions manually slows down shipping. I built a system at Glaive to handle this automatically, and later extracted the core patterns into a standalone open-source service.

Whenever you commit worker code the server would automatically:

  1. Deploy a new version of your workers to Railway.
  2. Register the new version with Temporal.
  3. Clean up old worker versions once they've drained.

The server treats whatever commit it's built with as the "latest" version, so rolling back is as simple as redeploying an older commit and the previous workers automatically become current again.

Key features:

Zero-downtime deploys: Ship workflow changes without breaking running workflows.

Automatic cleanup: Drained workers are removed automatically based on Temporal's deployment status.

Horizontal scaling: New workers deploy with the same replica count as before, adjustable via the UI.

Simple rollbacks: Redeploy an old commit and the workers follow.

Check out the source code to see the implementation.


Note: This was built on a pre-release of Temporal's worker versioning. Temporal has since officially released worker versioning, but the core deployment patterns and architecture remain relevant.