-
-
Notifications
You must be signed in to change notification settings - Fork 89
feat(swarm): constrain core services to initial installation node #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||||||||||||||
|
Comment on lines
+241
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| 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 \ | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker node updateIf
docker node updatefails (e.g. because the Swarm node name doesn't match the system hostname), the script will continue and create all three services with the constraintnode.labels.role==dokploy-main. Since no node will carry that label, every service will remain permanently in a pending/unschedulable state and Dokploy will never start — with no error message from the install script.Add an explicit failure check so the script aborts early if labelling fails: