Self-Hosting Deployments
For self-hosted or Cloud runtime changes, follow moving between runtimes. Keep existing runs at their source while new starts move.
Durable Workflow v2 supports several self-hosted shapes. Pick the smallest path that matches the environment you operate, then keep the image, database, cache, auth, readiness, and upgrade contract explicit.
This guide covers the standalone server distribution. If you run the Laravel package embedded in your own app, use the package installation and configuration pages instead. Durable Workflow Cloud is a separate managed-service choice in which Cloud operates the runtime, persistence, placement, and recovery; a self-hosted Server is never attached to Cloud. See Cloud Managed Runtime. The current Cloud contract is a single-region managed runtime and recovery boundary; it does not promise multi-region replication, automatic regional failover, or failback.
The self-hosted Server distribution does not bundle or operate Waterline. Deploy Waterline separately only when you want its operator UI, and connect it to a Server-owned namespace using the Waterline deployment and monitoring guide. Cloud instead includes Managed Waterline for its managed namespace.
The current Server is the native 3.x Server (durableworkflow/server:3.31.2).
It runs as one process per node: it creates and checks its own database schema
at startup and fires timers and schedules and runs its maintenance passes
itself, so there is no bootstrap job, queue worker, scheduler or Redis. PHP
Server 2.x is frozen at 2.11.8 and receives no further releases.
PHP Server 2.11.8 is retired and unpatched for the November Laravel advisories. For pinned PHP deployments, follow the conditional exposure and ingress/signed-link actions before using the legacy recipes below.
The PHP 2.x stack (server, queue worker, scheduler, bootstrap job and Redis)
remains available. At the 2.11.8 release tag it is
docker-compose.published.yml;
from 3.0.0 the Server repository keeps the same stack as
docker-compose.php.yml.
Existing PHP 2.x installations can move to native with upgrade-takeover by
following the native takeover runbook.
It is qualified on the published 3.0.4 image (arm64) for databases written by
PHP 2.11.8 on SQLite, MySQL 8.0 and PostgreSQL 17. MariaDB, amd64 and databases
from other PHP releases (layouts 2.8.0–2.11.8) have source-CI coverage only.
Takeover is one-way and backup-first, and PHP must be stopped. It refuses
databases and state it cannot carry over; the runbook's
refusal tables
list each case. Rehearse it on a restored copy of your backup first. There is
no PHP rollback after takeover, and takeover is planned for deprecation in the
3.1.x line. Sections below that mention Redis, a
queue worker, a scheduler or bootstrap describe the PHP 2.x topology.
Deployment support matrix
| Path | Start from | Supported for | Not promised by this path | Commercial support starts when |
|---|---|---|---|---|
| Local development and internal non-production | docker-compose.published.yml with DW_SERVER_IMAGE=durableworkflow/server:3.31.2 | One developer machine, LAN demos, shared staging, SDK and worker integration tests | Internet-facing production, durable backup guarantees, strict secret rotation, multi-node failover | You want help turning a working dev stack into a production runbook |
| Single-node production | docker-compose.published.yml with a production env file, MySQL and Server storage volumes, a strong shared token plus role-scoped tokens, backups, TLS through a reverse proxy, and pinned image tags or digests | One VM, VPS, or internal Docker host with persistent workflow state and a simple operational model | Host-level HA, automatic database failover, multi-region recovery, zero-downtime major topology changes | The deployment carries production traffic and you want review of backup, restore, auth, TLS, upgrade, or rollback procedures |
| Small clustered deployment (PHP 2.x contract) | Published PHP 2.x durableworkflow/server or ghcr.io/durable-workflow/server images using the PHP 2.11.8 Compose recipe as the container/process template, with 2-3 API nodes, shared external MySQL/PostgreSQL, shared Redis, independently scaled workers, and exactly one scheduler/maintenance runner | Horizontal API and worker capacity when one node is no longer enough; rolling upgrades when every guarantee in the rolling-upgrade contract holds | SQLite clustering, Redis-less multi-node mode, duplicate schedulers as a steady-state topology, active/active multi-writer databases, self-hosted hands-free regional failover, broad "five-nines" or "zero-downtime" SLA promises, and self-serve single-region HA failover until its release-evidence gate passes | You need sizing, failure-domain, rollout, or recovery planning across more than one host, or you intend to claim the gated single-region HA behavior |
| Helm chart for Kubernetes | The Server-owned Helm chart from oci://ghcr.io/durable-workflow/charts/durable-workflow, with your external MySQL or PostgreSQL database, ingress, and secret management | A repeatable production install and upgrade path. Native mode (the default) renders one Server Deployment with service, probes, and policy resources; runtime=php keeps an existing PHP 2.x install's worker, singleton scheduler, bootstrap job and Redis | Bundled persistence, provider-managed infrastructure, active/active multi-region, custom operators, and self-serve single-region HA failover until its release-evidence gate passes | You need provider-specific architecture, capacity, recovery, or changes outside the chart's published values contract |
| Raw Kubernetes manifests (PHP 2.x shape) | The server repository k8s/ manifests, using published PHP 2.x server images and your existing database, Redis, ingress, and secret management | Teams that already operate Kubernetes and want inspectable manifests for API, worker, scheduler, bootstrap, service, probes, config, and secrets | The separate Helm lifecycle, managed-Kubernetes provider validation, active/active multi-region, custom operators, environment-specific storage/networking/security decisions, and self-serve single-region HA failover until its release-evidence gate passes | You need overlays, managed-cluster validation, provider-specific production planning, or intend to claim the gated single-region HA behavior |
| Active/passive multi-region evaluation | A validated single-node or small-cluster deployment per region, plus asynchronous database replication from active to standby and a reviewed failover/failback runbook | Support-led architecture evaluation and environment-specific rehearsal for regional disaster recovery | A proven self-serve 2.0 contract, active/active multi-region, automatic or hands-free regional failover, synchronous cross-region replication (RPO=0), cross-region active visibility or federated search, or region-pinned task queues as an engine-enforced routing axis | Before relying on cross-region replication, failover, failback, RPO, or RTO in production |
| Support-led topologies | A reviewed design based on your environment | Self-hosted active/passive or active/active multi-region, hands-free regional failover, RPO=0 cross-writer replication, duplicate scheduler runners as a steady-state topology, bespoke security/networking, private SLOs, custom overlays, migration planning | Self-serve copy/paste operation | The topology itself is part of the product risk |
The public distribution is intentionally optimized for local development, single-node production, and small clustered deployments. Kubernetes manifests are provided for teams that already operate Kubernetes. Active/passive multi-region material is available as a support-led evaluation guide (see Active/passive multi-region below), not as a proven self-serve 2.0 contract. Single-region HA failover — managed-database failover, managed-Redis failover, API-node loss, worker loss, and scheduler-runner restart inside one region — is currently support-led while its exact-release evidence gate remains closed (see Single-region high availability and failover below). For self-hosted server deployments, active/active multi-region, automatic regional failover, duplicate scheduler runners as a steady-state topology, and provider-specific managed-Kubernetes validation remain support-led because they depend on your database, cache, networking, security, runner, and upgrade choices. The published Helm chart is a self-serve packaging path within those same operator-owned boundaries. Cloud currently provides single-region managed operation and recovery, not multi-region replication or regional failover; see Cloud Managed Runtime. See the support boundary for the commercial support model.
Production recovery deliverables
Calling a topology "production-ready" means publishing the recovery packet for that topology, not just starting the containers. Keep the latest evidence in the same runbook as the deployment commands:
| Path | Minimum published recovery packet |
|---|---|
| Single-node production | Backup schedule, pinned image or digest, env/config snapshot location, maximum accepted restore lag, and the latest successful restore rehearsal timestamp plus verification evidence. |
| Small clustered deployment | The single-node packet plus the expected impact of losing one API node, one worker node, the scheduler/maintenance runner, Redis, or the shared database; the worker re-registration steps after restore; and the documented rolling-upgrade or stop-the-world posture for the current release. |
| Helm chart for Kubernetes | The clustered packet plus chart version, values revision, image digest, cluster-specific ingress and secret owners, and the latest chart upgrade/rollback rehearsal. |
| Raw Kubernetes manifests | The clustered packet plus the cluster-specific storage, secret, ingress, and rollout owners that must be restored or re-applied before traffic is declared healthy again. |
| Single-region HA evaluation (support-led while the release-evidence gate is closed) | The clustered or raw-manifest packet plus rehearsal evidence for managed-database failover, managed-Redis failover, API-node loss, worker loss, and scheduler-runner restart, each completing within the recovery target published in the Single-region HA contract without acknowledged-write loss. |
| Active/passive multi-region evaluation (support-led) | The per-region packet plus the database replication and fencing design, measured replication lag, operator-owned RPO/RTO, promotion and failback runbooks, and environment-specific rehearsal evidence. |
If you cannot produce that packet on demand, treat the environment as staging until the recovery contract is written down and rehearsed. The Operator Operating Envelope defines the restore order, verification pass, and rehearsal cadence those packets must follow.
Security, Data, And Audit Posture
Self-hosted Durable Workflow deployments inherit most security controls from the environment you operate. Publish these facts in the same release or runbook packet as the image tag, migration plan, and recovery evidence:
| Posture area | Honest release statement |
|---|---|
| Data handling | Workflow arguments, results, history, memos, search attributes, visibility labels, command context, audit rows, exception messages, and operator notes can contain customer application data. Workflow IDs, search attributes and labels are operator-visible metadata, not secret storage. Workflow IDs remain plaintext and are not covered by payload codecs. |
| Encryption | Use TLS for every production HTTP surface and configure database TLS on every Server role, including migrations. At-rest encryption comes from your database, object storage, filesystem, queue, cache, and secret manager. The workflow package and server do not automatically encrypt each payload field. |
| Compliance | The open-source package and self-hosted server provide controls and audit evidence, not a compliance certification by themselves. Claims such as SOC 2, HIPAA, PCI, ISO, or FedRAMP belong to your own program unless a hosted offering documents otherwise. |
| Audit logs | Workflow commands, schedule audit events, history export metadata, and service-call records provide durable operational evidence. They are not a complete SIEM, DLP system, immutable external ledger, or legal-hold system unless you add those components. |
| Support | Role-scoped credentials, TLS termination, backups, restore rehearsal, and narrow self-serve topologies are documented here. Advanced identity, mTLS rollout, private networking, custom policy engines, provider compliance, and bespoke topology review are support-led unless public docs say otherwise. |
Network posture must be explicit:
- Webhook ingress: document the public endpoint, auth method, replay or idempotency strategy, timeout, payload limit, trusted proxy-header configuration, and secret rotation plan.
- Worker-to-backend traffic: use TLS verification, role-scoped worker credentials, namespace headers, private networking or mTLS when workers cross an untrusted network, and rotation that does not grant operator capabilities to worker tokens.
- Operator surfaces: place Waterline, standalone-server operator APIs, CLI automation endpoints, and custom admin panels behind authenticated sessions or role-scoped service credentials, with CSRF protection for browser sessions and documented proxy/TLS boundaries.
Published images
Use published images for self-hosted server deployments:
- Docker Hub:
durableworkflow/server:3.31.2 - GitHub Container Registry:
ghcr.io/durable-workflow/server:3.31.2 - Digest pinning:
durableworkflow/server@sha256:...orghcr.io/durable-workflow/server@sha256:...
Use mutable tags only for local experiments. Production env files should pin a
specific version tag or digest so upgrade and rollback steps are auditable.
Native releases are major version 3; the rolling 3 and latest tags move to
each new native release, and 2 stays on the last PHP 2.x release.
Local development and internal non-production
Use the published-image Compose recipe when you want a source-free stack: the
native Server and MySQL. Fetch the file from the selected release and pin the
image with DW_SERVER_IMAGE:
curl -fsSLO https://raw.githubusercontent.com/durable-workflow/server/3.31.2/docker-compose.published.yml
export DW_SERVER_IMAGE=durableworkflow/server:3.31.2
export DW_AUTH_TOKEN=dev-token
docker compose -f docker-compose.published.yml up -d --wait
Compose refuses to start until DW_AUTH_TOKEN is set. The file publishes the
API on 127.0.0.1:8080 only and does not publish MySQL. Set
SERVER_BIND_ADDRESS to a protected private interface for remote access.
Verify the API, readiness, cluster discovery, and worker registration:
curl http://localhost:8080/api/health
curl http://localhost:8080/api/ready
curl -H "Authorization: Bearer $DW_AUTH_TOKEN" \
http://localhost:8080/api/cluster/info
curl -X POST http://localhost:8080/api/worker/register \
-H "Authorization: Bearer $DW_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-H "X-Namespace: default" \
-H "X-Durable-Workflow-Protocol-Version: 1.0" \
-d '{"worker_id":"compose-worker","task_queue":"compose","runtime":"python"}'
This path is safe for development and internal staging. It is not a production security boundary: the example uses one shared token, default service passwords, local named volumes, and no TLS.
Single-node production
Use the same Compose artifact with production configuration outside source control:
DW_SERVER_IMAGE=durableworkflow/server:3.31.2
SERVER_PORT=8080
# Loopback by default. Use a protected private interface for the reverse proxy.
SERVER_BIND_ADDRESS=127.0.0.1
DB_DATABASE=durable_workflow
DB_USERNAME=workflow
DB_PASSWORD=replace-with-random-password
DB_ROOT_PASSWORD=replace-with-random-root-password
DW_AUTH_DRIVER=token
# Required. Native accepts the shared token for every role; keep it secret.
DW_AUTH_TOKEN=replace-with-random-shared-token
DW_WORKER_TOKEN=replace-with-worker-token
DW_OPERATOR_TOKEN=replace-with-operator-token
DW_ADMIN_TOKEN=replace-with-admin-token
The native Server requires DW_AUTH_TOKEN and refuses to start with
DW_AUTH_BACKWARD_COMPATIBLE=false, so the shared token cannot be disabled.
Treat it like the admin token, and give workers and applications the narrower
role-scoped tokens.
Start with that env file:
docker compose --env-file durable-workflow.prod.env \
-f docker-compose.published.yml up -d --wait
Operate the host as a production service:
- Put TLS, public routing, request logging, and IP allow lists in a reverse proxy in front of the API container.
- Do not expose MySQL publicly.
- Use
DW_WORKER_TOKENfor workers,DW_OPERATOR_TOKENfor application and operator traffic, andDW_ADMIN_TOKENfor namespace and administrative work. - Back up the MySQL volume before every image upgrade and on a regular
schedule; it is the durable workflow-history source of truth. The
server_storagevolume holds the Server's local external payload objects: back it up with MySQL, because a recovery point needs both. See the self-hosted backup and restore procedure. - Keep the exact env file, image tag or digest, and database backup together for restores.
Upgrade order:
- Back up MySQL and
server_storage, and record the current image reference. - Change only
DW_SERVER_IMAGE. - Pull the new image with
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml pull. - Run
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml up -d --wait. - Confirm
/api/ready,/api/cluster/info, and worker registration before shifting external traffic.
The native Server checks its schema at startup. Patch releases within a native
minor line keep the schema, so changing the image is enough. A release whose
notes announce a schema change also needs the image's schema-upgrade command,
run after a database backup while every Server is stopped. The Server reference keeps the latest
command-level Compose examples in the
Official Image + Compose
section.
Upgrading to Server 3.10.0
Native 3.10.0 requires an explicit additive schema upgrade from 3.9.x:
| Backend | Schema transition from 3.9.x |
|---|---|
| SQLite | 13 → 14 |
| PostgreSQL | 14 → 15 |
| MariaDB | 14 → 15 |
| MySQL | 15 → 16 |
Stop every Server replica, keep the database running, and back up the database
and external-payload storage. Select the 3.10.0 image and run its
schema-upgrade once before restarting every replica on the same version.
Check readiness, reported version and worker registration. Startup does not
upgrade an old schema automatically. Older versions require the intervening
steps too. The published 3.10.0 upgrade instructions
provide the Compose commands. Worker protocol 1.20 and control plane 2 are unchanged.
The nullable schedule summary is not backfilled from legacy action arrays. Existing schedules remain unavailable until an owning transition records a valid summary; see dispatch-summary authority. MySQL and MariaDB resume interrupted upgrades; SQLite and PostgreSQL apply the step transactionally. Rollback to an older binary requires restoring the pre-upgrade database and storage backup. Do not run an older binary against the newer schema.
Upgrading to Server 3.9.2
Upgrading from native 3.8.x or earlier requires a schema upgrade on every
backend. Server 3.9.1 adds the empty dw_command_intents table:
| Backend | Schema transition from 3.8.x |
|---|---|
| SQLite | 12 → 13 |
| PostgreSQL | 13 → 14 |
| MariaDB | 13 → 14 |
| MySQL | 14 → 15 |
Stop every Server replica, keep the database running, back up the database and
Server storage, then select and pull the 3.9.2 image. Run that image's
schema-upgrade once before restarting every replica on the same version.
Server does not upgrade an existing schema at startup: it refuses an old
schema with native_schema_upgrade_required. Verify readiness, reported
version and worker registration after restart. The
qualified 3.9.2 release instructions
provide the source-free Compose commands.
MySQL and MariaDB upgrades resume after interruption; SQLite and PostgreSQL
apply the step transactionally. Rollback to 3.8.x requires restoring the backup:
3.8.0 refuses the upgraded database with native_schema_newer_than_binary.
From 3.9.0 or 3.9.1, no further schema step is needed: stop replicas, back up,
select the new image, restart and verify readiness, version and worker
registration. Physical schema and existing command/intent rows are unchanged.
Rollback to 3.9.1 uses the same schema but restores the Unicode-key/receipt
metadata defects and removes observation-owner hardening. From older versions,
schema-upgrade applies the earlier steps too, including the
3.7 JSON rebuild where applicable. Worker protocol
1.20 and control plane 2 are unchanged.
Upgrading to Server 3.8.0
Server 3.8.0 needs a native schema upgrade on every backend. It adds one
native-only table, dw_task_queue_pauses, which is created empty:
| Backend | Schema |
|---|---|
| SQLite | 11 → 12 |
| PostgreSQL | 12 → 13 |
| MariaDB | 12 → 13 |
| MySQL | 13 → 14 |
The step only creates the table; it rewrites no rows and takes seconds. A
Server never upgrades its schema at startup: a 3.8.0 Server started on the
earlier schema refuses with native_schema_upgrade_required. For the
single-node Compose deployment:
-
Stop the Server and leave MySQL running:
docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml stop server -
Back up MySQL and
server_storage, and record the current image reference. This backup is the only way back to 3.7.x. -
Change
DW_SERVER_IMAGEto the 3.8.0 image, pull it and runschema-upgradeonce:docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml pull serverdocker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml run --rm --no-deps server schema-upgradeFrom 3.7.x on MySQL it reports
"from_schema_version":13,"schema_version":14,"status":"upgraded". Run again on a current database, it reports"status":"current". -
Start the Server with
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml up -d --wait, then confirm/api/ready,/api/cluster/info(versionis3.8.0) and worker registration.
With several Servers on one database, stop every one of them before step 3
and start them all on 3.8.0 afterwards. On MySQL and MariaDB an interrupted
upgrade resumes when you run schema-upgrade again; SQLite and PostgreSQL
upgrade in one transaction. Rolling back to 3.7.x needs the backup: a 3.7.0
Server refuses the upgraded database with native_schema_newer_than_binary.
The worker protocol stays at 1.20 and the control plane at version 2.
From an earlier release, the 3.8.0 image's schema-upgrade applies every
earlier step in the same run. On MySQL from 3.5.x or 3.6.x (schema 12), that
includes the 3.7.0 JSON rebuild, with its
downtime of about 2 minutes per million history rows. From 3.4.x or earlier,
it includes the 3.5.0 schema step.
On MySQL, MariaDB and PostgreSQL, each pool connection now caches up to 200
prepared statements. On MySQL, every client's prepared statements count toward
the server-wide max_prepared_stmt_count (default 16382). A native node has 4
pool connections, so keep nodes × 4 × 200 plus other clients' statements
within that limit; a default MySQL server fits about 20 native nodes. For more,
raise max_prepared_stmt_count or lower the cache with
DW_NATIVE_DB_STATEMENT_CACHE_CAPACITY (or statement-cache-capacity in
DB_URL), a whole number from 0 to 4095. A Server given an invalid value, or
two different values, refuses to start. Prepared_stmt_count in
SHOW GLOBAL STATUS reports current use.
Server 3.8.0 also lets an operator pause and resume activity dispatch on one
task queue, advertised as capabilities.task_queue_activity_dispatch_pause
(see the
3.8.0 release).
Native redrive now reuses side effects and version markers recorded before the
failed step, with their original payloads and times.
Upgrading to Server 3.7.0
Server 3.7.0 stores MySQL JSON documents as exact text, so doubles keep every
digit. Only MySQL changes: its native schema moves from 12 to 13, and its 75
json columns in 36 tables become LONGTEXT (utf8mb4_bin) with an enforced
json_valid check, one ALTER TABLE per table. Documents already stored keep
MySQL's earlier rendering. A 3.7.0 Server started on MySQL schema 12 refuses
with native_schema_upgrade_required.
MariaDB and PostgreSQL stay at schema 12 and SQLite at 11, so a 3.5.0 or 3.6.0
database on them runs on 3.7.0 as it is: change only DW_SERVER_IMAGE and
follow the upgrade order above. Rolling back to 3.6.0 is an image change. From
3.4.x or earlier, every database also needs the
3.5.0 schema step; run it with the 3.7.0 image,
whose schema-upgrade applies the earlier steps too.
On MySQL the Server is down for the whole upgrade. Measured on MySQL 8.0 with 2 CPUs and the default buffer pool, it takes about 2 minutes per million history rows. For the single-node Compose deployment:
-
Stop the Server and leave MySQL running:
docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml stop server -
Back up MySQL and
server_storage, and record the current image reference. This backup is the only way back to 3.6.0 on MySQL. -
Change
DW_SERVER_IMAGEto the 3.7.0 image, pull it and runschema-upgradeonce:docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml pull serverdocker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml run --rm --no-deps server schema-upgradeOn MySQL it prints the schema versions before and after, for example
"from_schema_version":12,"schema_version":13,"status":"upgraded". Run again on a current database, it reports"status":"current". -
Start the Server with
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml up -d --wait, then confirm/api/ready,/api/cluster/info(versionis3.7.0) and worker registration.
An interrupted upgrade resumes table by table when you run schema-upgrade
again. Rolling back to 3.6.0 on MySQL needs the backup: a 3.6.0 Server refuses
the upgraded database with native_schema_newer_than_binary. The worker
protocol stays at 1.20 and the control plane at version 2.
Server 3.7.0 also changes native redrive (see the
3.7.0 release):
memos and search attributes set at start carry to the successor, and
describe reports actions.can_redrive and actions.redrive_blocked_reason.
Upgrading to Server 3.5.0
Server 3.5.0 adds one native-only table, dw_run_command_contracts. The
native schema moves from 11 to 12 on MySQL, MariaDB and PostgreSQL, and from
10 to 11 on SQLite. The upgrade creates the table and its index and rewrites
no rows. Server 3.4.x has the same schema as 3.3.x, so this is the only schema
step from 3.3.x or 3.4.x. A 3.5.0 Server started on the earlier schema refuses
with native_schema_upgrade_required.
For the single-node Compose deployment:
-
Stop the Server and leave MySQL running:
docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml stop server -
Back up MySQL and
server_storage, and record the current image reference. This backup is the only way back to 3.4.x. -
Change
DW_SERVER_IMAGEto the 3.5.0 image, pull it and runschema-upgradeonce:docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml pull serverdocker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml run --rm --no-deps server schema-upgradeIt prints the schema versions before and after, for example
"from_schema_version":11,"schema_version":12,"status":"upgraded". Run again on a current database, it reports"status":"current". -
Start the Server with
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml up -d --wait, then confirm/api/ready,/api/cluster/info(versionis3.5.0) and worker registration.
On MySQL and MariaDB, an interrupted upgrade resumes when you run
schema-upgrade again. Rolling back to 3.4.x needs the backup: a 3.4.x Server
refuses the upgraded database with native_schema_newer_than_binary. From
3.0.x through 3.2.x, the same command also applies the earlier steps described
in the next section. The worker protocol stays at 1.20 and the control plane
at version 2.
What changes for running workflows is in the 3.5.0 release notes: updates for runs started before their worker registered now bind that worker's contract instead of being rejected, sticky execution with history suffixes, and expired runs pruned every minute by the maintenance loop.
Upgrading from Server 3.0.x to 3.3.2
These are the earlier schema steps. If you go from 3.0.x straight to 3.5.0,
use the 3.5.0 image in step 3; its schema-upgrade applies these steps and the
3.5.0 step together, and the notes on PostgreSQL index builds and MySQL
resumption below still apply.
Server 3.3.2 crosses three minor releases from 3.0.x and changes the native
schema. On MySQL, MariaDB and PostgreSQL it moves from version 8 (3.0.x and
3.1.0) through 10 (3.2.0) to 11 (3.3.0 to 3.3.2). On SQLite it moves from 8
to 10. A Server never upgrades its schema at startup: 3.3.2 started on a
version 8 database refuses with native_schema_upgrade_required, so changing
DW_SERVER_IMAGE alone leaves the new Server unable to start. The 3.3.2
image's schema-upgrade command upgrades a version 8 database directly. The
3.3.0 upgrade notes
describe the step, and the Helm chart's
Chart 1.1.0 / Server 3.3.2 notes
list the schema steps and the runtime changes from 3.0.5 to 3.3.2.
For the single-node Compose deployment:
-
Stop the Server and leave MySQL running:
docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml stop server -
Back up MySQL and
server_storage, and record the current image reference. This backup is the only way back to 3.0.x. -
Change
DW_SERVER_IMAGEto the 3.3.2 image, pull it and runschema-upgradeonce:docker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml pull serverdocker compose --env-file durable-workflow.prod.env \-f docker-compose.published.yml run --rm --no-deps server schema-upgradeIt prints the backend and the schema versions before and after, for example
"from_schema_version":8,"schema_version":11,"status":"upgraded". On a database that is already current it only verifies the schema. -
Start the Server with
docker compose --env-file durable-workflow.prod.env -f docker-compose.published.yml up -d --wait, then confirm/api/ready,/api/cluster/info(versionis3.3.2) and worker registration.
- PostgreSQL: the version 10 and 11 steps build their indexes with a plain
CREATE INDEX, which blocks writes toworkflow_tasksuntil the build finishes. On a largeworkflow_taskstable, plan the downtime for it. - MySQL and MariaDB: DDL commits on its own there, so the upgrade marks the
database as upgrading until it finishes, and every Server refuses it
meanwhile with
native_schema_upgrade_incomplete. If an upgrade is interrupted, runschema-upgradeagain to resume it. - Rollback needs the backup. There is no schema downgrade. A 3.0.x Server
refuses an upgraded database with
native_schema_newer_than_binary. To go back, restore the backup taken in step 2, which discards everything written after it, and then start the 3.0.x image.
The worker protocol stays at 1.20 and the control plane at version 2.
Small clustered deployments
The validated small-cluster contract and its CI harness use the PHP 2.x Server: shared Redis, a queue worker and exactly one scheduler. Native 3.x has none of those roles, and no native Compose small-cluster recipe or harness has been published. For more than one native Server replica, use the Helm chart's native mode with an external MySQL or PostgreSQL database and a ReadWriteMany volume for payload storage.
A small cluster is a modest extension of the single-node model. The validated self-serve contract is intentionally narrow:
- Run 2-3 stateless API containers behind a load balancer. Health, readiness, cluster discovery, worker registration, workflow-task polling, and workflow-task completion must work without sticky sessions.
- Use one shared external MySQL or PostgreSQL database for durable history. SQLite is single-node only and is not a clustered persistence backend.
- Use shared Redis for cache, long-poll wake signals, query-task queue locks, task-queue admission locks, and queue state. Redis-less multi-node mode is not a supported clustered contract.
- Check
GET /api/cluster/infoon each API node during rollout.topology.current_shapeshould remainstandalone_server,topology.current_rolesshould includeapi_ingress,control_plane,matching, andhistory_projection, andtopology.execution_modeshould remainremote_worker_protocolfor standalone server nodes. Usetopology.matching_roleto confirm the matching path you actually deployed: default nodes reportqueue_wake_enabled: true,shape: "in_worker", andwake_owner: "worker_loop", while dedicated matching rollouts flip nodes withDW_V2_MATCHING_ROLE_QUEUE_WAKE=0toqueue_wake_enabled: false,shape: "dedicated", andwake_owner: "dedicated_repair_pass". The same block should continue to advertise the intendedtask_dispatch_mode, the frozen routing axes inpartition_primitives, and the currentbackpressure_model. See Server Role Topology for the field-by-field meaning of the topology manifest. - Scale external SDK workers independently from API nodes. Workers can run on separate hosts or processes, but they should talk to the load-balanced API endpoint rather than to one sticky node.
- Configure task queue admission for queues that protect a tenant, external API, database pool, or other shared downstream dependency.
- Run exactly one scheduler or maintenance process for schedule evaluation, activity-timeout enforcement, and history pruning.
- Run bootstrap/migrations once per rollout before new API and worker containers accept traffic.
- Choose a rollout posture for this release: stop-the-world (drain workers, stop scheduler/maintenance, replace API nodes, run bootstrap/migrations, then restart workers and the scheduler) or rolling upgrades when every guarantee on that contract holds.
- Treat the database and Redis as the primary failure domains. The server containers are replaceable; the persistence and coordination layers are not.
The published self-serve recipes start in the standalone_server shape even
though cluster discovery also names split_control_execution as a supported
product topology. Treat that as one contract with different role assignments,
not as a second server product. If you pilot a more explicit role split later,
keep reading topology.current_shape, topology.current_roles, and
topology.matching_role from /api/cluster/info instead of inferring duties
from hostnames or container names. The
Server Role Topology page explains
those role assignments and the migration path in one place.
Every API node should use the same auth tokens or signature keys, app version,
workflow package version, payload-codec configuration, database connection, and
Redis connection. Give each API node a unique DW_SERVER_ID so cluster
discovery and logs can distinguish the nodes.
The unsupported boundaries are explicit: SQLite clustering, Redis-less multi-node mode, duplicate schedulers as a steady-state topology, active/active multi-writer databases, self-hosted hands-free regional failover, and broad "five-nines" or "zero-downtime" SLA promises need separate validation or support-led design before you rely on them. Active/passive multi-region guidance is also support-led evaluation material; see Active/passive multi-region below. Single-region HA failover — managed-database failover, managed-Redis failover, API-node loss, worker loss, and scheduler-runner restart inside one region — is a support-led evaluation contract until the release-evidence gate passes; see Single-region high availability and failover below for the engine recovery targets, the readiness rules during a failover, and the evidence required to open that gate.
This path is self-serve when your team already has a clear VM, network, database, cache, backup, and load-balancer model. It becomes support-led when you need help deciding those boundaries, capacity, rollout order, or recovery procedures.
Worker long-poll timeout budgets
A healthy worker poll can be silent until its server wait ends. Budget for that silence across the worker's HTTP client, outbound proxy, service mesh, public load balancer, ingress and any reverse proxy before the API. Worker polling uses the shared API ingress. A separate matching role does not bypass those hops.
| Budget | What it limits |
|---|---|
| Server poll duration | How long the runtime waits for work before returning an empty response. A request's timeout_seconds overrides DW_WORKER_POLL_TIMEOUT; the variable is the fallback when the request omits it, not a cap on SDK polls. The protocol permits up to 60 seconds. |
| Client connect / pool timeout | Establishing a connection or acquiring one from the client pool. These need not last for the whole quiet poll. |
| Client read / total timeout | Waiting for response bytes, or the complete operation if the transport has a total limit. Allow the server wait plus connection, scheduling and response margin. A read timeout alone may measure inactivity between chunks, not the whole request. |
| Intermediary idle / upstream read / request timeout | Every active-request limit on every hop must permit a legitimate quiet poll and its response. An idle connection keepalive setting between requests is a different limit. |
| Shutdown / caller deadline | The worker's shutdown budget and any original caller or query authority remain hard bounds. Cancel or drain within those bounds; do not extend a query deadline to accommodate a proxy or a retry. |
Check the installed SDK's arithmetic rather than copying a timeout from another engine. In the verified Python SDK baseline below, a positive poll requests at most 60 seconds on the Server and gets at least five additional seconds of HTTP phase timeout. Its default Worker poll is 35 seconds, which normally selects 40 seconds for those HTTP phases. A 30-second intermediary read limit can therefore interrupt a legitimate default poll. PHP and Rust have their own defaults and retry policies; neither Python's margin nor a gRPC keepalive setting is a portable rule for all SDKs. See the PHP, Python and Rust SDK guides and task matching reference.
PHP SDK 3.2.0 ordinary control-plane Client calls do not supply a default total HTTP deadline; see the verified timeout gap in PHP #203. Configure a bounded HTTP client for those calls and preserve the original caller deadline. A Worker poll timeout is not a general bound on every SDK request.
PHP SDK 3.4.0 or newer adds a 60-second default total deadline for SDK-owned ordinary control HTTP requests; configure a finite requestTimeoutSeconds value of at least 0.001 seconds. These SDK-owned timeouts carry reason=request_timeout and status=0. The SDK makes one attempt: a timed-out mutation may already have been accepted, so inspect its original identity/outcome before resubmitting. Injected clients/transports keep their own timeout policy and cannot be combined with this option. This per-request bound does not replace worker long-poll, payload-transfer or workflow/caller deadlines. Check composer.lock; this feature minimum does not update the selected installation tuple. See HTTP client setup and the normal installed 3.4.0 receipt.
Verified short-poll example
An isolated test used published Python SDK 2.9.0, PHP Server 2.11.0 and Nginx 1.30.5, with an empty task queue. Both cells kept the SDK poll duration at 3 seconds, HTTPX connect/read/write/pool timeouts at 8 seconds, and an outer caller bound of 10 seconds. Only Nginx's upstream read timeout changed:
| Intermediary setting | Observed response |
|---|---|
proxy_read_timeout 1s | Nginx returned HTTP 504 after about one second while waiting for the upstream response header. The SDK surfaced ServerError. |
proxy_read_timeout 8s | The same legitimate quiet poll completed after about three seconds with HTTP 200, task: null and poll_status: empty. |
The Server fallback was deliberately one second in both cells; the request's explicit three-second wait still applied. HTTP retries were limited to one attempt to expose the first failure. This is a functional timeout example, not a capacity or production sizing result. The qualification in #267 records the exact images, requests and proxy logs.
For Nginx deployments, apply an appropriate upstream read budget to the existing worker-poll location. The eight-second value below belongs to this three-second example:
proxy_connect_timeout 2s;
proxy_read_timeout 8s;
Nginx measures proxy_read_timeout between upstream reads. HTTPX also distinguishes connect, read, write and pool timeouts; the eight-second phase settings above are not an eight-second total deadline. Keep an explicit outer deadline where required. Other proxies and providers use different names and semantics. Verify their active-request limits and the complete path with the actual SDK. Increasing one ingress limit does not fix a shorter limit elsewhere.
Diagnose the response before restarting workers
- Normal empty poll: the runtime returns a successful response with no task. In the verified baseline, the raw response is
poll_status: empty. Poll again normally. - Intermediary disconnect: a transport exception, connection reset, or proxy-generated 502/504 may occur before the legitimate server wait finishes. Correlate the SDK error and elapsed time with proxy/upstream logs. A healthy readiness check and later successful polling can coexist with a misconfigured intermediary.
- Runtime unavailable: inspect the runtime's structured reason and readiness checks for database, cache or admission failures. A gateway's HTML error page is not the runtime's typed refusal.
- Namespace or poll admission refusal: inspect the structured reason, namespace/queue and any retry delay, including HTTP 429. Raising an idle timeout does not grant admission capacity or fix authorization.
A worker retrying its connection does not prove the original proxy configuration was healthy. Check whether polling and task completion actually continue, and retain the failure class, queue, time and frequency when failures persist. A sporadic disconnect alone is not a reason to restart the process. The Python client can also synthesize poll_status: timeout after its HTTP timeout retries; that value alone is not proof that a runtime empty response traversed the proxy. Keep transport retries separate from activity retries, run deadlines and query authority.
SQL connection budgets
Budget database sessions before adding API replicas or overlapping old and new processes during a rolling upgrade. A database can reach its connection limit while CPU is still available. This is separate from write/commit latency, HTTP request capacity and retained storage growth.
Count every SQL-owning process
A native 3.x Server process opens at most four database connections, and a
schema-upgrade or takeover command opens one more while it runs. Budget four
sessions per native Server replica at the highest replica count, plus the
operational tools below. The rest of this section describes PHP 2.x.
The published PHP Compose deployment has these possible SQL clients:
| Role | What to count |
|---|---|
| API | Every concurrently active PHP request process that can use SQL, including readiness, operator requests and held polls. The published Apache prefork configuration permits 24 request processes per API container. That is an HTTP process ceiling, not a SQL pool or a measurement of 24 open sessions. |
| Laravel queue workers | Each php artisan queue:work process. The published Compose recipe runs one; extra worker containers add processes. These are separate from external SDK workers. |
| Scheduler/maintenance | Concurrent PHP commands, not just the scheduler container. The Compose scheduler runs schedule evaluation, repair, activity timeout and pruning commands sequentially, so its ordinary loop has one command active at a time. Keep the singleton scheduler rule. |
| Bootstrap and operational tools | Migration/bootstrap commands, projection rebuilds, retention jobs, backups, monitoring and interactive SQL clients that can overlap the deployment. Count any deliberately concurrent commands separately. |
| SDK clients and workers | Normally zero direct Server-database sessions because PHP, Python and Rust service-mode SDKs use HTTP. Add connections only if your activity code or other application code actually connects to that database. |
Count distinct SQL handles used by each process, not just containers or
hostnames. Laravel's default connection and workflows.storage.connection
may share one configured connection name. A different storage name, database
queue/cache/session connection, or read/write/direct connection handle can
open an additional session even when it reaches the same database endpoint.
Redis connections are not SQL sessions. Inspect the effective cached
configuration and the connection names each role actually uses.
For a custom FPM deployment, count PHP-FPM execution children, not nginx or Apache event threads. For a custom Octane deployment, inventory its request workers, task workers and actual database clients. Do not reuse Apache's 24-process figure as a pool size for either frontend. Synchronous long polls occupy a PHP execution worker while waiting and may retain a database session; an idle HTTP poll must not automatically be budgeted as zero SQL usage.
A conservative rolling-upgrade example
This is a planning example, not measured capacity. Assume a database limit of 120 client sessions, ten sessions for other applications and fifteen reserved for recovery/admin access. That leaves 95 for this deployment. Assume Redis-backed queue/cache and at most one SQL handle per PHP process.
| Peak overlap | Calculation | Planned sessions |
|---|---|---|
| API replicas, including one rollout surge | (2 + 1) × 24 × 1 | 72 |
| Laravel queue workers | 2 × 1 | 2 |
| Singleton scheduler/maintenance command | 1 × 1 | 1 |
| Bootstrap/migration | 1 × 1 | 1 |
| Backup, monitoring and other approved tools | Explicit allowance | 4 |
| Deployment subtotal | 80 | |
| Unallocated deployment margin | 95 − 80 | 15 |
At these assumptions, a fourth API replica would raise the deployment subtotal
to 104 and exceed its 95-session allocation. Two SQL handles per API process
would already require 144 sessions for the three API replicas alone. Recompute
the budget when changing storage connections, worker counts or rollout surge.
Lower the process/replica ceiling or stage replacement rather than assuming
the database will absorb the overlap. Raising max_connections also needs
database memory and workload review.
Observe and enforce the budget
- Record the effective database connection limit, unrelated clients and reserved recovery access. Set explicit API replica/process maxima and rollout surge. Include overlapping queue-worker generations and tools.
- On an isolated copy using your exact published image and configuration,
sample sessions while idle, during held polls, while completing real work
and during a bounded old/new overlap. Include idle sessions and the monitor
itself. PostgreSQL exposes
pg_stat_activity; MySQL exposesinformation_schema.PROCESSLIST. Use a suitably scoped monitoring role and avoid exporting SQL text or payloads. - Compare the observed sessions by application user/database with the declared per-process allowance. A short sample validates that fixture's assumptions, not a saturation limit or a guarantee for every workload.
- Watch session headroom together with connection refusals, transaction/commit latency, lock waits, held HTTP requests and storage growth. Readiness alone does not prove a rollout has spare capacity.
- Near the limit, reduce the surge or drain and retire an old API/worker group before starting its replacement. Keep recovery access available and run bootstrap only in the planned migration window. If safe overlap cannot fit, use the documented stop-the-world upgrade posture.
On PHP 2.x, task-queue admission limits
selected dispatch and lease activity, and DW_WORKER_LONG_POLL_MAX_CONCURRENT
and DW_QUERY_TASK_POLL_MAX_CONCURRENT bound held poll waits on a node. None is
a global SQL-session, database-byte or commit-latency limit; keep capacity for
completions, heartbeats, operator requests and health checks as well. Native
3.x refuses to start with task-queue admission caps and ignores both poll caps;
it has no native equivalent yet. Its fixed pool of four connections per process
bounds its SQL sessions; size SDK worker slots and worker counts for task
concurrency.
Use a direct writable database endpoint as the baseline. A connection proxy must be qualified with the exact Server release, pool mode and settings for prepared statements, transaction boundaries, session state and locking. PgBouncer transaction pooling requires fixed Server 2.9.8 or later. The published 2.9.8 acceptance qualifies PostgreSQL 16.15 with PgBouncer 1.26.1: direct PostgreSQL, session pooling, and transaction pooling with either max_prepared_statements=0 or max_prepared_statements=200. This is a compatibility floor and an exact tested configuration, not a latest-version pin or capacity guarantee; qualify other combinations separately. Before admitting traffic, run PHP 2.x's ordinary server-bootstrap initialization against the selected endpoint, or let native 3.x check its schema at startup through that endpoint.
GET /api/ready exercises a parameter-bound database read (bound_read_query) and configured readiness checks; it explicitly leaves write capacity unverified. A successful TCP connection, migration or readiness response does not prove every workflow SQL operation or commit capacity. Read replicas must not replace the authoritative writer used for claims and durable transitions.
Helm chart for Kubernetes
The Server repository owns the chart source and release guidance. Install the published chart from the OCI registry:
helm install durable-workflow \
oci://ghcr.io/durable-workflow/charts/durable-workflow \
--version 5.8.0 \
--namespace durable-workflow --create-namespace \
-f my-values.yaml
Chart 1.x runs the native Server by default (runtime: native): one Server
Deployment, with no worker, scheduler, migration Job or Redis. Your values file
must point to an external MySQL, MariaDB or PostgreSQL database, provide
DW_AUTH_TOKEN and the role-scoped tokens through existing Kubernetes Secrets,
and configure ingress/TLS for your environment. The chart refuses to render
without the shared DW_AUTH_TOKEN, and it refuses SQLite. A native install runs
one replica by default; more than one replica, or autoscaling, requires
native.storage.existingClaim to name a ReadWriteMany volume for external
payload objects. The chart does not create persistence or provider-managed
infrastructure. Pin the Server image by digest for a reproducible deployment.
An existing PHP 2.x release does not move to native on an ordinary upgrade:
the chart refuses until you set runtime explicitly. Set runtime: php to keep
the PHP 2.x worker, scheduler, bootstrap job and Redis. To move to
runtime: native, follow the
native takeover runbook
and keep runtime: php until the takeover is done. See the chart's
UPGRADING notes.
Chart 1.1.0 changes the default image from Server 3.0.5 to 3.3.2, which needs
the native schema upgrade from 8 to 11.
An ordinary helm upgrade from chart 1.0.x changes only the image, and the new
pods refuse to start with native_schema_upgrade_required. Follow the chart's
Chart 1.1.0 / Server 3.3.2 steps:
scale the Server to zero with autoscaling off, back up the database, then
upgrade to chart 1.1.0 with native.schemaUpgrade.enabled=true. Its
pre-upgrade hook runs schema-upgrade once before the new pods start, and
only when Helm's lookup shows every Server stopped. Argo CD, Flux and
helm template renders refuse the hook; use the chart README's manual Job
instead. A helm rollback to a chart 1.0.x revision does not bring the Server
back, because 3.0.x refuses the upgraded database: restore the backup instead.
Chart 1.2.0 moves the default image to Server 3.4.0 with no schema change, so
a plain helm upgrade from chart 1.1.0 is enough. Native pods also gain a
preStop sleep (native.preStopSleepSeconds, default 5) and a 70-second
termination grace period. Chart 1.3.0 moves the default image to Server 3.5.0,
which needs the schema upgrade from 11 to 12:
scale the Server to zero, back up the database, and run helm upgrade with
native.schemaUpgrade.enabled=true (or the manual Job), then scale back up.
See the chart's
Chart 1.3.0 / Server 3.5.0 notes.
Going back to chart 1.2.0 means restoring that backup.
Chart 1.4.0 moves the default image to Server 3.6.0 with no schema change, so
a plain helm upgrade from chart 1.3.0 is enough, and going back to 1.3.0 is an
image change. See the chart's
Chart 1.4.0 / Server 3.6.0 notes.
Chart 1.5.0 moves the default image to Server 3.7.0. On MySQL it needs the
schema upgrade from 12 to 13: scale the Server
to zero, back up the database, and run helm upgrade with
native.schemaUpgrade.enabled=true (or the manual Job), then scale back up.
Going back to chart 1.4.0 on MySQL means restoring that backup. On MariaDB and
PostgreSQL a plain helm upgrade is enough, and going back is an image change.
See the chart's
Chart 1.5.0 / Server 3.7.0 notes.
Chart 1.6.0 moves the default image to Server 3.8.0, which needs the
schema upgrade on every backend: scale the
Server to zero, back up the database, and run helm upgrade with
native.schemaUpgrade.enabled=true (or the manual Job), then scale back up.
Going back to chart 1.5.0 means restoring that backup. The chart pins the
image by tag. For change-controlled installs, also set image.digest to the
3.8.0 multi-arch index,
sha256:7988a23525d9e50e997a9f6f02e801300ed4f626de3cf6977033657ae7e9f58e,
which both durableworkflow/server:3.8.0 and
ghcr.io/durable-workflow/server:3.8.0 resolve to. See the chart's
Chart 1.6.0 / Server 3.8.0 notes.
Choosing a chart release
One chart release records the Server image it was tested against in Chart.yaml's appVersion; the chart and Server have independent version numbers. The selected compatibility tuple pairs chart 5.8.0 with Server 3.31.2, from the same release metadata as the table and install command. Its published OCI/package receipt verifies that pairing, not a fresh Kubernetes installation.
For another Server version, inspect the candidate published chart's Chart.yaml (the selected chart source is an example) and select an exact chart version whose appVersion matches your intended Server. Read the selected release's UPGRADING notes, including every chart version crossed. Do not infer a chart version from the Server version or select an unpublished chart from current source.
Overriding image.tag changes the image without changing the chart's recorded appVersion. That produces a custom chart/image tuple until it receives its own rendered-manifest, bootstrap, rollout and runtime qualification. Keep ordinary database backups and rollback boundaries in the upgrade plan; a successful render alone does not prove the deployment works.
The published history includes an exception: chart 0.2.2 crossed a Server minor under a chart patch number. The later published correction acknowledges that exception and resumes the stated minor-version policy. Historical versions stay unchanged; this note does not select the later Server/chart tuple.
Kubernetes manifests
The server repository includes raw manifests under
k8s/ for teams
that already operate Kubernetes. They describe the PHP 2.x shape; for the
native Server, use the Helm chart's native mode or adapt its single Server
Deployment:
- Namespace and shared labels
- ConfigMap and Secret split
- Bootstrap/migration Job
- API Deployment and Service
- Worker Deployment
- Scheduler CronJob
- PodDisruptionBudget
/api/healthliveness and/api/readyreadiness probes- Conservative resource requests and limits
Before applying the manifests, replace the image tag with a specific published version or digest, provide real database and Redis credentials, and wire the ConfigMap values to the services your cluster already operates. The manifests are intentionally raw and inspectable; they are not a Helm chart and do not promise generic managed-Kubernetes behavior.
For a Kubernetes production rollout, prove at minimum:
kubectl -n durable-workflow wait --for=condition=complete job/durable-workflow-migrate --timeout=180s
kubectl -n durable-workflow rollout status deploy/durable-workflow-server
kubectl -n durable-workflow rollout status deploy/durable-workflow-worker
kubectl -n durable-workflow port-forward svc/durable-workflow-server 8080:8080
curl http://localhost:8080/api/ready
curl -H "Authorization: Bearer $DW_ADMIN_TOKEN" http://localhost:8080/api/cluster/info
Single-region HA failover — managed-database failover, managed-Redis failover, API-node loss, worker loss, and scheduler-runner restart inside one region — remains support-led on the raw-manifest path just as it does on the small-cluster path while the release-evidence gate is closed. The intended contract requires the readiness, singleton-scheduler, and shared-substrate rules in Single-region high availability and failover below. Provider-specific load balancers, storage classes, network policies, active/active multi-region, and self-hosted hands-free regional failover remain support-led or tracked separately from the raw-manifest contract. Use the separately versioned Helm path above when you want Helm-managed installation and upgrades.
Running SDK workers on Kubernetes
Deploy your application workers separately from the Server and, on PHP 2.x, from its Laravel queue worker. Build an image containing your registered PHP, Python or Rust handlers and its locked SDK dependencies. Use an exec-form entrypoint so the worker process receives SIGTERM. Replace the image below with that build's immutable digest.
For workers in the same cluster, use the Server Service's actual name, namespace and port. The raw manifests expose http://durable-workflow-server.durable-workflow.svc.cluster.local:8080. A Helm release can use a different Service name. Workers outside the cluster need the reachable ingress or load balancer's HTTPS URL and normal certificate verification. Keep long-poll and transport budgets aligned with the timeout guidance.
Create a Secret in the worker Pod's Kubernetes namespace from your existing worker credential. Keep the token out of the manifest and image. The Server namespace is a separate product boundary from the Kubernetes namespace.
kubectl -n durable-workflow create secret generic orders-worker-auth --from-literal=token="$DW_WORKER_TOKEN"
Save this as orders-worker.yaml. These environment names are application configuration: your entrypoint must pass them to the SDK client and Worker. Give each live process its own worker ID and register the handlers for the configured queue.
apiVersion: apps/v1
kind: Deployment
metadata:
name: orders-worker
namespace: durable-workflow
spec:
replicas: 2
selector:
matchLabels:
app: orders-worker
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
template:
metadata:
labels:
app: orders-worker
spec:
automountServiceAccountToken: false
terminationGracePeriodSeconds: 75
containers:
- name: worker
image: registry.example.com/acme/orders-worker:release-id
env:
- name: DW_SERVER_URL
value: http://durable-workflow-server.durable-workflow.svc.cluster.local:8080
- name: DW_NAMESPACE
value: default
- name: DW_TASK_QUEUE
value: orders
- name: DW_WORKER_ID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: DW_WORKER_TOKEN
valueFrom:
secretKeyRef:
name: orders-worker-auth
key: token
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: "1"
memory: 512Mi
Apply the Deployment and wait for its rollout:
kubectl apply -f orders-worker.yaml
kubectl -n durable-workflow rollout status deployment/orders-worker
Replica and resource values are starting examples, not capacity guarantees. Tune them with actual task duration, memory use, downstream limits and worker admission budgets. A Deployment becoming available does not prove SDK registration or useful work. Verify fresh worker registrations and the expected build/queue, then start and complete a representative workflow. An SDK worker does not acquire an HTTP health endpoint merely by running in Kubernetes. Use an application-owned probe when you have one, and do not use Server health as a worker liveness check.
Scale SDK workers from zero
Native Server 3.14.0 and later can wake a worker Deployment from zero replicas. Check that /api/cluster/info advertises capabilities.prometheus_text_metrics. Give Prometheus a dedicated read-only scrape token using DW_METRICS_TOKEN from a Kubernetes Secret. Scrape /metrics?namespace=default and apply a KEDA ScaledObject targeting your SDK worker Deployment. Use minReplicaCount: 0, activationThreshold: "0" and a threshold based on the task slots per replica. Scrape and KEDA manifests
(
sum(dw_task_queue_dispatchable_tasks{namespace="default",task_queue="orders"})
+ sum(dw_task_queue_leased_tasks{namespace="default",task_queue="orders"})
)
or (vector(0) and on() up{job="durable-workflow-server"} == 1)
This query uses one healthy scrape target for the namespace to turn an empty queue into zero. Set the namespace, task queue and up selector to match your deployment. Leased tasks keep workers running, and paused activity work waits for dispatch to resume. Check the cohort backlog before scaling down a worker build. Build ID rollout guide
Delivering SIGTERM and waiting for cleanup
| SDK | Worker process shutdown |
|---|---|
| PHP | Use the managed Worker::run() loop with pcntl installed. Its signal handler requests shutdown, then the active synchronous task reaches a boundary before managed cleanup and deregistration. A custom loop around tick() does not supply that lifecycle. See PHP graceful shutdown. |
| Python | Wire SIGTERM to the same Worker's shutdown path and await both Worker.stop() and its run task. Set an explicit shutdown_timeout. Accepted work shares that drain deadline. A running synchronous thread cannot be forcibly stopped by cancelling its await, and an unconfirmed stop remains an error. Use the separate-process example and signal wiring and lifecycle contract. |
| Rust | Pass a future that resolves on Unix SIGTERM to Worker::run_until(...) and await its result. A Ctrl-C-only future does not handle the Pod's termination signal. Keep asynchronous handlers yielding and bound blocking work separately. See Worker::run_until. |
Give terminationGracePeriodSeconds enough time for the installed SDK's poll, accepted-task shutdown and HTTP/session/deregistration cleanup. The example's 75 seconds must be checked against your application's actual bounds. Kubernetes counts any preStop hook within that same grace period and force-stops remaining processes after expiry. A sleep hook alone neither asks the SDK to drain nor extends its deadline. See the Kubernetes Pod termination flow.
Rehearse termination while idle and during bounded work. Treat cleanup errors, a retained registration or a forced kill as incomplete shutdown. A replacement worker continues durable work according to its recorded leases, retries and deadlines. Stopping a Pod does not cancel a workflow or undo an external side effect. Before changing builds, follow worker build-ID rollout and retain its compatibility, replay and rollback checks.
Single-region high availability and failover
Single-region HA failover is currently an unverified, support-led contract candidate layered on the small-cluster shape and the raw Kubernetes shape. It targets the failure modes that the engine is designed to survive inside one region: managed-database failover (RDS Multi-AZ, Aurora cluster failover, Cloud SQL HA, Patroni promotion, etc.), managed-Redis failover (Sentinel, Elasticache replication-group failover, Memorystore HA, etc.), API-node loss, worker loss, and scheduler/maintenance runner restart. Cross-region active/passive recovery is a different, support-led evaluation; see Active/passive multi-region below.
The intended contract — engine behavior, readiness rules, the per-event
recovery targets, the split-brain prevention rules, and the rehearsal
acceptance test — lives in the workflow library at
docs/deployment/ha-failover.md
and the standalone server at
docs/ha-failover-validation.md.
This section is the public surface of those documents.
Release-evidence status
No passing exact-release result is linked for any public server release. The
candidate topology, runner and recovery bounds below were written for the PHP
2.x Server (shared Redis, a queue worker and a singleton scheduler). The
recorded PHP released-image attempt stopped during topology_start while
waiting for API readiness, before any failure-matrix or recovery-bound claim
could be established. No failover runner has been published for the native
3.x Server, and its GET /api/cluster/info reports
single_region_failover_contract: false. Do not treat the runner's presence, its scenario
manifest, or a deployment-specific rehearsal as evidence that the released
image has passed the full matrix. Single-region HA therefore remains
support-led.
Self-serve wording is authorized only after a source-free run uses the exact
documented server release for the image, runner, and Compose topology and
publishes a single-region-failover-result.json with outcome: "pass",
runner_blocked: false, every entry in phase_outcomes at status: "pass",
every recovery-bound verdict passing, and evidence for every required scenario
in the public
single-region failover scenario manifest.
That public passing result must be linked from this status section and must name
the same server image as durableworkflow/server:3.31.2. Until all of those
conditions hold, the recovery bounds below are evaluation targets rather than
released-image validation claims.
Candidate topology
The intended HA contract applies when the deployment matches the small-cluster shape or the raw-manifest shape and the operator preserves three rules:
- One writable workflow database endpoint, always. Managed failover
(RDS Multi-AZ, Aurora cluster failover, Cloud SQL HA, Patroni, etc.) is
permitted on the rule that the previous primary is fenced — revoke the
write user, demote with
read_only=on, sever replication, or restore from a known-good snapshot — before it can re-attach. A connection proxy must preserve the database semantics the Server uses and pass exact-release qualification for its mode and settings. See SQL connection budgets for the PgBouncer transaction-pooling version requirements and tested modes. - One Redis endpoint at a time, with a documented promotion path. Managed-Redis failover (Sentinel, Elasticache replication-group failover, Memorystore HA, etc.) is permitted. Redis is the acceleration layer, not the correctness substrate, so a Redis failover is a latency event, never a correctness event.
- One scheduler/maintenance runner, always. The orchestrator (Compose
service with
deploy.replicas: 1, systemd unit guarded by a host-level lease, or KubernetesDeploymentwithreplicas: 1andRollingUpdate.maxSurge: 0) is responsible for keeping the singleton invariant during restart. Duplicate scheduler runners as a steady-state topology are not in this contract.
Per-event behavior and recovery targets
The intended engine contract defines bounded recovery targets for each event class. These are not released-image guarantees while the release-evidence gate is closed. The wall-clock recovery time the operator observes is the engine target plus the managed service's own promotion latency.
| Event | Candidate engine behavior | Recovery target (after substrate / runner is back) |
|---|---|---|
| Managed-database failover | Writes return errors and are not silently buffered. Reads return errors. /api/ready fails on every API node and on the scheduler. No acknowledged work is lost. | One connection-pool reconnect, plus one task_repair cadence (default 3s), plus one long-poll timeout (default 30s, max 60s) for in-flight pollers. |
| Managed-Redis failover | Wake signals dropped → discovery falls back to long-poll timeout. Acceleration-layer health checks go to warning, not error. /api/ready typically stays green. | Redis client reconnect interval. |
| API node loss (1 of N) | Load balancer removes the failed node within its readiness interval. In-flight requests against it fail at the LB and are retried by the client. | Load-balancer readiness interval (operator-controlled, typically 5–10s). |
| Worker loss | Tasks held by the failed worker pause until lease expiry. Other workers continue claiming their own tasks. | Lease expiry (5 min for activity tasks), plus one task_repair cadence. |
| Scheduler/maintenance restart | Schedule fires pause; activity-timeout enforcement pauses; history pruning pauses. All three resume on the next tick after restart. No duplicate fires occur because the runner is a singleton. | Orchestrator restart latency, plus one scheduler tick. |
Load-balancer, readiness, and traffic-shift rules
The load balancer in front of the API nodes is the single decision point for traffic admission during a failover:
- Wire the load balancer to
GET /api/ready, not/api/healthalone./api/healthonly proves the process is serving HTTP;/api/readyreports database connectivity and configured readiness checks, including whether Redis wake acceleration is healthy or degraded. It does not exercise every workflow SQL operation or verify write capacity. During a database outage/api/readycorrectly fails on every node — the load balancer MUST tolerate the all-down state rather than fall back to a stale "last known good" roster. - Use a check interval of 5–10 seconds and a removal threshold of 2–3 consecutive failures.
- Do not require sticky sessions; the small-cluster smoke proves an
external worker can poll
server-aand complete onserver-b. - During a Redis-only failover, readiness remains green on every node while
the database-backed durable paths are available. Acceleration-layer
degradation surfaces as
checks.cache.status=warningwithchecks.cache.degraded_capability=long_poll_wake_acceleration; do not configure the load balancer to remove nodes on that warning.
After substrate recovery, the recommended verification sequence is to wait
for at least one node's /api/ready to return 200, curl /api/cluster/info
through the load balancer with an admin token to confirm the topology
manifest, issue POST /api/worker/register for a probe worker through the
load-balanced endpoint, confirm exactly one scheduler runner is alive in
its orchestrator, and resume external traffic.
Run the exact-artifact rehearsal
PHP Server 2.x releases include a reusable baseline rehearsal intended to exercise the full failure matrix without building product code from a checkout. Its Compose topology starts PHP-only roles (the bootstrap job, queue worker and scheduler), so it cannot run the native 3.x image. The example below uses the final PHP release, 2.11.8. The runner and Compose topology must come from the same release tag as the server image; do not combine a moving default-branch checkout with an arbitrary image. On a clean host with Docker Engine, Docker Compose v2, Python 3.11 or newer, and public registry access, run:
export DW_SERVER_RELEASE=2.11.8
git clone --depth 1 --single-branch --branch "$DW_SERVER_RELEASE" \
https://github.com/durable-workflow/server.git "server-$DW_SERVER_RELEASE"
cd "server-$DW_SERVER_RELEASE"
export DW_SERVER_IMAGE="durableworkflow/server:$DW_SERVER_RELEASE"
scripts/conformance/single-region-failover-published-artifacts.sh \
--result-dir ./failover-result
This path deliberately derives the checkout and DW_SERVER_IMAGE from one
release variable. Do not override the image independently; select a different
release by changing DW_SERVER_RELEASE before cloning. The runner requires a
concrete public server tag or digest, pulls every
supporting image, resolves all runtime images to repository digests, and
rejects Compose build sections, product-source bind mounts, and local or
rolling server references. It starts exactly two API nodes behind one nginx
endpoint, one MySQL database, one Redis service, and one scheduler/maintenance
runner.
The resulting single-region-failover-result.json uses schema
durable-workflow.v2.single-region-failover.result. It records exact artifact
and tool versions, normalized topology, readiness transitions, measured
recovery times and bound verdicts, workflow/run/task/schedule identities, and
duplicate/loss assertions for cross-node completion, API-node loss, database
interruption, Redis interruption, worker lease loss, and singleton-scheduler
restart. External runners discover the invocation and public scenario manifest
from GET /api/cluster/info at single_region_failover_contract.
A result validates engine-visible interruption and recovery against the released image only when it passes the release-evidence gate above. A failed, partial, or runner-blocked result is diagnostic evidence, not validation. Even a passing baseline does not turn a local MySQL or Redis container restart into evidence for a cloud provider's promotion mechanism. Keep provider-native promotion, fencing, RPO, and elapsed-time evidence alongside the baseline result before claiming managed-service HA.
Recovery packet additions
A small-cluster or raw-manifest deployment that claims this contract MUST extend its recovery packet (per the Operator Operating Envelope) with rehearsal evidence for each event class:
- a managed-database failover that completes without acknowledged-write loss and within the bounded recovery time above;
- a managed-Redis failover that does not flap the load-balancer rotation,
does not lose any acknowledged work, and surfaces
checks.cache.status=warningwithlong_poll_wake_accelerationas the degraded capability; - an API-node loss event that the load balancer absorbs within the configured readiness interval, with no acknowledged-write loss;
- a worker-loss event that preserves the durable run through lease expiry, reclaims it after the configured repair bound, and completes it exactly once;
- a scheduler-runner restart on a different host that fires no duplicate
schedules and leaves no schedule unevaluated past its
next_fire_atplus one tick.
While the release-evidence gate is closed, every deployment remains support-led even if its own rehearsal passes. After a public all-phase result opens the release gate, a deployment becomes self-serve under this contract only after its environment-specific rehearsal evidence is recorded in the operator's recovery packet and refreshed on the cadence the Operator Operating Envelope publishes.
Boundary against unsupported HA claims
The single-region HA contract is intentionally narrow. The following remain outside it and continue to require a support-led design pass; the topology itself is part of the product risk:
- active/active multi-writer database topologies;
- active/passive multi-region and automatic or hands-free regional failover for self-hosted topologies (the next section preserves evaluation guidance);
- synchronous cross-region database replication (RPO=0);
- duplicate scheduler/maintenance runners as a steady-state topology;
- engine-enforced region-pinned task queues as a routing axis;
- provider-specific managed-Kubernetes validation beyond the published chart's packaging contract;
- broad "five-nines" or "zero-downtime" SLA promises beyond the bounded recovery times above.
The contract is bounded recovery during named events, not an uptime promise that depends on the operator's database, network, and orchestrator choices. Marketing or SLA language for self-hosted deployments MUST NOT cross that line without dedicated validation.
Active/passive multi-region
Active/passive multi-region is support-led evaluation guidance, not a
proven self-serve contract in the supported 2.0 operating envelope. Use this
section to review a candidate architecture and build an environment-specific
rehearsal with support before relying on it in production. Each region still
starts from a documented single-node, small-cluster, or raw Kubernetes path,
but those single-region contracts do not establish cross-region replication,
failover, failback, RPO, RTO, or split-brain behavior. The deeper design
material — data authority, replication assumptions,
namespace/task-queue/worker behavior, the failover and failback runbook,
fencing, and the consistency/latency tradeoffs — lives in the workflow library
at
docs/deployment/multi-region.md
and the standalone server at
docs/multi-region-validation.md.
That material and the candidate shape below were written for the PHP 2.x
topology. The native 3.x Server has no Redis or separate scheduler, and no
native multi-region rehearsal has been published.
The candidate shape to evaluate:
- One active region running the validated single-node or small-cluster contract: API container(s) behind a load balancer, shared external MySQL or PostgreSQL as the writable durable database, shared Redis, exactly one scheduler/maintenance runner, and external workers.
- One standby region holding an asynchronously replicated standby of the workflow database, optional standby Redis, no scheduler/maintenance process, and zero or more pre-provisioned API/worker containers that are idle until promotion.
- A regional failover that is explicit operator work: stop write traffic to the failed region, confirm replication state against the published RPO, promote the standby database, run any release-required migrations on the new primary, start the singleton scheduler/maintenance runner in the new active region, switch worker endpoints, switch external traffic, and rebuild any derived projections. There is no automatic cross-region cutover.
- A failback that runs the same sequence in reverse once the original
region returns to service, with the recovered primary fenced (revoke
write user, demote with
read_only=on, sever replication, or restore from a known-good snapshot) before re-attaching as a standby.
Data authority and replication assumptions:
- The workflow database is the single durable source of truth and is region-bound: exactly one region writes to it at any given time. The standby region's database is a read replica until promotion. Recovery point objective (RPO) is the asynchronous replication lag; recovery time objective (RTO) is operator runbook execution time.
- Redis is region-local acceleration. Wake signals, query-task queue locks, and admission locks do not propagate across regions and must not be expected to. Each region runs its own Redis; the standby's cache is cold or warm at the operator's discretion and correctness does not depend on it being preserved across the failover.
- Visibility is served by the active region's database. Promote first, then read.
Namespace, task-queue, and worker-registration behavior:
- Namespaces and task queues are stored in the workflow database and survive promotion exactly as they were at the last replicated commit. They are not regionally partitioned by the engine.
- Workers in the new active region register against the local API endpoint after promotion. Pre-existing registrations from the failed region remain in the database and expire through the normal worker-expiry path.
- Build-id rollouts and deployment-lifecycle state survive failover because they live in the workflow database.
Consistency and latency tradeoffs in steady state:
- Workflow starts, signals, and updates commit against the active region's database; their latency is the active-region commit latency, and they are refused while authority is being withdrawn during a failover.
- Workflow-task and activity-task delivery follow the single-region acceleration contract inside the active region: sub-second when Redis is healthy, durable poll cadence otherwise.
- Schedules fire from the singleton scheduler in the active region and pause while no scheduler is running; fires resume from durable schedule rows after promotion.
- Visibility reads are read-after-write within the active region only; the engine does not provide cross-region read-your-writes or RPO=0.
The disaster-recovery boundary is explicit: this candidate design is not a substitute for backups or evidence. The recovery packet documented in Operator Operating Envelope remains required, with replication-lag SLO, promotion-runbook latency, last successful failover rehearsal date, and the fencing procedure for the recovered primary added on top.
For self-hosted deployments, active/passive and active/active multi-region, automatic regional failover, synchronous cross-region replication (RPO=0), cross-region active visibility, and region-pinned task queues as an engine-enforced routing axis remain support-led because the topology itself is part of the product risk. The current Cloud managed-runtime contract is single-region and does not supply those multi-region guarantees.
Readiness contract
Use both health and readiness checks:
GET /api/healthproves the process is serving HTTP.GET /api/readyreports configured dependency checks, including database connectivity, migrations and default namespace readiness. It does not prove every workflow SQL operation or available write capacity.GET /api/cluster/infoproves an authenticated client can discover build identity, control-plane protocol, worker protocol, payload codecs, and server capabilities.POST /api/worker/registerproves workers can authenticate into the expected namespace and task queue.
Do not shift traffic based on /api/health alone.