We run Temporal in Swarm and to be able to do this we need a more flexible way of setting broadcastAddress.
Right now we solve the problem by a minor change in entrypoint.sh
if [ "$TEMPORAL_BROADCAST_ADDRESS_FILTER" != "" ]; then
for IP in $HOST_IP; do
if [[ "$IP" =~ ^$TEMPORAL_BROADCAST_ADDRESS_FILTER ]]; then
export TEMPORAL_BROADCAST_ADDRESS="$IP"
fi
done
fi
With this we can make the service bind to the network range we specified for the overlay temporal-network in swarm.
Thanks for reaching out with this proposal. We’d love to merge something that tackles this issue. I’d like to think through a couple scenarios and make sure we’re solving the general problem for users outside of swarm as well. So my questions are:
what if cidrs are not known upfront?
is there any issue with an actual cidr instead of a prefix filter?
are there other attributes we might want to use instead of ip/cidr
is there any danger of breaking existing use cases?
If the CIDR is not known binding to a interface might be good.
is there any issue with an actual cidr instead of a prefix filter?
I think a CIDR is preferred over a prefix filter. In our case we selected a regexp filter because it was simpler to implement in bash without any external dependencies.
are there other attributes we might want to use instead of ip/cidr
We might want to select by: Interfaces, Private addresses, Public Addresses, Interfaces that is UP.
is there any danger of breaking existing use cases?
Let’s say we bind to an interface A with IP 10.0.6.23 and we then by misstake select to broadcast on CIDR 10.0.8.0/24 which is interface B. We then have a situation where we broadcast a IP that does not serve the given port.
So to solve this and cover most of the use cases we could make use of Hashicorp’s pretty cool package:
that sounds really cool and very flexible - so would you envision having a configuration/env variable that would be the template string for what you want with a default that represents current behavior?
I have started to work on this. It can be implemented in different ways of course and I wonder if you prefer a Parse() method on the config that replaces the template with a IP. This could be done on server.Start()
The other alternative is to parse the values later on before starting the grpc servers / membership ?