Deploy Gluesync on Docker Swarm
This page explains how to install Gluesync as a Docker Swarm stack with the Swarm kit, and what Gluesync Conductor does differently when it manages a Swarm stack instead of a Docker Compose project.
The Swarm kit deploys a stack named gluesync. There are two variants:
-
Linux: the
gluesync-docker-swarmdirectory of the kit. It runs on one node or on several, with Linux containers. -
Windows Server 2022: the
gluesync-docker-swarm-windowsdirectory of the kit. It runs on a single node, with Windows containers.
|
The kit from Get Gluesync is the source of truth. Its |
What is in the stack
| Service | Role |
|---|---|
|
Traefik. Publishes ports 80 and 443 (80 redirects to 443) and routes requests to the other services. |
|
Gluesync Core Hub and its web UI. |
|
Gluesync Chronos. |
|
Metrics storage, served under |
|
Dashboards, served under |
|
Lists, restarts and updates the services of the stack. See Conductor in Swarm mode. |
Core Hub runs as a single replica. It has no clustering, so scaling it does not make it highly available.
The kit does not deploy agents. Add them from Core Hub after the platform is running: Conductor adds each agent to docker-stack.yml and deploys it.
|
The |
Install on Linux
Node roles
The Linux kit uses two node roles. One machine can have both:
- Manager
-
A Swarm manager that holds the kit directory. It runs Traefik and Conductor.
- Data node
-
The node labelled
gluesync.data=true. It holds all persistent data underGLUESYNC_DATA_ROOT(default/var/lib/gluesync-swarm) and runs Core Hub, Chronos, Prometheus and Grafana.
Requirements
-
Docker Engine 23 or later, with Swarm mode, on every node.
-
Between the nodes: 2377/tcp to the managers, 7946/tcp and 7946/udp, and 4789/udp. See Docker’s Swarm ports.
-
Ports 80 and 443 free on the manager. To use other ports, set
TRAEFIK_HTTP_PORTandTRAEFIK_HTTPS_PORTin.env.
Steps
-
Create the swarm on the manager and join the other nodes:
docker swarm init # on the manager docker swarm join-token worker # prints the join command for the other nodes -
Copy the
gluesync-docker-swarmdirectory to the data node and prepare it, as root:sudo ./prepare-host.shThe script creates the data folders, copies the licence, certificates and configuration from
shared/andbootstrap-core-hub.jsonintoGLUESYNC_DATA_ROOT, and labels the nodegluesync.data=true. When the data node is not a manager, the script prints the label command to run on a manager. -
On the manager that holds the kit directory, deploy the stack:
./deploy.shThe script creates
.envfrom.env.example, stores the absolute path of the kit directory in it, labels the managergluesync.kit=trueand runsdocker stack deploy. -
Check that the services are running:
docker stack services gluesync -
Open
https://<manager address>/. The default Core Hub credentials areadmin/admin; replace them after the first sign-in. Grafana is at/grafana(admin/password, set in.env). The certificate is self-signed, so the browser shows a warning the first time.
To run everything on one machine, run docker swarm init, sudo ./prepare-host.sh and ./deploy.sh on it.
Persistence
All data (Core Hub, Chronos, Prometheus, logs and the shared configuration) lives in host folders on the data node, under GLUESYNC_DATA_ROOT. Swarm named volumes are local to a node: a task rescheduled onto another node would start with an empty volume. For this reason the stateful services are pinned to the node labelled gluesync.data=true and use bind mounts.
Back up GLUESYNC_DATA_ROOT on the data node. See Backup and restore.
Install on Windows Server 2022
The Windows kit runs every service on a single node: the Swarm manager that holds the kit directory. The services keep their configuration, data and logs in folders of that directory.
Requirements
-
Windows Server 2022 (build 20348) with the latest cumulative update. On the unpatched evaluation build (20348.587), Swarm routes neither service addresses nor published ports. The kit was tested on build 20348.5622.
-
The Containers feature and Docker Engine for Windows Server, running as a service. The images are
ltsc2022images and run with process isolation. -
In a Hyper-V virtual machine, MAC address spoofing turned on for the VM network adapter, which overlay networking needs. On the Hyper-V host, run
Set-VMNetworkAdapter -VMName <vm> -MacAddressSpoofing On. -
Ports 80 and 443 free on the server. To use other ports, set
TRAEFIK_HTTP_PORTandTRAEFIK_HTTPS_PORTin.env.
Steps
Open PowerShell as Administrator in the gluesync-docker-swarm-windows directory.
-
Prepare the server:
.\prepare-host.ps1The script checks the Windows build, the Containers feature and Docker, creates the folders the stack uses, opens the published and Swarm ports in the firewall, pulls the images, creates the swarm (
docker swarm init) and labels the nodegluesync.kit=true. To choose the address the swarm uses, pass-AdvertiseAddress <ip>. -
Deploy the stack:
.\deploy.ps1The script creates
.envfrom.env.example, stores the absolute path of the kit directory in it and runsdocker stack deploy. -
Check that the services are running:
docker stack services gluesync -
From another machine, open
https://<server address>/. The default Core Hub credentials areadmin/admin; replace them after the first sign-in. Grafana is at/grafana(admin/password, set in.env). The certificate is self-signed, so the browser shows a warning the first time.On Windows, the published ports answer on the server address from other machines, but not on
localhostfrom the server itself.
Back up the data and shared folders of the kit directory.
Why Core Hub reads its configuration from C:\gsconfig
The Core Hub image declares C:\opt\gluesync\data and C:\opt\gluesync\shared as volumes, and Windows refuses a Swarm mount onto those paths (hcs::CreateComputeSystem … The request is not supported). The stack therefore mounts the kit’s shared and data\core-hub folders under C:\gsconfig, and tells Core Hub so with COMMONS_CONFIG_DIR, DATA_DIR and LOG_CONFIG_FILE. The kit’s shared\security-config.json points the TLS keystore to C:\gsconfig as well.
|
Keep the |
The Windows stack also sets two Conductor settings: DOCKER_CLI_PATH points to the Docker CLI in the Windows image, and UPDATE_VERIFY_MAX_WAIT_SECONDS is 600, because a Windows image is a few gigabytes.
Edit the stack
The kit’s docker-stack.yml is the source of truth for the stack. After you edit it, run ./deploy.sh (Linux) or .\deploy.ps1 (Windows) again.
-
Image fields: keep them as literal
repo:tagvalues. Conductor rewrites theimage:line of a service when it updates it, and leaves an image written with a variable, such as${VAR}, alone. -
Resources: the stack sets no CPU or memory limits, because Swarm rejects a limit above a node’s CPU count. Add
deploy.resourcesto the services to match your nodes. -
Environment:
docker stack deploydoes not read.envon its own. The deploy scripts and Conductor load it before they deploy.
|
|
Conductor in Swarm mode
Conductor recognizes a Swarm stack from the labels of its own service; the kit also sets CONDUCTOR_ORCHESTRATOR=swarm. The Conductor API is the same in both modes, so Platform updates and the other Core Hub pages work as with Docker Compose.
Conductor must run on a Swarm manager, because only managers answer the Swarm API for services, tasks and service logs. On a worker, Conductor answers every request with the diagnosis code SWARM_NOT_MANAGER. The kit places it on the manager labelled gluesync.kit=true, with the Docker socket (Linux) or named pipe (Windows) and the kit directory mounted.
Updates with automatic rollback
When you update a service from Platform updates, Conductor:
-
Leaves a service that already runs the image of the stack file untouched.
-
Sets the new image on the service, with automatic rollback as the failure action.
-
Waits until the update has completed and all replicas have kept running for
UPDATE_VERIFY_SECONDS(default 20). It waits at mostUPDATE_VERIFY_MAX_WAIT_SECONDS(default 180). -
Writes the new tag to
docker-stack.yml, so that a later deploy does not revert the update.
If the new version does not become stable, Swarm rolls the service back to its previous image, or Conductor rolls it back when Swarm has not. The update is reported as failed and the stack file keeps the previous tag.
Swarm pulls the new image while it starts the new task. The time spent downloading does not count against UPDATE_VERIFY_MAX_WAIT_SECONDS, so a large image is not rolled back for downloading slowly. UPDATE_PULL_MAX_WAIT_SECONDS (default 1200) limits the download itself.
When Conductor updates itself, it replies to the request first and then updates its own service. If the new Conductor fails to start, Swarm rolls it back, and the Conductor that starts again writes its own image back to the stack file.
Release channel switch
Conductor in Swarm mode updates itself only to a newer version. Older Conductor releases do not support Swarm, and installing one would break the stack.
-
An alpha build of a version updates to the beta or GA release of the same version, or to a later one. You can therefore switch the release channel in Platform updates from alpha to beta or GA without losing Swarm support.
-
Conductor never updates itself to an older version, for example when the GA channel still offers a release without Swarm support.
When the target version is refused, the Conductor entry of the update reports the reason and Conductor is not offered as an update; the other services are updated as usual.
No restart on redeploy
After an update, Conductor pins the service to the digest of the new image and gives the service its own update settings back, also when the update was rolled back. Running ./deploy.sh or .\deploy.ps1 again afterwards therefore does not restart the services that Conductor updated.
Other differences from Docker Compose
| Action | In Swarm mode |
|---|---|
Start |
Scales the service to the replicas of the stack file (default 1). A service that does not exist yet is created with |
Stop |
Scales the service to 0 replicas. |
Restart |
Forces a rolling update of the service and waits until it has converged. Restarting the whole stack restarts Conductor last. |
Pull |
Does nothing: Swarm pulls the image during the update. |
Collect logs |
Reads the logs with |
Migration to Gluesync 2.x |
Not supported. Conductor refuses it with the diagnosis code |
In Swarm mode, Conductor does not edit the stack file or recreate services at startup, as it does to heal a Docker Compose installation, and it does not prune old images after an update, because the Docker API only reaches the manager.
For the settings that tune these behaviours, see the environment configuration of Gluesync Conductor.
Next steps
For Swarm concepts and commands, see the Docker Swarm documentation and the docker stack deploy reference.