One of the more interesting announcements to come out of the 2014 Atlanta OpenStack Design Summit was Red Hat's statement that they were going to open source ManageIQ, a cloud management platform. You can read the press announcement here.
ManageIQ is actually a complete and mature project, having over 8 years of development. ManageIQ the company was founded in 2006 and acquired by Red Hat in December 2012. Subsequent to the acquisition, Red Hat has both integrated ManageIQ into its CloudForms product and spent significant effort to get the source code ready to be an open source project. About a month after the ODS announcement, Red Hat followed up and published the source code and created an open community to shepherd the project. Look here for the ManageIQ community site and here for the sources (hosted on GitHub).
From the README: ManageIQ is a Cloud Management Platform that delivers the insight, control, and automation enterprises need to address the challenges of managing hybrid cloud environments. It has the following feature sets:
- Insight: Discovery, Monitoring, Utilization, Performance, Reporting, Analytics, Chargeback, and Trending.
- Control: Security, Compliance, Alerting, Policy-Based Resource and Configuration Management.
- Automate: IT Process, Task and Event, Provisioning, Workload Management and Orchestration.
- Integrate: Systems Management, Tools and Processes, Event Consoles, CMDB, RBA, and Web Services.
Goals for this Tutorial
We are going to install the current ManageIQ community code on the CenturyLink Cloud. If you don't already have an account, you can sign up for free trial. When we are done you will have the complete system running on a CenturyLink Cloud server, be able to log into the management console, and be able to access the ReST API. While we go through this process, we'll overcome some "challenges" that as we deploy ManageIQ.
- The pre-built and downloadable images from the community site target the following environments: OpenStack, Red Hat Enterprise Virtualization, oVirt, and VMware vSphere. None of these environments are native to the CenturyLink Cloud so we will need to "go native" and install the system from source code.
- As might be expected, the project is focussed on Red Hat Enterprise Linux (RHEL) and CentOS and you can find install instructions for these environments. We will be installing on Ubuntu 14.04 (Trusty).
- Currently the ManageIQ project assumes certain versions of Ruby, Rails, and Bundler (so we need to ensure that the correct versions are installed on our base OS).
Sounds like fun? Let's get started...
Create the Base Server
We are going to install on an Ubuntu 14.04 server, so we first need to create the server on the CenturyLink Cloud and install the OS. Instructions for doing this are here. Note that in addition to the standard ports (when adding the public IP address) you should specify port 3000 as well. This is the Rails default port.
Reboot your server and ensure that you have a terminal open and are logged into your server as root.
While you can do initial development with the built-in SQLite database you will not want to go to production, or even serious testing, without a more industrial strength database. The standard choices are either MySQL or PostgreSQL, today we are going to install and use PostgreSQL as this is the recommended package for ManageIQ.
First, let's update our apt information and then get the packages we need:
$ sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' > /etc/apt/sources.list.d/pgdg.list" $ wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - apt-get update $ apt-get dist-upgrade $ apt-get install postgresql postgresql-contrib pgadmin3 postgresql-common libpq-dev
When PostgreSQL was installed it set up a standard default user postgres. For ease of use we are going to remove the database password from this account.
$ sudo -u postgres psql postgres=# ALTER USER postgres PASSWORD '';
What the above commands do is:
- Change the logged in user to postgres
- Run the PostgreSQL shell psql
- Change the password on the user postgres to "no password". You will note that this is done by issuing SQL commands through the database shell. Make sure you end the SQL line with a semi-colon, and enter "q" to exit psql and get back to the root user context.
In order to ensure we can connect locally to the database we need to alter the pg_hba.conf file.
Currently this is located in the /etc/postgresql/9.3/main/ directory. Find the following section and update "peer" and "md5" to "trust".
Lastly, we need to ensure that PostgreSQL is listening correctly for localhost connections. To do this we need to edit the file postgresql.conf, located in the same directory as the pg_hba.conf file. Find the line _listenaddresses and ensure it looks like: _listenaddresses = 'localhost' # what IP address(es) to listen on; (you should be able to just uncomment this line).
Restart the database:
$ /etc/init.d/postgresql restart
The PostgreSQL database should now be running and you should be able to connect and interact with it locally (just as our ManageIQ applications will). To test enter the following:
$ sudo -u postgres psql postgres=# l postgres=# du
The first command will show you all the tables currently defined. The second command shows the currently defined users on the system. Remember to enter "q" to exit.
Next we need to create the specific user and databases that ManageIQ will use.
$ cd $ su - postgres $ for i in test production development;do createdb vmdb_$i;done $ psql -c "create role evm login password 'smartvm'" $ psql -c "alter database vmdb_development owner to evm"
We just set up 3 databases, created a database user evm, and set the user evm as the owner of the development database. Exit from the postgres user back to the root user.
The last thing we need to do before diving into getting and running the ManageIQ is to install and start the memcache daemon and install git. The following will fetch memcache and start the daemon, then install git.
$ apt-get install memcached $ apt-get install git
Set up the Ruby and Rails runtime
The ManageIQ project currently has a dependency on Ruby version 1.9.3. Also, bundler must be version 1.3.5, so we will need to remove the up-level version and replace it with the expected version. First, let's create a user to host and create a runtime context for the Ruby runtime and development.
$ adduser centurylinkdev
For ease of use set the password to centurylinkdev as well. In order to give centurylinkdev the correct privileges we must add the user to the sudoers file.
# Edit the sudoers file to add the new user $ visudo
Add new user in the ‘User privilege specification’ section.
# User privilege specification root ALL=(ALL:ALL) ALL _centurylinkdev_ ALL=(ALL:ALL) ALL
Once the file has been successfully edited press CTRL-x to exit the file; and Y to save the changes. Logout as the root user and then login as centurylinkdev. We now have a normal user with sufficient privileges to install ManageIQ.
Install Ruby 1.9.3
To start with, we are going to make sure the apt repos are up to date and then install some dependencies.
$ sudo apt-get update $ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
There are a few ways to install Ruby, we are going to use rvm as it one of the most popular install systems. Of course, first we have to install rvm and then we will install Ruby.
$ curl -sSL https://get.rvm.io | bash -s stable $ source /home/centurylinkdev/.rvm/scripts/rvm $ rvm install 1.9.3 $ gem uninstall -i /home/centurylinkdev/.rvm/gems/ruby-1.9.3-p547@global bundler $ gem install bundler -v '1.3.5'
Finally, we are ready to actually install ManageIQ!
$ git clone https://github.com/ManageIQ/manageiq $ cd manageiq/vmdb $ bundle install --without qpid $ cd .. $ vmdb/bin/rake build:shared_objects $ cd vmdb $ bundle install --without qpid
And everything is installed. Edit your PostgreSQL config file (at config/database.pg.yml) and add the user evm with the password smartvm to the base definition. When you are done your config file should look like:
Lastly, we need to set up the database and start the service:
$ bin/rake db:migrate $ bin/rake evm:start
Relax for a few minutes and then point your browser at [public IP]:3000. You should see the ManageIQ welcome screen:
Log in using the username admin and the password smartvm. You will see the global ManageIQ dashboard:
Congratulations! You have the open source (community) version of ManageIQ up and running on the CenturyLink Cloud. And have it running on the latest and greatest Ubuntu Server and PostgreSQL database to boot. Future tutorials will build off this base as we explore how to manage your private OpenStack cloud with ManageIQ and also explore the ManageIQ ReST API.