Over a million developers have joined DZone.

Deploying Microservices Style Applications with CoreOs, Docker and Nirmata

DZone's Guide to

Deploying Microservices Style Applications with CoreOs, Docker and Nirmata

· Cloud Zone ·
Free Resource

Discover a centralized approach to monitor your virtual infrastructure, on-premise IT environment, and cloud infrastructure – all on a single platform.

[This article was written by Ritesh Patel.]

As application container adoption continues to grow, the popularity of ‘minimal’ operating systems, designed to run containers, is on the rise.  One such operating system is CoreOS. CoreOs has been architected to run modern, cloud native applications and provide support for Docker containers.

In this post, I will describe how Nirmata can be used to deploy and operate microservices applications on CoreOS. The high level steps are simple:

  1. Create a Host Group
  2. Setup a CoreOS VM
  3. Deploy an application

I will describe each step in detail below.

Create a Host Group

In Nirmata, a Host Group is a pool of identical resources. You can define one or more, Host Groups for each Cloud Provider, and then map Host Groups to application and service level policies.

Nirmata supports several public and private cloud providers. For this setup, I will use the ‘Other’ provider type and directly connect individual CoreOS instances to my Host Group.

The first step is to create a new host group in Nirmata for my CoreOS VMs. This can be done by going to Host Groups->Other and clicking on the Add Host Group button. In the wizard, I can specify the name for my host group and there resource selection policy.

Create host group

In the resource selection policy, I select ‘Sandbox’ as the environment type and ‘availableMemory’ as the placement type. This policy ensures that whenever an application in deployed in the ‘Sandbox’ environment, the CoreOS cluster is used and the containers are placed based on the memory available on the VMs within the cluster.

Create host group policy

Once this host group is created, I can now add my CoreOS VMs to the cluster. The CLI command to setup VMs to connect to Nirmata and to be added to this host group is also displayed.

Host group created

Setup a CoreOS VM

To set up my CoreOS VMs for use with Nirmata, I can ssh to the VM and run the command to setup my VMs to connect to Nirmata and be added to my host group. The command also displayed on the host group page:

sudo curl -sSL http://www.nirmata.io/nirmata-host-agent/setup-nirmata-agent.sh | sudo sh -s other <host-group-id>

This command will download the host agent container image and run it as a systemd service.

Install Nirmata agentYou can verify that the host agent is running using the docker ps command:

Verify host agent 

Once the host agent is running, it will connect to Nirmata and the host will be added to the host group


You can repeat this steps to add multiple CoreOS VMs to your host group. I added one more VM to my host group so my CoreOS cluster has 2 VMs.


Deploy your application

Now, I am ready to deploy my application. I have imported a small demo application with 6 services in Nirmata.

Application blueprint

To create an environment to deploy this application, go to Environments and click on Add Environment. In the wizard, select the environment type as ‘Sandbox’ and the application as ‘shopme-demo’.

Create environment

Click Finish to start deploying the environment. You should see the containers (services) getting deployed.

Deploy environment

In a few minutes, all the services are deployed and are running.

Running environment 

I can verify this by going to the host group view and viewing the hosts. I can see that each host has 3 containers deployed.

Verify host group

I can also verify that my containers are deployed by checking my VMs.

Verify on CLI

Verify on CLI

Once my application is deployed, I can actively monitor it and manage it from Nirmata. I can easily add additional hosts to my host group as well as scale up or scale down my containers.

As you can see, within a few minutes you can create a cluster of VMs and deploy a distributed application with Nirmata. Once deployed, the application can also be easily monitored and managed. Give it a try and let us know what you think!

To deploy your CoreOs cluster on different cloud providers, you can refer to our documentation.

Learn how to auto-discover your containers and monitor their performance, capture Docker host and container metrics to allocate host resources, and provision containers.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}