Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Twerk is a distributed task execution system written in Rust — a port of Tork from Go. It lets you define jobs consisting of multiple tasks, each running inside its own container.

Why Twerk?

  • Horizontally scalable — Add workers to handle more tasks
  • Task isolation — Tasks run in containers with resource limits
  • Multi-runtime — Docker, Podman, or Shell execution
  • Retry with backoff — Configurable retry on failure
  • Scheduled jobs — Cron-based scheduling with pause/resume
  • Secrets management — Auto-redaction of sensitive values
  • REST API — Full API for job, task, queue, node, and user management
  • Health checks — Built-in liveness and readiness probes

Architecture

Client → Coordinator → Broker → Worker → Runtime (Docker/Podman/Shell)
                ↓
            Datastore (PostgreSQL)
  • Coordinator — Receives jobs, schedules tasks, manages state
  • Worker — Executes tasks via the configured runtime
  • Broker — Routes tasks between Coordinator and Workers (RabbitMQ or In-Memory)
  • Datastore — Persists all job, task, and node state (PostgreSQL)

Modes

ModeDescription
standaloneAll-in-one: Coordinator + Worker in a single process
coordinatorAPI server that schedules work (requires workers)
workerExecutes tasks by pulling from broker

Next Steps