From 6e00c3bbf02908a8221cd55a0d68a73454829e90 Mon Sep 17 00:00:00 2001 From: Thomas Schreiner Date: Fri, 20 Mar 2026 19:58:46 +0100 Subject: [PATCH] feat(swarm): constrain core services to initial installation node Pin the Dokploy management services (web, postgres, and redis) to the node where Dokploy was first deployed. This ensures data persistence and service stability by preventing the orchestrator's core components from migrating across the Swarm cluster. --- apps/website/public/install.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/website/public/install.sh b/apps/website/public/install.sh index 1bed8810..4932fc84 100644 --- a/apps/website/public/install.sh +++ b/apps/website/public/install.sh @@ -238,9 +238,14 @@ install_dokploy() { echo "Generated secure database credentials (stored in Docker Secrets)" + # Add label to current node so we can constrain our services to this node + docker node update \ + --label-add role=dokploy-main \ + $(hostname) + docker service create \ --name dokploy-postgres \ - --constraint 'node.role==manager' \ + --constraint 'node.labels.role==dokploy-main' \ --network dokploy-network \ --env POSTGRES_USER=dokploy \ --env POSTGRES_DB=dokploy \ @@ -252,7 +257,7 @@ install_dokploy() { docker service create \ --name dokploy-redis \ - --constraint 'node.role==manager' \ + --constraint 'node.labels.role==dokploy-main' \ --network dokploy-network \ --mount type=volume,source=dokploy-redis,target=/data \ $endpoint_mode \ @@ -280,7 +285,7 @@ install_dokploy() { --publish published=3000,target=3000,mode=host \ --update-parallelism 1 \ --update-order stop-first \ - --constraint 'node.role == manager' \ + --constraint 'node.labels.role==dokploy-main' \ $endpoint_mode \ $release_tag_env \ -e ADVERTISE_ADDR=$advertise_addr \ @@ -306,7 +311,7 @@ install_dokploy() { # Optional: Use docker service create instead of docker run # docker service create \ # --name dokploy-traefik \ - # --constraint 'node.role==manager' \ + # --constraint 'node.labels.role==dokploy-main' \ # --network dokploy-network \ # --mount type=bind,source=/etc/dokploy/traefik/traefik.yml,target=/etc/traefik/traefik.yml \ # --mount type=bind,source=/etc/dokploy/traefik/dynamic,target=/etc/dokploy/traefik/dynamic \