Skip to content
7 min readUpdated 25 Nov 2026

Deployment

A Reaktor product runs in many places at once. BestBuds, the production app built on Reaktor, has Android and iOS clients, a web client, an API on Cloudflare Workers and Durable Objects, and JVM services on a small Kubernetes cluster. Each runtime keeps its own proven tool underneath (wrangler, Kubernetes, Fastlane), and the build declares all of them in one place. You deploy through Gradle tasks that first write a plan and then apply exactly that plan.

Overview#

How a Reaktor product deploys. The delivery block declares releases, migrations and deploys, and every one waits for the pr check suite. Each deploy task then plans and applies; the apply uploads exactly the planned bundle and refuses when the bundle or the live version changed. Each step writes a receipt. Below, the runtimes the deploy tasks reach.ONE DECLARATION, ONE GATE, THEN PLAN AND APPLYDelivery blockbuild.gradle.kts declaresreleases, migrations,deploys and their orderThe pr gateReaktor checks, JVM andJS tests, architectureand credential checksPlanbuild and bundle, read thelive version, and write aplan of every binding andsetting that differsApplyupload exactly the plannedbundle and nothing else;write the run id on theCloudflare deploymentReceiptcommit, plan and artifactdigests, the new liveversion and the versionto roll back toRefused if the bundle or the live version movedNothing goes live; plan again.WHERE EACH DEPLOY GOESCloudflare Workersthe API, the web app andthese docs; wrangler, oneGradle task per WorkerJVM servera container image inArtifact Registry, then arolling update on k3sCluster infrastructureHelm releases, appliedby the k3s scriptsAndroid and iOSFastlane lanes to thestores, TestFlight andApp DistributionGrafanaa Cloudflare Container,:workers:deployTelemetry
One declaration, one gate, then plan and apply per deploy; every step leaves a receipt that names its rollback target.
PartWhere it runsHow it ships
Mobile appsAndroid and iOS devicesFastlane lanes to the stores and to Firebase App Distribution
Web app and these docsCloudflare Workers with static assetsA Gradle deploy task per Worker, planned and then applied
API and realtime servicesCloudflare Workers, Durable Objects, Queues, D1 and R2The same Gradle deploy tasks
Transactional dataPostgres, reached from Workers through HyperdriveSchema migrations in the repository
JVM services, Memgraph and ClickHousek3s on a Google Compute Engine VM, reached from Workers over a private tunnelContainer images and Kubernetes manifests
GrafanaA Cloudflare Container at telemetry.reaktor.build that sleeps when idleIts own Worker deploy task

Observe and diagnose covers the signals each part sends, where they are kept, and how to work through a problem.

The delivery block#

The build script declares what can be released and what has to happen first. This is the shape of the BestBuds declaration, shortened:

val schema by migrate(BestBudsDatabases.Main)
val clickhouse by migrate(BestBudsDatabases.ClickHouse, kubeconfig = BestBudsOptions.ServerKubeconfig)

delivery(after = pr, run = Run.onMac()) {
    val playInternal by release(androidReleaseBundle, AndroidLane.PlayInternal) { require(BestBudsOptions.DevTools, false) }
    val testflightInternal by release(releasePlan, IosLane.TestflightInternal) { require(BestBudsOptions.DevTools, false) }

    val workers by deploy(projects.workers, run = Run.onLinux().onWorker())
    workers.after(clickhouse)

    val server by server(output(projects.reaktorServer, OutputKind.ServerArchive), environment = Environment("prod"))
    server.after(schema, clickhouse)
}
  • delivery(after = pr) makes every release and deploy wait for the pr check suite: the Reaktor framework checks, JVM and JS tests, architecture checks and a credential containment check.
  • migrate declares a database migration. Workers deploy after the ClickHouse migrations, and the server after both the Postgres schema and ClickHouse.
  • release declares a Fastlane lane for a store or Firebase App Distribution. Release lanes require a build with DevTools turned off.
  • deploy declares the Worker fleet, and server the JVM server image and its Kubernetes rollout.

Dependeasy is the Gradle plugin that turns these declarations into tasks. It also supplies the shared Worker settings, such as the Cloudflare account and the nodejs_compat flag, so individual wrangler.json files stay small.

Plan, then apply#

Every Worker deploy task runs in two steps. Run the ReaktorWeb tasks from the services build.

./gradlew --no-daemon :workers:deployReaktorWeb -Pdependeasy.deployAction=plan
./gradlew --no-daemon :workers:deployReaktorWeb

The plan step builds and bundles the Worker, reads the live version from Cloudflare, and writes a plan under build/dependeasy/plans/deploy/ that lists every difference in bindings and settings. The apply step uploads the planned bundle and nothing else. It refuses to run when the bundle or assets changed after planning, or when someone else deployed a new live version in between. In both cases nothing goes live, and you plan again.

