Application Deployment on OpenStack via OneOps

Screen Shot 2016-05-23 at 3.05.51 PM

(Disclaimer: the blogs posted here currently neither represent Walmart’s official perspectives regarding to the technologies, nor meant to provide any support or warranty of the code, tutorial, documentation and etc.)

As introduced in my previous post, OneOps is a multi-cloud and open-source orchestration platform for DevOps that has the following merits:

  • DevOps orchestration: integrate major open-source or free DevOps tools and orchestrate them on one single UI.
  • Model-driven, “best-practice” based application template: Create once, deploy unlimited times.
  • Support deployment on major public and private clouds
  • Operation excellence: auto-scale the application by dynamically provisioning the machines by workload; auto-repair unhealthy machine and slow applications; auto-replace bad machines and dead applications.
  • Promote the DevOps culture: the dependencies among developers, QA and operations (SRE) are weakened, leading to an acceleration of the product delivery and a reduction on engineering costs.

OpenStack is an open-source software cloud computing platform, which is primarily used for deploying an infrastructure as a service (IaaS) solution like Amazon Web Service (AWS) and has became the de-facto standard to build the private clouds in the industry.

OneOps could deploy and manage applications on major public cloud providers (AWS, Rackspace, Azure), private clouds such as OpenStack, or even bare metal (OpenStack Ironic). In this article, we will see how to deploy a simple application (MySQL) on OpenStack via OneOps.

As this article will just serve as the POC (“proof-of-concept”) or demonstration purposes, I will 100% use “free-of-charge”, public available and compatible solutions.

  • TryStack as the OpenStack provider, because it is the easiest and free way to try out OpenStack. (as it is free, there is no SLA or uptime guarantee)
  • OneOps (All-in-one vagrant), the only requirement is to download VirtualBox and Vagrant.

Trystack.org

There are already many articles about setting up OpenStack on Trystack.org and I found this one is neat and easy to follow.

Only 3 items may worth to notice:

  • It is not required to set up SSH key pair for this demo
  • do fill in DNS (8.8.8.8) for private network, otherwise OpenStack VM could not resolve public domain names.
  • Allocate a Floating IP

Install OneOps at Local Workstation

Here provides some brief intro, but in case you still feel a little confusing, I simply put the steps as below,

git clone https://github.com/oneops/setup
cd setup/vagrant
vagrant up

In my case, vagrant up took about an hour, which will create a minimum installation of OneOps on a local virtual machine. Next we may want to SSH into the virtual machine and tail the OneOps deployment log in terminal. The purpose of doing that is: in case there are some error during deployment, we will know what happened.

vagrant ssh
sudo -s
cd /opt/oneops/inductor
inductor tail

Configure OneOps to work with OpenStack

Open your local web browser and go to http://localhost:9090, sign up a new user and create an “organization”.

Then create a new cloud.

Make sure to choose “vagrant” from the “location” drop-down list. After that we will start to add some services into the new cloud.

Compute Service

Compute service provides the fundamental block for computation, such as CPU, memory, root storage, networking…. As we plan to use OpenStack (provided by trystack.org) to be our computing backbone, choose “nova” under “compute” category, then configure several parameters as following:

API Endpoint: This value should come from Trystack.org. Login Trystack.org, go to “Compute” -> “Access & Security” -> “API Access”, find the value of “Identity”, copy & paste then append it with “/tokens”. So the API Endpoint will look like “http://8.43.86.2:5000/v2.0/tokens

 

 

Tenant/Username: these values are your Trystack.org username. E.g. facebook10156829676395043

Password: This can be retrieved from your Trystack.org account settings. “Settings” -> “API Password” -> “Request API password”. After password shows up, you may be automatically logged out and have to login again.

The overall “authentication” section will look like:

Next we will move on to the “Placement” section:

  • Region: input “nova”
  • Public Network Type: Choose “Floating”

 

In the “Mappings” section, look for “Image Map”. In this demo we will use “centos-7.0” and fill in the Image ID for “centos-7.0”. The Image ID could be found on the Trystack.org after your login: “Compute” -> “Images”. Find “CentOS7” then click.

Copy the value of ID from Trystack.org and paste into the OneOps:

