Moving from Cloud Development to Deploy on Premises

Erik Arneson

November 15, 2016

Share +

Virtual servers are a huge boon to software development. Having rapidly deployed and recycled server instances can not only speed up development, but reduce the workload and bottleneck of DevOps procedures. With a pre-made development server blueprint, developers can quickly launch configured sandboxes and development machines complete with libraries, development environments, and database servers.

However, private and enterprise deployment may have requirements that virtual servers just don't meet. For instance, private deployment might have strict network security rules or bandwidth and connectivity requirements that can't be met by cloud-hosted virtual servers. In this case, it is necessary to have methods to not only quickly launch and configure cloud-hosted virtual servers for developers, but also for robust long-lasting instances for enterprise production.

In this tutorial, you will learn how to build a hybrid cloud software deployment solution, beginning with a rapid deployment development system using virtual cloud servers. We will then explore options available for deploying systems in staging and production environments on a private data center.

Tools Used

CenturyLink Cloud Compute servers are high-performance cloud servers. These enterprise-grade virtual machines are easy to deploy and manage from the CenturyLink Cloud Control Portal and via our powerful API.

Ansible is a tool for configuring and managing clouds and servers. It handles software deployment, cloud resource provisioning, task execution, and configuration management.

Before We Start

If you don’t have a CenturyLink Cloud account yet, head over to our website and sign up for a free trial. You’ll need it to access CenturyLink Cloud Compute servers. And, because automatically deploying and configuring virtual servers can be a complicated topic, you might want to check out our comprehensive collection of Knowledge Base articles on virtual servers.

Install Ansible on your machine. Most Linux distributions have available Ansible packages. For example, on Ubuntu or Debian you would use the following command:

sudo apt-get install ansible

For other distributions and operating systems, follow the installation instructions from the Ansible documentation.

Install CenturyLink Cloud SDK Python Modules

To use the Ansible module for provisioning and controlling CenturyLink Cloud products, you will need to install the Python SDK. Run the following command.

sudo pip install clc-sdk

Quickly Deploying Development Environments

Development environments differ from project to project. Sometimes they consist of just one server with relevant services, an IDE, and development tools installed. However, more complex projects that need to mirror production environments accurately can get very large. Some might need eight or more individual servers to provide a complete environment.

Deploying a development environment for each developer can be time consuming and expensive. Virtual servers have a lower overhead, both in terms of cost and manpower, and thus make a lot of sense for this sort of development environment. Automatically deployed and configured virtual servers make even more sense. In this tutorial, we will use Ansible to automate deployment of virtual private servers.

Creating Virtual Server Templates

Before setting up Ansible to provision and deploy a development environment, you will need to spend some time setting up and configuring one or more virtual servers as a template development environment. This process varies widely depending on your environment and requirements. Explore our other tutorials for information on deploying popular IDEs and database servers on CenturyLink Cloud Compute. For instance, check out our tutorial on deploying Eclipse Che in the cloud.

Once you have a fully configured development environment to convert to templates, follow the instructions below for each virtual server in the environment:

Deploying From the Cloud to On-Premises

You can also use Ansible to move developed applications from the cloud to on-premises private servers. There are many different approaches, but all of them should include staging environment to test deployment procedures. This is where automatic provisioning techniques are useful. If there is an existing deployment plan that mimics the production environment, this can be automated to provision a staging environment.

Staging environments allow a team to practice deploying new versions of software as well as configuration changes, database schema and data updates, and package updates. A staging environment should match the production environment as closely as possible. This enables you to catch any obstacles or speed bumps and correct them before they cause an IT disaster.

There are three main areas to plan for when deploying to your staging and production environments: package management, server provisioning, and database changes.

Distributing and Packaging Software

Every operating system and programming language has at least one packaging system. For example, Linux has deb, RPM, and several others. PHP uses composer; Node.js uses npm; and Ruby uses gem. Each of these provides an interface that downloads and installs packages from a remote package repository. Using a private package repository gives you the benefit of full dependency management and fail safes during installation. Take advantage of these valuable features.

Software can also be distributed via version control systems. For example, Git's branches and tags can mark software as ready for deployment. Note that while this can be a convenient way to distribute changes, it has its risks. As the size of your DevOps or development team grows, the chances of somebody accidentally doing the wrong thing to a source code repository grows exponentially. Hopefully, you will catch these inevitable problems in your staging environment, but they will slow you down. Once your team is large enough, move to a private package repository and save yourself the pain.

Ansible provides many options for provisioning private virtual servers in private data centers as well as in the cloud. It controls virtual machines using hundreds of different modules. Here are a few to get you started:

Deploying Database Changes On-Premises

Once again, Ansible comes to the rescue. Check-out its extensive list of database modules to find out about available capabilities.

Database change management is tricky, and there isn't a consensus on the best way to handle substantial differences during deployment. Tools like DBdeploy and PHPmig reduce the pain of database change management. They make a good starting point for a solution that works in your production environment.

Next Steps

This guide is just the beginning of developing a robust hybrid IT solution for software development and deployment. After you get new developers started in the cloud while deploying changes safely to production, it's time to explore other automation solutions offered by Ansible.

Be sure to look into the possibilities offered by Runner, the CenturyLink Cloud Ansible-as-a-Service offering. It provides powerful tools for IT automation and infrastructure management. Since it's offered as a cloud service, it's available anywhere.

Sign-up for our Developer-focused newsletter CODE. Designed hands-on by developers, for developers. Keep up to date on topics of interest: tutorials, tips and tricks, and community building events.