Over a million developers have joined DZone.

End-to-End Automation for Docker-based Applications on Rackspace using DCHQ

DZone's Guide to

End-to-End Automation for Docker-based Applications on Rackspace using DCHQ

Free Resource

The reliability and geographical distribution of Rackspace has driven many startups & enterprises to host their applications on Cloud Servers distributed across different regions. However as development teams start to grow or as enterprises embark on new development projects, replicating consistent DEV/TEST environments for the quickly growing teams becomes a struggle on any cloud infrastructure.

DCHQ simplifies the containerization of enterprise applications and makes it possible to replicate very complex application environments on multiple hosts through a one-click deploy button. DCHQ does not just automate the application deployments, but it also integrates with Rackspace to automate the provisioning and auto-scaling of Weave-enabled clusters consisting of distributed Cloud Servers.

In this blog, we will go over the automated infrastructure provisioning on Rackspace as well as the automated deployment and lifecycle management of a multi-tier application.

First, a user can register a Cloud Provider for Rackspace by navigating to Manage > Repo & Cloud Provider and then clicking on the + button to select Rackspace. The Rackspace API Key needs to be provided – which can be retrieved from the Account Settings section of the Rackspace Cloud Control Panel.

Image title

A user can then create a Weave-enabled cluster with an auto-scale policy to automatically spin up new Cloud Servers. This can be done by navigating to Manage > Data Center & Cluster page and then clicking on the + button. You can select a capacity-based placement policy and then Weave as the networking layer in order to facilitate cross-container communication across multiple hosts within a cluster. The Auto-Scale Policy in this example sets the maximum number of VM’s (or Cloud Servers) to 10.

Image title

A user can now provision a number of Cloud Servers on the newly created cluster by navigating to Manage > Bare-Metal Server & VM and then clicking on the + button to select Rackspace. Once the Cloud Provider is selected, a user can select the region, size and image needed. Ports can be opened on the new Cloud Servers (e.g. 32000-59000 for Docker, 6783 for Weave, and 5672 for RabbitMQ). A Data Center (or Cluster) is then selected and the number of Cloud Servers can be specified.

Image title

Once the Cloud Servers are provisioned, a user can deploy a multi-tier, Docker-based application on the new Cloud Servers. This can be done by navigating to the Self-Service Library and then clicking on Customize to request a multi-tier application. In this example, we have a multi-tier application consisting of Nginx (for load balancing), Tomcat (the clustered application server) and MySQL (as the database). You will notice Nginx is invoking a BASH script plug-in to add the container IP’s of the application servers in the default.conf file dynamically (or at request time). Tomcat is also invoking a BASH script plug-in to deploy a Java WAR file from a specified URL. You will notice that the cluster_size parameter allows you to specify the number of containers to launch (with the same application dependencies). The host parameter allows you to specify the host you would like to use for container deployments. Here are the values supported for the host parameter:

  • host1, host2, host3, etc. – selects a host randomly within a data-center (or cluster) for container deployments
  • <IP Address 1, IP Address 2, etc.> -- allows a user to specify the actual IP addresses to use for container deployments
  • <Hostname 1, Hostname 2, etc.> -- allows a user to specify the actual hostnames to use for container deployments
  • Wildcards (e.g. “db-*”, or “app-srv-*”) – to specify the wildcards to use within a hostname

A user can select an Environment Tag (like DEV or QE) and the Data Center created for Rackspace before clicking on Run.

Image title

Image title

Once the application is up and running, a user can monitor the CPU, Memory, & I/O Utilization of the running containers and perform day-2 operations like Backup, Container Updates using BASH plug-ins, Scale In/Out and Continuous Delivery.

In the recorded demo, we scaled out the application server cluster from 2 to 3.
Image title

Image title

Sign Up FREE on DCHQ.io Hosted PaaS (http://dchq.io) to Get Started

docker ,rackspace ,rackspace cloud ,paas ,java ,application lifecycle management ,iaas ,application development ,linux containers ,containerized applications

Published at DZone with permission of Amjad Afanah, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


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.


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

{{ parent.tldr }}

{{ parent.urlSource.name }}