Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploying the Lagom Service on ConductR

DZone's Guide to

Deploying the Lagom Service on ConductR

Learn how to create a ConductR cluster and deploy it on Lagom in order to easily manage your distributed systems.

· Database Zone
Free Resource

Whether you work in SQL Server Management Studio or Visual Studio, Redgate tools integrate with your existing infrastructure, enabling you to align DevOps for your applications with DevOps for your SQL Server databases. Discover true Database DevOps, brought to you in partnership with Redgate.

In a previous blog, we discussed how to create a Lagom service-based architecture with a beautiful word count 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. 

How to Create a ConductR Cluster and Deploy to Lagom

The below steps will help you create a ConductR cluster and deploy it to Lagom.

Prerequisites

  • Docker (when using Docker-based bundles).

  • SBT (when SBT is our interactive build tool).

  • conductr-cli, which is used to communicate with the ConductR cluster.

Adding sbt-conductr Plugin

sbt-conductr is an 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 an 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 the IP address should be mentioned in the application.conf file in helloworld-producer-impl and helloworld-consumer-impl, if running on anything other than the local host.

Loading the Services

This involves six steps.

1. Start Conductr Using Sandbox 

Enter the SBT command terminal and type the below command:

sandbox run 2.0.0 –feature visualization 

This will start a single node cluster with visualization enabled on IP http://192.168.10.1:9999.

Note: Make sure Conductr is started and your HAProxy server is started while looking into logs. Also, your Docker services will be accessible to Sandbox.

Using conduct info will give you the Conductr cluster info.

2. Put in Your Project Name

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 you can see it here.

3. Create the Bundle for the Project

Use bundle:dist to create the bundle for the project.

4. Load Your Bundle

Load your bundle with this ZIP file:

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

5. Run Your Project

Run your project with conduct run helloworld-producer-impl and check ConductR with conduct info .

Note: You will be having four services running until now.

6. Create and Load the Next Bundle

Similarly, create and load the bundle for the helloworld-consumer-impl project with project helloworld-consumer-impl.

The code is present in the previous blog, as mentioned above, or you can see it here.

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 services are deployed on ConductR so you can hit the route mentioned here.

Below is the screenshot of the visualizer showing the services running:

visualizer.png

To stop the loaded service: 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 a local Sandbox. In our next blog, we will deploy our Lagom services on DCOS enabled with conductR.

It’s easier than you think to extend DevOps practices to SQL Server with Redgate tools. Discover how to introduce true Database DevOps, brought to you in partnership with Redgate

Topics:
database ,lagom ,conductr ,rdbms ,distributed systems

Published at DZone with permission of Piyush Rana, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}