I am working to deploy a simple Lagom System of Microservices into an externally hosted cloud. Each microservice will be its own DockerImage. Each microservice is declared to the hosting service, and is given a deterministic “hostname” (app.service.project) which is resolve-able only from within the deployed cloud. These names remain the same across otherwise-distinct “environments”.
Now, when using runAll goals, a ServiceLocator and ServiceGateway are started. I have seen docs which would enable me to disable these.
My question is how I map hostnames to services such that one Lagom microservice may resolve and invoke another Lagom microservice in the same project. For example, do I need to use a specific ServiceLocator which resolves via DNS?
At this stage the services we are deploying are the well-known Hello-Impl and Stream-Impl, so feel free to answer in those terms.
My project name is “example”, I may ascribe the service name “lagom” to each microservice, so Hello would be rsolvable as hello.lagom.example, and Stream as stream.lagom.example.
We are not using Kubernetes. I’m sure I have read that documentation already, but will happily do so again if it might be relevant to the non-K8s case.
Lagom officially supports kubernates and all examples regarding production deployment are focused on that.
But of course other types of “deployments” can be configured.
You have to take in mind two things that are relevant for this topic (stated in referenced documentation):
“services need to locate the addresses of other services to communicate with them. This requires you to configure an implementation of a ServiceLocator that Lagom uses to look up the addresses of services by their names”
“ Lagom services that require an Akka Cluster (which includes any that use the Lagom Persistence or Publish-Subscribe APIs) must have a strategy for forming a cluster or joining an existing cluster on startup”
#1 is obvious and #2 is one of the lagom’s biggest competitive features
#1 is locating of other services and #2 is locating other instances of the same service to form a cluster
Both can be configured with static or dynamic locating/discovery.
Configuration depends on targeted deployment environment and what that environment supports.
With Akka’s Service Discovery you can use different discovery methods (kubernetes api, Consul, Marathon, AWS, DNS SRV).
You need to check if any of this fit your deployment environment.
Microservices always come in numbers so static option will become challenging very soon and I suggest you check what dynamic options will fit.