layout | title | categories | author_picture | author_github | seo-title | seo-description | blog_description |
---|---|---|---|---|---|---|---|
post |
Running Scala microservices on Open Liberty and Kubernetes |
blog |
Running Scala microservices on Open Liberty and Kubernetes - OpenLiberty.io |
An example application to calculate a Mandelbrot Set using Microprofile/Open Liberty microservices implemented in Scala. The goal is to demonstrate technical possibility of using Open Liberty with Scala and possibility of deploying such solution as Kubernetes services. |
An example application to calculate a Mandelbrot Set using Microprofile/Open Liberty microservices implemented in Scala. The goal is to demonstrate technical possibility of using Open Liberty with Scala and possibility of deploying such solution as Kubernetes services. |
This blog post shows how Open Liberty microservices can be implemented using the Scala language and deployed on to a Kubernetes cluster. The main focus of the project was to explore the technical feasibility of integration between Open Liberty and Scala.
The base Docker image for Open Liberty is already available on Docker Hub. Available documentation on openliberty.io provides information how to use this Docker image when using a Java and Maven toolset to create an application image, and the challenge was to analyze and replicate the same behaviour of creating an image but using a Scala and sbt toolset, with some additional sbt plugins as required. An existing example application created by Maven was analyzed to investigate an internal structure of an application WAR file, which was then used to correctly parametrize the sbt-docker plugin. Details on creating and testing Docker images can be found at README: Docker.
The application Docker image was deployed on a Kubernetes cluster and all required deployments and services were created. The services worked correctly, which showed no interoperability issues between Open Liberty and classes as compiled by Scala. All annotations defined on classes and methods were correctly retained in runtime and then correctly picked up and used by Open Liberty. Details can be found at README: Kubernetes.
It may be worth mentioning that the application is ready to serve requests in about 60s mark (as measured on the hosts used - AWS t2.nano), so this factor may need to be taken into account in use cases in which it is important.
This example project showed that it is practically possible to use Open Liberty-based microservices from a Scala application, and the ease-of-use and implementation is the same as with Java-based applications. The project can be found at GitHub: scala-openliberty-mandelbrot