Skip to Content
⚠️ Dockflow is currently under development. Bugs may occur. Please report any issues on GitHub.
ConfigurationMulti-Node Deployment

Multi-Node Deployment

Deploy your application across multiple servers using Docker Swarm with managers and workers.

Swarm Architecture

  • Managers: Receive deployments and orchestrate the cluster
  • Workers: Run containers distributed by managers
  • Multi-manager: For high availability (tolerates manager failures)

Basic Configuration

# .dockflow/servers.yml servers: manager: role: manager tags: [production] worker1: role: worker tags: [production] worker2: role: worker tags: [production] defaults: user: dockflow port: 22

Each server needs a connection string in your secrets:

PRODUCTION_MANAGER_CONNECTION=eyJob3N0Ijoi... PRODUCTION_WORKER1_CONNECTION=eyJob3N0Ijoi... PRODUCTION_WORKER2_CONNECTION=eyJob3N0Ijoi...

Workers automatically join the Swarm cluster. You only deploy to the manager — Swarm distributes workloads automatically.

Multi-Manager for High Availability

For production environments, configure multiple managers for failover:

servers: manager1: role: manager tags: [production] manager2: role: manager tags: [production] manager3: role: manager tags: [production] worker1: role: worker tags: [production] worker2: role: worker tags: [production]

For Raft consensus, use an odd number of managers:

  • 3 managers = tolerates 1 failure
  • 5 managers = tolerates 2 failures

Automatic Failover

When deploying with multiple managers, Dockflow automatically:

  1. Checks each manager’s status via SSH
  2. Finds the Swarm leader (or any reachable manager)
  3. Falls back to the next available manager if one is down
# Dockflow finds the active leader automatically dockflow deploy production # Disable failover (use first manager only) dockflow deploy production --no-failover

Example output with failover:

⠋ Checking 3 managers for active leader... Checking manager1... ✗ unreachable Checking manager2... ✓ LEADER ⚠ Using manager2 (leader). Unreachable: manager1 (unreachable)

How Deployment Works

  1. Deploy targets the manager — Dockflow connects only to the active manager
  2. Swarm distributes workloads — Containers are scheduled across all nodes
  3. Images are transferred to workers — Via SSH streaming or registry
dockflow deploy production # ✓ Deployment completed! Swarm cluster: 3 managers + 2 worker(s)

Server-Specific Environment Variables

Override variables for specific servers:

servers: manager1: role: manager tags: [production] env: NODE_ID: "manager-1" PROMETHEUS_ENABLED: "true" worker1: role: worker tags: [production] env: NODE_ID: "worker-1" GPU_ENABLED: "true"