3 ms·
With something like service_binary, how do you wire up services? For example, If main.cc depended on Redis, how would you get the host and port of the Redis dep
by sa46 5y ago
With something like service_binary, how do you wire up services? For example, If main.cc depended on Redis, how would you get the host and port of the Redis dependency from main.cc?
- gravypod 5y agoYou can do some amazing things based on convention. In kube it's pretty common to use Services for service discovery. Essentially all a Service is is a smart DNS name that points to a collection of pods (netns). If you want to mirror that setup you can create a virtual bridge network setup the same docker-compose does which would let you have a container with a hostname of `database` and then `ping database` would resolve to the correct container. To match kube's conventions you could do this: https://kubernetes.io/docs/concepts/services-networking/service/#dns https://kubernetes.io/docs/concepts/services-networking/serv... Another thing you could do is generate environment variables similar to what kube does: https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables https://kubernetes.io/docs/concepts/services-networking/serv...