Introducing a new way to review your PRs.

Read the announcement

getarcaneapp / arcane

Modern Docker Management, Designed for Everyone

View on GitHub

26 documents · Updated Oct 19, 2026

docs / swarm-orchestration

Swarm orchestration and cluster management

Arcane is a control plane for Docker Swarm. It lets an engineer create or join a cluster, manage managers and workers, deploy services and stacks, inspect tasks, and maintain cluster configs and secrets. Each operation uses the selected Arcane environment as its connection context.

System boundary

Arcane sits between the web interface and the Docker Swarm manager. The manager remains the source of truth for cluster state and scheduling. Arcane adds an environment-aware API, permission checks, audit records for completed changes, readable summaries, and links between Swarm nodes and Arcane environments.

The main control path is:

flowchart LR
    Engineer[Engineer] --> UI[Arcane web interface]
    UI --> API[Environment-scoped Swarm API]
    API --> Manager[Docker Swarm manager]
    Manager --> Nodes[Swarm nodes]
    Nodes --> Tasks[Service tasks]
    API --> Agents[Arcane node-agent coverage]
    Agents --> Environments[Visible or dedicated environments]

An environment is the Arcane connection context for a Docker engine. A remote environment can proxy requests through the parent manager environment. Cluster state and Arcane agent reachability remain separate concerns.

Cluster lifecycle

Cluster membership

Cluster membership covers initialization, joining, leaving, unlocking, and security key rotation. A manager provides separate manager and worker join tokens. Arcane also exposes the manager unlock key when autolock protects manager data.

Initialization creates a cluster on the selected engine. Joining adds an engine through manager addresses and a role-specific token. Leaving removes an engine and may be forced. Token rotation and unlock-key rotation affect cluster access rather than workload state. Successful lifecycle changes create audit events, while failed join details redact the submitted token.

The Easy Join flow applies this model to several Arcane environments. It checks access to the manager and each target, prevents the manager from being a target, lets the engineer choose each target's role and availability, and returns an independent result for every target. It uses current manager addresses when none are supplied and does not expose join tokens in target results.

References: backend/…/handler.go• L155-313 backend/…/handler.go• L451-500 backend/…/easy_join.go• L13-63 backend/…/service.go• L409-565 backend/…/service.go• L120-270 types/…/lifecycle.go• L9-128 frontend/…/+page.svelte• L143-300 frontend/…/easy-join-dialog.svelte• L21-137

Cluster policy

The Swarm specification defines cluster-wide policy. It controls manager behavior and node participation. Arcane reads the current specification and sends versioned updates so a change applies to the cluster that the engineer inspected.

The cluster page groups policy updates with token rotation and manager security actions. This keeps changes that affect all nodes separate from changes to one service or one node. Successful policy changes are recorded in the audit trail.

References: backend/…/handler.go• L316-334 backend/…/service.go• L273-306 types/…/lifecycle.go• L47-63 frontend/…/+page.svelte• L274-300

Node coordination

Node roles and availability

A Swarm node is a manager or a worker. Managers maintain cluster control. Workers run assigned tasks. Node availability controls whether the scheduler may place new work on a node.

Arcane supports node inspection, role changes, availability changes, label updates, promotion, demotion, and removal. These settings are scheduling inputs, so a node change can alter where later service tasks run. The node view can open tasks with the node already selected.

References: backend/…/handler.go• L132-175 backend/…/handler.go• L344-448 backend/…/service.go• L94-170 backend/…/service.go• L626-689 types/…/node.go• L47-153 frontend/…/+page.svelte• L19-70 frontend/…/+page.svelte• L91-103 frontend/…/nodes-table.svelte• L67-76 frontend/…/nodes-table.svelte• L215-217

Node-agent coverage

Node-agent coverage links a visible Swarm node to an Arcane environment that can report or manage that node. Arcane distinguishes local coverage, an environment binding, and a dedicated agent deployment. It reports connected, pending, offline, mismatched, and ambiguous states.

