Lagom ServiceLocator using deterministic hostnames

Hi,

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):

  1. “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”

  2. “ 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.

  1. for static you configure (in each service application.conf):
    a) other services endpoints (#1 - Using static values for services )
    b) service instance endpoints (#2 - Akka - Joining to Seed Nodes)

  2. for dynamic you can use:
    a) other services endpoints discovery (#1) Akka Discovery Service Locator that uses Akka’s Service Discovery for underlying implementation
    b) service instance locating (#2) Akka Cluster Bootstrap that also uses Akka’s Service Discovery.

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.

Hope this helps.

Br,
Alan