Share feedback, ideas and get community help

Updated 5 months ago

Sharing docker swarm setup

At a glance

The community member wanted to be able to run multiple instances of a viewer to ensure failover and load balancing. They solved this by using a Docker Swarm configuration, deploying the same docker-compose.yml and .env files they use for a standalone instance, but using "docker stack deploy" instead of "docker compose up". They changed the publish mode of the viewer and builder services to "host" instead of "ingress" for external access, and reduced the replicas for the builder to 0 while setting the viewer to 1, but can easily scale. The community member has tied in a load balancer to automatically scale with new containers, and uses Portainer to manage the Swarm spread across one master+worker and three other worker nodes.

I just wanted to share, in case anyone else gets value from this...

I wanted to be able to run multiple instances of the viewer to ensure if the connection to the viewer goes down or gets overloaded. I solved this in a docker swarm configuration (a personal favorite). I used the same docker-compose.yml file and .env files I use to set up a standalone instance, but instead of 'docker compose up -d', I used 'docker stack deploy -c docker-compose.yml typebot'. I then changed the publish mode of the resulting viewer and builder services, which are attached to a custom swarm overlay network, to "host" instead of "ingress" (for external access). Now I have replication and failover for both the builder and viewer. In the end, I reduced the replicas for the builder to 0 and set the viewer at 1 for now, but I can easily scale. I've tied in my load balancer so it will automatically scale with new containers. I use Portainer to manage my swarm and have my swarm spread over one master+worker and three other worker nodes.
Add a reply
Sign up and join the conversation on Discord