I finally got the time to build out some stacks on Rancher (instead of just playing with dummy stacks) and am very pleased with the result.
I am hit with one hurdle though, which is dictated by the software design which I cannot easily change.
I have a stack consisting of an event bus (pub/sub) and multiple subscribers. Each event bus must have one, and only one of each type of subscribers. Having two subscribers of the same type on the same event bus would cause data duplication, and having none of a given type would cause data loss.
I see that, within my stack, I can scale each service independently, but this would not provide the desired result. The subscribers use Rancher’s DNS to find their event bus, and I cannot guarantee which one they are connected to.
So far, I only found an option to guarantee the “no more than one sub per event bus” requirement:
Instead of using the “eventbus” hostname, I would:
SVC_INDEX=$(curl -s http://rancher-metadata/2015-12-19/self/container/service_index)
EVENT_BUS=$(curl -s http://rancher-metadata/2015-12-19/self/stack/services/eventbus/containers/$SVC_INDEX/primary_ip)
And then make my subscribers use $EVENT_BUS to connect to the event bus, instead of the “eventbus” DNS name.
However, the problem I still have is that I cannot easily scale the whole stack. If I have more subscribers than event bus, that curl for EVENT_BUS above would not return anything - which I can catch and error on, but not desirable. I’d love to be able to just turn the volume on a complete stack to eleven, and not just on a per-service level.