Over a million developers have joined DZone.

Automated Deploys with Docker Hub and Nirmata

· Cloud Zone

Download the Essential Cloud Buyer’s Guide to learn important factors to consider before selecting a provider as well as buying criteria to help you make the best decision for your infrastructure needs, brought to you in partnership with Internap.

As companies strive to attain achieve software development agility, they are looking to automate each phase of their software development pipeline. The ultimate goal is to fully automate the deployment of code to production, triggered when a developer checks in a fix or a feature. Companies such as Netflix have built extensive tooling to enable their developers to achieve this level of sophisticated automation [1]. In this post, I will describe how deployments of containerized applications can be completely automated with GitHub, Docker Hub and Nirmata.

Docker Hub has built-in integration with GitHub and Bitbucket to automatically build a Docker image when change is committed to a GitHub repository that has automated builds enabled [2]. The only requirement is that a Dockerfile be placed in that repository. This is very convenient!

dockerhubintegration-ppt

Now that Docker image builds are automated, the next step is to automate the deployment of these builds. This can be done using Docker Hub webhooks [3] and Nirmata. Nirmata is a SaaS for deployment and operation of application containers. To trigger automated deployments of your application follow these steps.

  1. Log in to Nirmata and create a blueprint for your application.
  2. Add your cloud resources (VMs) to Nirmata. These resources will be used to deploy your application containers.
  3. Deploy your application to an environment. Environment is the runtime instantiation of your application and contains your running application containers
  4. Now, go to Docker Hub and add webhooks for your image repositories that should trigger automated deploys. The URL is displayed below:
https://www.nirmata.io/imageregistry/api/dockerhub/notify/<tenant-id>

You can find the tenant-id on the Settings->Account page in Nirmata web interface.

Thats it! You have now setup an automated deployment pipeline. Whenever a change is committed to your GitHub repository, a Docker image will be automatically build and deployed to your running environment in Nirmata. Complete operation may take a few minutes depending on how long it takes to build the container image as well as your Update Policy settings [4] in Nirmata.

edit-update-policy

Nirmata provides an option to automatically deploy new Docker images, or simply create a notification when a new image is available so that it can be manually deployed. In case your application contains multiple containers running the same image, then a rolling upgrade is performed based on preconfigured policy settings so that downtime is minimized.

auto-image-update

While this level of automation is great, there are several other capabilities needed to achieve the level of automation companies such as Netflix have built. At Nirmata, our mission is to bring these capabilities to our customers to help them achieve the software DevOps agility they need to be successful.  Stay tuned for more exciting features we will be announcing!

-Ritesh
VP Products, Nirmata

Follow us: @NirmataCloud

[1] From Code to Monkeys: Continuous Delivery at Netflix – http://www.infoq.com/presentations/netflix-continuous-delivery
[2] Automated Builds on Docker Hub – https://docs.docker.com/docker-hub/builds/
[3] Docker Hub Webhooks – https://docs.docker.com/docker-hub/builds/#webhooks
[4] Nirmata Update Policy – http://help.nirmata.com/en/latest/Environments.html#edit-update-policy

The Cloud Zone is brought to you in partnership with Internap. Read Bare-Metal Cloud 101 to learn about bare-metal cloud and how it has emerged as a way to complement virtualized services.

Topics:
cloud ,continuous integration ,automation ,deployment ,continuous delivery ,docker

Published at DZone with permission of Jim Bugwadia, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

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

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

{{ parent.tldr }}

{{ parent.urlSource.name }}