Managing private (dev) cloud using OpenStack, Chef & Jenkins
As part of Tikal Fuse day #6 we planned to establish a management framework for a private cloud which will be used by the build management / Dev team(s).
The “building blocks” of this solution consists of:
- OpenStack for the private cloud infrastructure
- Chef for build / dev node orchestration / configuration management
- Jenkins for build orchestration of both Chef & OSTK infrastructures
- Git for Source control [Jenkins & Chef recipies]
- VMbuilder for base image creation
Hardware & Configuration
- Single node with Ostk CC & NC components [ dual quad core, 16GB RAM & 2TB storage ]
- One laptop: running Jenkins master instance & Chef server
- Developer machine(s) running chef workstation [ powered by knife ]
Prepare an image for OSTK [ based on ubuntu 12.10 ]
Setup Jenkins and the required plugins [ Jclouds in particular ]
Instantiate an instance via Jenkins via Jclouds plugin
Bootstrap the node with Chef via a Local Chef server, prior to jenkins node instantiation
We divided into three main teams focusing on expertise & qualification for each task, The Team(s):
OSTK & VMbuilder:
Each team had half a day to get his act together so we can integrate after lunch
OpenStack was installed locally - you can reference: Experimenting with OpenStack Essex on Ubuntu 12.04 LTS under VirtualBox post for more details on establishing an OpenStack instance on your local laptops, Ori will soon be release a bare metal to cloud script which will cover bare metal installation of Openstack, which is based on this post.
You can also download an ova with a script which does all this magic described in the post here.
At this stage we just validated we can create [“without freinds”] instances, snapshots, reboot view console etc etc vm related tasks.
VMbuilder A separate post is being prepared by Gil on how to go about and create an image for OpenStack with vmbuilder for windows & linux
The basics for this day were:
- Install ubutnu-vm-builder (vm-builder requires kvm/qemu):
- Once installed use the following command:
vmbuilder kvm ubuntu --suite precise --flavour virtual --arch amd64 -o --libvirt \ qemu:///system --user tikal --name tikal --pass tikal --addpkg \ openssh-server --addpkg aptitude --addpkg vim --addpkg git
ubuntu = hostname
precise = distribution code name
arch = 32/64 bit
user & pass [sudoer]: tikal/tikal
addpkg = we found the need in aptitude in order to run chef bootstrap thus we added that package to the image
What took most of the time is similar to my challenge with EC2 was to determine the credentials token needed by the plugin + configuring the user and init script in order to “get the node rolling” (which is still a work in progress).
This screenshot emphasizes the jenkins manage added to jenkis upon installation of the
The biggest trick was adding the admin: in the Identity [which may differ if you install you
own instance …]
We didn’t find this until the “Jenkins team” got the jeclouds plugin source code and
starting to debug the code (so we had a set back on this).
String identity = "demo:demo"; // tenantName:userName
See example: http://www.jclouds.org/documentation/quickstart/openstack/
The second part of the jclouds configuration will determin the image [which we uploaded from the vm-builder image]:
These parameters will define the name of the slave in jenkins and the “specify Image ID” is the unique identifier in the image, you can get it from the horizon url on your openstack cloud controller instance (or using the ec2 command line utility).
Upon completion of this part we are ready to integrate it with Chef and instantiate a build on that instance.
Chef installation was done in two stages
- install chef server based on Ubuntu 12.04 [ After finding a bug with 12.10 in ruby / ohai packages which caused us to rollback to 12.04 ] installation was based on apt-get and will be covered in full in a separate post [ link will be listed here ] - this was inspired by - Opscode-Wiki, but as I said we found some issues with 12.10 which I will talk about in separate post.
- Configured a laptop as a Chef Workstation
- Cloned the chef-repo “template repository”
git clone git://github.com/opscode/chef-repo.git
This command creates a “template” repository including the chef recommended structure of storing, roles, attributes, environments etc to be used with recipes/
- Install chef client in order to test the following recipes:
knife cookbook site install users knife cookbook site install sudo knife cookbook site install java
running the above commands will download the recipe from the corresponding GitHub repository into your chef-repo/cookbooks directory - I would recommend using this repository [what we didn’t do enough during this day …, so I will be doing it again and will update the post accordingly].
- For sake of testing the recipes, roles and databags we created we executed chef bootstrap on the host created by Gil (with VMBuilder)
This post will be continued and will define the entire flow and configuration steps taken to achive the goals I defined at the top of this article.
On behalf of the ALM team and myself,