In “Operating System” section,

  • OS Type: choose “CentOS 7.0”. Note at the time of writing this article, OneOps may currently only support Ubuntu 14.04 and CentOS 7.0.
  • Initial Username: “centos”. If using Ubuntu 14.04, this value will be “ubuntu”. (I made a patch to expose “Initial UserName” as a parameter so that OneOps could be generally available with OpenStack)

Overall, it will resemble as follows:

Till now we are done with the compute service. Save the configuration and let’s add DNS and GDNS service.

DNS Service

DNS Service is very useful for most applications deployed via OneOps because (1) a FQDN will be created based on the DNS service, which will uniquely identify one application among all applications managed by OneOps, (2) FQDN could effectively serve as a consistent “entry point” (DNS load balancing) to the application, no matter how many application instances are added, removed or replaced behind the FQDN. Users just need to connect to FQDN and the requests will be routed to the working instances.  A good example of FQDN is “www.google.com”. I will talk about FQDN in more details when we actually use it in the next few blogs.

To add DNS service to OneOps, we need to first find (1) a domain name, and (2) a DNS provider.

Domain Name: There are many website providing free domain name. You could choose what you prefer, but here I will choose http://www.freenom.com and the following steps are based on it:

After creating a new domain, click “Manage Domain” -> “Management Tools” -> “Nameservers” -> “Use custom nameservers (enter below)”. Enter two name servers for this domain. Here we will use Rackspace Name Servers as follows and I will explain why.

  • DNS1.STABLETRANSIT.COM
  • DNS2.STABLETRANSIT.COM

Save the new name servers.

Now we have registered a new free domain name and set up name servers for it. Next we will find a DNS provider.

DNS Provider: Rackspace provides free DNS for each account (https://www.rackspace.com/en-us/cloud/dns), so we just need to register a “free-trial” Rackspace account.

After logging into Rackspace account, Choose “Networking” -> “Cloud DNS” -> “Create Domain”. The Domain Name will be the one that just has been created. Two Name Server (NS) will be automatically added: (1) dns1.stabletransit.com (2) dns2.stabletransit.com, after domain is created.

Now Let’s move back to OneOps: create a DNS service powered by “rackspace-dns”, then specify the following parameters:

  • Username: this is the username of Rackspace login
  • API Key: this is from “Account Settings” page of Rackspace
  • Zone: for now, this could be any string (e.g. oneops-demo.ml). For production use cases, it will be carefully configured.
  • Cloud DNS ID: fill in some string, but this is not important for now.

GDNS Service

Add the GDNS service (again “rackspace-dns”) with same above configurations. Please note that GDNS may be config differently than DNS when using in production.

Mirror Service

Some open-source applications on OneOps need to download the binary from some public mirror (e.g. https://www.apache.org/dist/). Mirror service is to organize various “download” links into one central place. Now add a default Mirror service without customization.

Deploy Application on OpenStack via OneOps

Here we choose MySQL as the application to deploy. After creating a MySQL design, there are several configuration updates need to be made in the “Design” phase:

  1. “compute” component: “require public IP” should be enabled
  2. “database” component: type in your preferred MySQL login password
  3. “user” component: click the “+” button and add a new user instance: (1) the login name of your local workstation, (2) copy & paste the SSH public key (e.g. .ssh/id_dsa.pub) for your local login name. Therefore you could directly SSH into the OpenStack VM from your local machine.

Commit the design and create a environment with “single” Availability Mode, then deploy.

After the deployment, open a local terminal, SSH to the OpenStack VM ssh your_local_login@float_ip. Login the mysql client mysql -u myuser, then start to type some MySQL commands (e.g. show databases;).

[root@mysql-87316–1–90827 test-user]# mysql -u myuser
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.49 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show databases;
+ — — — — — — — — — — +
| Database |
+ — — — — — — — — — — +
| information_schema |
| test |
+ — — — — — — — — — — +
2 rows in set (0.01 sec)
mysql>

Now we have deployed a single MySQL on OpenStack via OneOps.

What Next?

I plan to follow up with MySQL deployment with more production-driven practices, e.g. clustering, high availability, monitoring. Meanwhile I would like to introduce other applications on OneOps to help audiences recognize the values of OneOps . Please stay tuned!

Advertisements

7 thoughts on “Application Deployment on OpenStack via OneOps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s