Arcane accepts a binding only when the environment reports the requested Swarm node identity. If more than one environment matches, the node stays ambiguous until an engineer chooses the binding. Reconciliation persists only a unique verified match. The nodes view reconciles coverage when the selected environment or user changes and warns when nodes remain uncovered. Provisioning ensures a node-bound environment and returns deployment snippets, with optional token rotation. Fresh poll or tunnel activity can correct stale stored status. A live identity probe can mark a binding mismatched when it reports another node. The node surface can refresh, replace, detach, and remove coverage.

References: backend/…/handler.go• L178-317 backend/…/handler.go• L319-341 backend/…/service.go• L172-235 backend/…/service.go• L261-407 backend/…/service_test.go• L150-203 backend/…/environment_swarm_nodes.go• L15-113 types/…/node.go• L10-45 frontend/…/+page.svelte• L39-70 frontend/…/+page.svelte• L91-103 frontend/…/nodes-table.svelte• L78-213

Workload orchestration

Services and tasks

A Swarm service is the desired definition of a workload. It includes the image, task mode, replica goal, ports, networks, mounts, and update behavior. A task is one scheduled attempt to run that service on a node. Service summaries compare desired replicas with running replicas. Task views show placement, current state, desired state, and errors.

The service detail surface connects overview, logs, tasks, configuration, network data, and storage. It also supports permission-controlled updates, rollback, removal, and scaling. Scaling applies to replicated services and replicated jobs. Global services and global jobs do not use a scalable replica target. Arcane records successful service changes and refreshes related runtime data after a successful change. The service list also provides a permission-gated path to create a service in the selected environment.

For the detailed resource lifecycle and scheduling relationships, see Swarm resources and runtime and Workload management.

References: backend/…/handler.go• L80-262 backend/…/service.go• L40-151 backend/…/service.go• L259-453 backend/…/service.go• L456-547 backend/…/service.go• L97-117 backend/…/service.go• L309-367 types/…/service.go• L57-173 types/…/task.go• L9-79 frontend/…/swarm-service.ts• L52-95 frontend/…/+page.svelte• L20-78 frontend/…/+page.svelte• L180-236 frontend/…/+page.svelte• L254-340 frontend/…/service-logs-panel.svelte• L25-86 frontend/…/service-tasks-panel.svelte• L24-109 frontend/…/service-configuration.svelte• L24-146 frontend/…/service-network.svelte• L49-185 frontend/…/service-storage.svelte• L50-162

Stacks and source

A stack is a named group of related Swarm services. Arcane deploys a stack from Compose content with optional override content, environment content, and extra files. The stack name groups its services and tasks.

Arcane keeps the source used for a stack so an engineer can inspect or edit the desired definition later. The editor combines Compose, environment data, override content, and workspace files. An engineer can also start from a template, convert a Docker run command, or use a Git source flow. Deployment can prune removed services, pass registry credentials, and choose when images are resolved. Arcane can also render and validate the combined configuration before deployment.

The stack view separates saved source from live services and tasks. A live stack exposes its services and tasks, while authorized source access exposes saved Compose and environment files even when no live services remain. Updating saved source redeploys the stack with pruning so removed services leave the cluster. If that deployment fails, Arcane restores the prior saved source. Direct service changes suit one-off runtime actions, while stack changes suit a grouped Compose-defined workload.

References: backend/…/handler.go• L89-294 backend/…/service.go• L67-199 backend/…/service.go• L202-370 backend/…/service.go• L455-590 backend/…/service_test.go• L54-200 types/…/stack.go• L5-180 frontend/…/swarm-service.ts• L163-212 frontend/…/+page.svelte• L16-58 frontend/…/+page.svelte• L45-95 frontend/…/+page.svelte• L115-140 frontend/…/+page.svelte• L183-245 frontend/…/+page.svelte• L291-317 frontend/…/+page.svelte• L337-375 frontend/…/+page.svelte• L377-501 frontend/…/+page.svelte• L78-182 frontend/…/+page.svelte• L184-242 frontend/…/+page.svelte• L260-399

Cluster resources

Configs and secrets

Configs and secrets are cluster resources that services can use as managed input. A config holds non-sensitive service data. A secret holds sensitive service data and remains protected even when its metadata appears in an inspection response.

Arcane provides separate management surfaces for each resource type. These resources are not edited in place. A new version normally requires a replacement resource and a service or stack change. Successful creation and removal are recorded in the audit trail, and missing resources return a not-found result.

