Deploying The Lagom Service On ConductR


In the previous blog, we have discussed how to create a Lagom service based architecture with a beautiful word count example. One can refer to the below link-

https://blog.knoldus.com/2017/03/27/lagom-framework-the-legacy-wordcount-example/

In this blog we will discuss now how we can deploy the Lagom service on conductR.

What is ConductR?

As described by lightbend –
“” ConductR is a “batteries included” approach to managing distributed systems. No more cobbling together of service gateways, service locators, consolidated logging, monitoring and so forth. All of these essential items and more are included with ConductR. In fact we want ConductR to be to operations what Play and Lagom are to developers; we want operations to be productive so that they can concentrate on keeping their business customers happy. “”

For more information on conductR refer :- http://conductr.lightbend.com/

The Below Mentioned Steps Will Create A ConductR Cluster And Will Deploy The Lagom Service .

Prerequisites

Docker (when using Docker based bundles) – Download the docker from <Here>

sbt  where( sbt is our interactive build tool. )

conductr-cli Download from <Here>

The conductr-cli is used to communicate with the ConductR cluster.

Adding sbt-conductr plugin

sbt-conductr is a sbt plugin that provides commands in sbt to produce a ConductR bundle , start and stop a local ConductR cluster and manage a ConductR cluster within a sbt session

– To use sbt-conductr for your project add the plugin to your project/plugins.sbt:

addSbtPlugin(“com.lightbend.conductr” % “sbt-conductr” % “2.3.0”)

– If your project is using Lagom 1.2.x or a previous version use:

addSbtPlugin(“com.lightbend.conductr” % “sbt-conductr” % “2.2.6”)

Your External Cassandra and kafka should be running and IP-Address should be mentioned in the application.conf file in helloworld-producer-impl and helloworld-consumer-impl , if running on other than local host .

Steps to load the services : –

Step 1) Start Conductr using sandbox : –

Enter into sbt command terminal and type the below command : –

sandbox run 2.0.0 –feature visualization

This will start single node cluster with visualization enabled on ip : http://192.168.10.1:9999

*Note : Make sure your conductr is started and your HAProxy server is started while looking into logs . Also your docker services is accessible to sandbox .

conduct info

Using this command will gives you the conductr cluster info .

Step 2) on the same sbt terminal type your project name

project helloworld-producer-impl

( The code is present in the previous blog as mentioned above or one can directly refer the link – https://github.com/piyushknoldus/lagom-scala-wordcount.g8)

Step 3) Create the bundle for the project :

bundle:dist

Step 4) Load your bundle .

conduct load /home/knoldus/workstation/lagom-spike/helloworld-producer-impl/target/bundle/helloworld-producer-impl-v1-6bca60f6f06e3c47ae7a95f53ca8b462f0c9c401374b62f4c0eba8021d72e2cb.zip

Step 5) Run your project

conduct run helloworld-producer-impl

check your conductr : –

conduct info

Note* : You will be having 4 services running till now .

Step 6) Similarly create and load the bundle for helloworld-consumer-impl project

project helloworld-consumer-impl

( The code is present in the previous blog as mentioned above or one can directly refer the link – https://github.com/piyushknoldus/lagom-scala-wordcount.g8)

bundle:dist

conduct load /home/knoldus/workstation/lagom-spike/helloworld-consumer-impl/target/bundle/helloworld-consumer-impl-v1-13e9b0dc3f5430f74f8eec0a1daac23ea97fb935f1ea39aa35605214e4e585e2.zip

conduct run helloworld-consumer-impl

Now Both your lagom Service are deployed on conduct-r , now you can hit the route as mentioned on below link : –

https://github.com/knoldus/lagom-spike/wiki/Json-Formats-for-different-Rest-services

Below is the screen-shot of visualizer showing the services running : –

visualizer.png

To Stop the Loaded Service

conduct stop helloworld-producer-impl

conduct stop helloworld-producer-impl

To Stop the sandbox completely

sandbox stop

In this article we have seen how to deploy the lagom service on conductR on local sandbox. In our next upcoming blog we will deploy our lagom services on DCOS enabled with conductR.


KNOLDUS-advt-sticker

This entry was posted in Scala. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s