We used go-demo service throughout the book. It helped us understand better how Swarm works. Among other things, we scaled the service quite a few times. That was easy to do since it is stateless. We can create as many replicas as we want without having to worry about data. It is stored somewhere else.
The go-demo service externalizes its state to MongoDB. If you paid attention, we never scaled the database. The reason is simple. MongoDB cannot be scaled with a simple docker service scale command.
Unlike Docker Flow Proxy that was designed from the ground up to leverage Swarm's networking to find other instances before replicating data, MongoDB is network agnostic. It cannot auto-discover its replicas. To make things more complicated, only one instance can be primary meaning that only one instance can receive write requests. All that means that we cannot scale Mongo using Swarm. We...