References: backend/…/handler.go• L48-136 backend/…/service.go• L27-98 backend/…/handler.go• L48-136 backend/…/service.go• L27-98 backend/…/service.go• L66-71 types/…/config_secret.go• L10-31 frontend/…/+page.svelte• L9-44 frontend/…/+page.svelte• L9-44

Runtime identity

Arcane exposes cluster identity and runtime status as separate concepts. Cluster information includes identity, timestamps, the current specification, and root-key rotation state. Runtime status records whether Swarm is enabled for the environment.

This distinction matters during setup and recovery. An environment can be selected before it has an active Swarm. Arcane synchronizes its enabled marker with Docker runtime state, but Docker remains the authority for whether Swarm is active. A cluster can also be active while an Arcane node agent is offline. Use cluster inspection for Docker state and agent status for Arcane coverage.

References: backend/…/handler.go• L89-152 backend/…/service.go• L39-117 backend/…/service.go• L388-448 types/…/swarm.go• L9-55 frontend/…/swarm-service.ts• L214-222 frontend/…/+page.svelte• L28-79

Frontend management surfaces

Environment-scoped views

The web interface presents one management surface for each major Swarm concern. Each view uses the selected environment and applies the permission for the resource it changes. List views refresh when the environment changes. Detail views connect related runtime records so an engineer can move from a service or stack to the tasks and source that explain its state.

The cluster view gates state, join-token, and unlock-key reads by their separate permissions. The node view reconciles agent coverage before refreshing its table. The service and stack views gate creation by resource permission. The task view uses either the cluster-wide task query or the node-scoped task query. Sensitive cluster values remain permission-gated. The API presents empty collections consistently and maps manager, not-found, conflict, and validation failures to clear request errors.

SurfaceMain responsibility
ClusterInitialize or join a cluster, inspect policy, manage tokens, unlock managers, and leave
NodesInspect nodes, change role or availability, edit labels, manage coverage, and open node tasks
ServicesCreate, inspect, update, scale, roll back, remove, and view task state and logs
StacksReview groups, deploy, edit Compose source, inspect source, and remove stacks
TasksInspect task placement and runtime state across the cluster or one node
ConfigsCreate and remove non-sensitive cluster configs
SecretsCreate and remove sensitive cluster secrets

References: backend/…/handler.go• L89-152 backend/…/handler.go• L399-438 backend/…/handler.go• L48-136 backend/…/service.go• L27-98 backend/…/handler.go• L132-500 backend/…/service.go• L94-235 backend/…/handler.go• L48-136 backend/…/service.go• L27-98 backend/…/handler.go• L80-262 backend/…/service.go• L40-453 backend/…/handler.go• L89-294 backend/…/service.go• L67-590 backend/…/service.go• L97-117 backend/…/service.go• L309-367 frontend/…/swarm-service.ts• L52-302 frontend/…/+page.svelte• L28-69 frontend/…/+page.svelte• L25-65 frontend/…/+page.svelte• L20-68 frontend/…/+page.svelte• L16-48 frontend/…/+page.svelte• L199-245 frontend/…/+page.svelte• L291-317 frontend/…/+page.svelte• L337-501 frontend/…/+page.svelte• L19-65 frontend/…/+page.svelte• L73-243 frontend/…/+page.svelte• L73-243 frontend/…/+page.svelte• L260-399

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to environment selection or remote proxying must preserve the difference between the selected environment and the manager that owns the cluster.
  • Changes to node-agent binding must preserve identity checks and the difference between ambiguous, mismatched, and offline states.
  • Changes to node task links must preserve the node ID and hostname filter.
  • Changes to service summaries must keep service IDs linked to task and node data. Desired and running replicas must retain separate meanings.
  • Changes to service creation must keep the selected-environment permission check aligned with the create request.
  • Changes to service tabs and actions must preserve the links between service ID, refreshed state, task queries, log streams, and permission gates.
  • Changes to service mode handling must keep scaling limited to replicated and replicated-job modes.
  • Changes to stack deployment must keep saved source, extra files, image resolution, prune behavior, registry authentication, and live services consistent.
  • Changes to stack source updates must preserve redeployment with pruning and restoration of the prior source when deployment fails.
  • Changes to stack rendering or source updates must preserve validation before deployment and redeployment after an edited source is saved.
  • Changes to stack detail tabs must preserve the difference between live services and tasks and saved source, including source access when no live services exist.
  • Changes to stack refresh handling must keep stack, service, task, and source results independent.
  • Changes to cluster security actions must keep tokens, unlock keys, hidden values, token redaction, and versioned policy updates aligned across API and UI.
  • Changes to Easy Join must keep manager and target permissions distinct and preserve per-target results without exposing tokens.
  • Changes to config or secret handling must preserve their separate permissions, not-found behavior, and removal behavior.