A D1 migration applies only with a reviewed plan, even when the plan shows nothing pending. Plan and apply run the full gate by default. Skipping the gate (-x :pr) or the included BestBuds ClickHouse migrations (-x :bestbuds:clickhouse) requires the release owner's decision.

Receipts and rollback#

Each deploy step writes a receipt to build/dependeasy/receipts/deploy/<run>.json. A receipt records the action, the Git commit, the plan and artifact digests, the live version it produced, the version to roll back to, and the result. The run id also appears as the message on the Cloudflare deployment, so you can match a live version to the commit and plan that produced it:

pnpm exec wrangler deployments list --config wrangler.dependeasy-prod.json

To roll back a Worker, pass the version the receipt names as its rollback target to wrangler rollback with the same configuration file.

Other runtimes#

RuntimeArtifactHow it ships
JVM serverContainer imageArtifact Registry, then a rolling update on k3s
Cluster infrastructureHelm releases and manifests../infra/k3s/observability/deploy.sh installs the observability stack: Prometheus, Loki, Tempo and Alertmanager from manifests, Alloy and kube-state-metrics from Helm charts
AndroidApp bundleFastlane lanes to Firebase App Distribution and Google Play
iOSRelease buildFastlane lanes to Firebase App Distribution, TestFlight and the App Store
GrafanaContainer image and Worker:workers:deployTelemetry, plan then apply

The build and test pipeline is the Gradle graph itself, so ./gradlew pr runs the same checks on a laptop and on the build worker. Hangar's Deploy pane shows the same tasks and recipes, runs them through the shared process supervisor and keeps their output. A production deploy from the pane needs a typed confirmation, and a destructive cloud change needs a second person to approve it.

Design: deploying a graph#

Today each runtime deploys separately, and the order between them comes from the delivery block. The design goes further: because a Reaktor app is one typed graph, a deploy can be an operation on that graph. None of the following is built yet.

  • One platform model. A Kotlin Platform declaration would generate the Worker configuration, Kubernetes manifests and provider API calls, instead of each being maintained by hand.
  • Deploy by partition. The deploy step would colour each node by the runtime it targets and ship each part through its own tool. Where a cut separates two nodes, it would insert the connecting piece: a network call between a Worker and the server, or a native call through FFI. A feature that touches a Worker, a server handler and a D1 table would ship as one ordered change.
  • Blast radius from edges. Every dependency is an edge, so "what could this deploy break" becomes a graph traversal shown before you confirm.
  • Drift. What was declared and what is running would be compared continuously, and the difference shown in the graph.
  • Gated operations. Deploy, roll back, restart, scale, drain and migrate would be typed operations on the node they act on, with permission checks, blast radius and an audit record, so an agent can run them under the same rules as a person.
  • Capacity. Creating, resizing and draining cluster cells would use the same operations, both for clusters Reaktor runs and for clusters a customer owns and attaches.

The executors stay the same: wrangler, the provider APIs, Kubernetes and Fastlane do the provisioning and shipping, and Reaktor decides what to ship, in which order, and with what checks.

What it improves#

The usual approachWhat goes wrongWhat Reaktor does
Running wrangler deploy by hand from a working folderA failed build or the wrong configuration goes live, because nothing ties the upload to a checked buildA Gradle task builds, bundles and plans first, and the apply uploads exactly the planned bundle
Keeping the deploy order in people's headsCode reaches production before the migration it needsThe delivery block declares the order: Workers after the ClickHouse migrations, the server after the Postgres schema and ClickHouse
Deploying without a recordNobody can say which commit and plan made the live version, or what to roll back toA receipt per step, and the run id as the message on the Cloudflare deployment
Two people deploying the same Worker at onceOne silently overwrites the otherThe apply refuses when the live version changed after planning

Limitations#

  • The gate is the whole pr suite. In a shared checkout, other people's unfinished work can keep the suite red and block every deploy. Skipping the gate (-x :pr) or the ClickHouse migrations (-x :clickhouse) is a decision for the owner of the release.
  • Plan and apply must see the same files. Anything that rebuilds the bundle or its assets between the two steps makes the apply refuse, and you plan again.
  • Every runtime still deploys on its own. The order between them comes from the delivery block; deploying a graph as one operation is a design, described above, and none of it is built.

Reference#

  • The declarations: the delivery block in BestBuds' root build.gradle.kts, and the shared Worker settings in buildSrc (BestBudsDelivery.kt).
  • Plans and receipts: build/dependeasy/plans/deploy/ and build/dependeasy/receipts/deploy/ in the BestBuds checkout.
  • Related pages: Dependeasy for the Gradle plugin, Cloud pane for deploys from Hangar, Observe and diagnose, and Shadow for checking a change against a copy of production first.