Replies: 1 comment
-
Hey, That's an excellent question, and thank you for raising it. You've hit on a key point about running DockFlare in a multi-replica Swarm environment. You are completely right. Currently, DockFlare is "container-aware," not "Swarm-service-aware." When you set multiple replicas, it sees three containers with identical labels and gets confused, which leads to the "ugly" behavior you described. It doesn't understand that these three containers are all part of a single, load-balanced service. Supporting Swarm services properly is a fantastic idea and something I'd love to implement. To do it right would mean a pretty significant architectural change inside DockFlare: It would need to start listening for service events from Docker, not just container events. Because this is a fairly big change, I can't give you an immediate timeline, but I am adding it to my list of major features to plan for a future release. In the meantime, there is a workaround you can use: You can force only one of your replicas to have the DockFlare labels by using placement constraints. This keeps DockFlare happy while still allowing Swarm to manage the other replicas for high availability. You would pin the "special" container to a specific node (like a manager node) and leave the rest unconstrained. services:
my-app:
image: my-image
deploy:
replicas: 3
networks:
- cloudflare-net
labels:
# These labels will apply to ONLY ONE container
- "dockflare.enable=true"
- "dockflare.hostname=my-app.example.com"
- "dockflare.service=http://my-app:80" # This still correctly points to the Swarm service for load balancing
deploy:
placement:
constraints:
# This pins this specific configuration to one node
- "node.hostname == my-swarm-manager-node" Thanks again for the great suggestion. It's super valuable feedback. Cheers, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
If you can enable the reading of swarm services labels, this will be fantastic.
I know that in swarm I can also set containers labels, but this become ugly when you have a service with more than 1 replica in a cluster.
And this can be a problem in th CF config and in the Swarm load balancing
Beta Was this translation helpful? Give feedback.
All reactions