Important failure modes

TriggerConsequenceGuard
The selected engine is not an active Swarm managerCluster reads and manager operations failConfirm manager role and reachability before changing resources
A node agent reports a different node identity during a live probeCoverage is marked mismatched and is not used for the requested nodeVerify identity before binding
More than one environment matches a nodeReconciliation leaves the node ambiguousSelect one candidate and bind it explicitly
A join token or manager address is staleThe target cannot join the intended clusterRead current values from the manager
A join error includes the submitted tokenLogs or API details can expose a credentialRedact the token before logging and returning the error
A service mode has no scalable replica targetScaling is rejected and the workload is unchangedCheck the service mode before scaling
A service change succeeds but the detail view is not refreshedThe page shows stale desired or runtime stateRefresh the service and related data
A stack definition or supporting file is invalidCompose rendering or deployment failsValidate the complete Compose, override, environment, and extra-file set
A stack source edit deploys only part of the new definitionRemoved services remain in the clusterRedeploy the full source with pruning
A stack source edit fails after the source is savedThe source can describe a state that never reached the clusterRestore the prior source when redeployment fails
Saved stack source is missing or forbiddenLive services can remain visible without an editable source viewTreat live state and source access as separate states
A stack refresh returns mixed resultsOne view can show current data beside stale dataRefresh and report each resource independently
A config or secret is still used by a serviceDocker rejects removalRemove the consuming reference first

Key files

FileWhy to read it
backend/…/service.goShared Swarm boundary for manager checks, cluster lifecycle, task views, and runtime state
backend/…/handler.goAPI boundary for cluster lifecycle actions, audit records, token redaction, and error mapping
backend/…/service.goNode management, identity coverage, Easy Join, and node task coordination
backend/…/handler.goNode management, task links, agent coverage, and Easy Join boundaries
backend/…/service.goService summaries, lifecycle actions, task queries, scaling, rollback, and logs
backend/…/handler.goService lifecycle, task queries, scaling, rollback, and audit boundaries
backend/…/service.goStack deployment, persisted source, redeployment, live-resource queries, and removal
backend/…/handler.goStack deployment, source editing, rendering, live-resource queries, and removal
backend/…/service.goConfig inspection and lifecycle boundary
backend/…/service.goSecret inspection and lifecycle boundary
backend/…/environment_swarm_nodes.goBinding and reconciliation rules for Swarm node coverage
types/…/lifecycle.goContracts for cluster setup, membership, and security actions
types/…/service.goService desired-state and runtime summary model
types/…/node.goNode and coverage status model
types/…/task.goTask state and placement model
types/…/stack.goStack source and deployment contracts
types/…/config_secret.goConfig and secret API model
frontend/…/swarm-service.tsEnvironment-scoped requests for Swarm management
frontend/…/+page.svelteCluster setup, security, policy, and refresh surface
frontend/…/+page.svelteNode coverage reconciliation, warnings, and refresh surface
frontend/…/+page.svelteService list, creation permission, and refresh surface
frontend/…/+page.svelteService detail actions and related runtime views
frontend/…/service-logs-panel.svelteService log stream controls
frontend/…/service-tasks-panel.svelteService task state and placement view
frontend/…/+page.svelteStack list, creation permission, and refresh surface
frontend/…/+page.svelteCompose source editor, workspace files, source updates, and deployment options
frontend/…/+page.svelteStack services, tasks, saved source states, refresh, and removal
frontend/…/+page.svelteInitial, refresh, cluster-wide, and node-scoped task loading
frontend/…/+page.svelteConfig management surface
frontend/…/+page.svelteSecret management surface