Application Deployment on OpenStack via OneOps
- DevOps orchestration: integrate popular open-source or free DevOps tools and orchestrate them on a nice web UI.
- Model-driven application template: once a template is created, re-use and deploy the “best practice” unlimited times.
- Cloud Agnostic: support deployment on major public and private clouds
- Operation excellence: “auto-pilot” the application - scales, repairs and even replaces unhealthy instances. Also fully integrate with the monitoring and alerting functions on the web UI.
- Promote DevOps culture: bring developers, QA and Operations together, leading to an acceleration of the product delivery and a reduction on operation cost.
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 application on major public cloud providers, private clouds such as OpenStack, or even bare metal (OpenStack Ironic). In this article, we will see how to deploy a simple database application (MySQL) on OpenStack via OneOps.
Since this article will serve as the POC (“proof-of-concept”) or demonstration purposes, I will use 100% “free-of-charge”, public available and compatible solutions.
- TryStack as OpenStack provider, because it is the easiest and free way to try out OpenStack.
- OneOps (All-in-one vagrant), the only requirement is to download VirtualBox and Vagrant.
There are already many articles about setting up OpenStack on Trystack.org and I found this one is the very neat and concise.
Only 2 items may worth to notice:
- do fill in DNS (188.8.131.52) for private network, otherwise OpenStack VM could not resolve all domain names.
- Allocate a Floating IP (but do not need to associate with a compute instance at this point)
Here provides steps of installing OneOps, same as following,
git clone https://github.com/oneops/setup
vagrant up 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 the application deployment, we will know what happened.
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 required services in the new cloud.
Compute service provides the fundamental block for computation, such as CPU, memory, local storage, networking…. As we plan to use OpenStack (provided by trystack.org) to be our computing backbone, choose “nova (public/oneops)” under “compute” category. See example picture as below.
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://184.108.40.206:5000/v2.0/tokens”
Tenant/Username: these values are your Trystack.org username. E.g. facebook10156829676395043
Password: This can be got from your Trystack.org account settings. “Settings” -> “API Password” -> “Request API password”. After the password is shown, 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, we only need to specify the following two items:
- Region: “nova”
- Public Network Type: Choose “Floating”
The “Placement” section may resemble:
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 only support Ubuntu 14.04 and CentOS 7.0.
- Initial Username: “centos”. If using Ubuntu 14.04, this value should be “ubuntu”.
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 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 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”.
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 (e.g. oneops-demo.ml), 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.
Save the above new name servers. For example,
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 Rackspace account, if we do not have one.
After logging into Rackspace account, Choose “Networking” -> “Cloud DNS” -> “Create Domain”. The Domain Name will be the one that just has been created (e.g. oneops-demo.ml). Two name server will be automatically added: (1) dns1.stabletransit.com (2) dns2.stabletransit.com, after the domain is created in Rackspace.
Please see the following for an example:
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.
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.
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, we could add a default Mirror service without any 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:
- compute: “require public IP” should be enabled
- database: type in your preferred MySQL login password
- user: click the “+” button and add a new user instance: (1) the login name of your local workstation as “Username”, (2) copy & paste the SSH public key (e.g. .ssh/id_dsa.pub) of your local login name to “Authorized Keys”. Therefore you could directly SSH into the OpenStack VM from your local machine, after the deployment completes.
Commit the design and create a “single” environment, then deploy. The deployment plan may resemble as following,
After the deployment, open a local terminal and 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)
Now we have deployed a MySQL instance on OpenStack via OneOps.
MySQL deployment could be done with more production-driven practices, e.g. clustering, high availability, monitoring. Meanwhile I hope to introduce other interesting application templates to help audiences recognize the huge values of OneOps . Please stay tuned!