As many of you know, I have worked very closely with the Cloud Foundry team since the beginning. Recently, I decided to deploy a Cloud Foundry instance in my home lab based on the information available on GitHub today. I have deployed Cloud Foundry many times before while in operations at VMware, but never as an outside user. Even with my extensive knowledge of Cloud Foundry, I found the deployment to be challenging given the documentation currently published. As such, I decided to put together some additional information to assist with the process.
Documentation
Before digging into any piece of software it is important to understand what it is suppose to do and how it works. Documentation for BOSH can be found at: https://github.com/cloudfoundry/oss-docs/blob/master/bosh/documentation.md. Per the documentation:
Cloud Foundry BOSH is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services. In this manual we describe the architecture, topology, configuration, and use of BOSH, as well as the structure and conventions used in packaging and deployment.
BOSH was originally developed in the context of the Cloud Foundry Application Platform as a Service, but the framework is general purpose and can be used to deploy other distributed services on top of Infrastructure as a Service (IaaS)products such as VMware vSphere, Amazon Web Services, or OpenStack.
Of the introduction provided, one interesting thing to note is that “BOSH…is general purpose and can be used to deploy other distributed services”. While I have not seen this heavily leveraged today, one good example of this is the BOSH sample release available at: https://github.com/cloudfoundry/bosh-sample-release. With the configuration given you can deploy a LAMP solution using BOSH (instead of Cloud Foundry). It will be interesting to see if others try to use BOSH to deploy their distributed system.
The question you may be wondering at this point is why would one use BOSH to deploy a distributed system? To answer this question I believe it is important to understand what BOSH does and does not do. BOSH, which stands for BOSH Outer SHell, is an open source tool chain for release engineering, deployment and lifecycle management of large scale distributed services. It is capable of deploying and managing distributed systems in a module fashion decoupling the OS from the services running on top of it. BOSH has knowledge about the services running on top of it and how to get applications connected to available services. With knowledge of the OS and services, BOSH is able to monitor for changes and issues as well as upgrade and scale the environment as needed. BOSH must know about system configurations in order to maintain them. What I mean by this is BOSH needs to know about changes made to the system or else it will not maintain them across upgrades and scaling exercises. A good example of this would be the use of configuration management tools like chef, cfengine, and puppet. While BOSH is able to make configuration changes, if it is not aware of these changes (i.e. chef/cfenginer/puppet/user makes them) BOSH will overwrite these changes during certain operations (e.g. upgrades, scaling, etc).
Hardware Requirements
One interesting document published is about hardware requirements: https://github.com/cloudfoundry/oss-docs/blob/master/bosh/documentation/hardware_spec.md. This document makes claims about requirements for CPU, memory, disk, and network requirements. Speaking for first hand experience I can say the recommendations are exaggerated as I have run several environments at scale with much less than what is stated. The only real requirement for running Cloud Foundry on vSphere is that you have a system on the VMware compatibility matrix and that you have enough CPU and memory to deploy the Cloud Foundry size you need.
Configuring vSphere
Next you need to configure vSphere: https://github.com/cloudfoundry/oss-docs/blob/master/bosh/documentation/Install_and_prepare_vsphere.md. A couple things to note on this document:
- The document mentions vSphere 5.0. BOSH and Cloud Foundry have been tested against vSphere 4.1 through 5.1. All of my testing was done with vSphere 5.1.
- Object names (e.g. datacenter, cluster, resource pool, folders) can be anything you would like
- Resource pool(s) are optional, but highly recommended if deploying multiple BOSH instances to the same cluster
- Folders for VMs and disks are REQUIRED – BOSH does not create these for you automatically (not sure why not)
BOSH CLI
The final step before deploying BOSH is installing the BOSH CLI: https://github.com/cloudfoundry/oss-docs/blob/master/bosh/documentation/bosh_cli.md. It should be noted that BOSH has been primarily tested on Ubuntu and specifically 10.04 though Mac 10.6 and greater should work as well. Work has also been done on Ubuntu 12.04 for those interested. It should be assumed that all documentation on GitHub is written assuming Ubuntu 10.04 though I wrote my documentation using Ubuntu 12.04 to prove it works. In theory, BOSH is not dependent on OS specific functions and instead just on certain software versions. To that end, the most important thing to note here is the Ruby version installed on the system that you plan to install the BOSH CLI. While not clearly stated on the BOSH CLI page (it is listed on the RVM and Rbenv pages), the Ruby version must be >1.9. You can check this by running:
ruby --version
on your system. The BOSH CLI provides two methods to install Ruby 1.9.2 on your system being RVM and Rbenv. Both options result in a Ruby installation local to a particular user and not system wide. Depending on the system you wish to install the BOSH CLI on, if you can you may want to just upgrade the system Ruby version to 1.9.2. To do this on Ubuntu you can:
sudo apt-get -y libruby1.9.1 libyaml-0-2 ri1.9.1 ruby1.9.1 ruby1.9.1-dev sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \ --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \ /usr/share/man/man1/ruby1.9.1.1.gz \ --slave /usr/bin/ri ri /usr/bin/ri1.9.1 \ --slave /usr/bin/irb irb /usr/bin/irb1.9.1 \ --slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1
In my testing, I started by installing Ruby using Rbenv, but eventually ran into issues and just upgraded the system Ruby version. I am not sure if this was a user error or Ubuntu 12.04 so your mileage may vary. I believe most people trying BOSH and Cloud Foundry will have administrative rights to the system on which they will be installing the BOSH CLI. If this is not the case please let me know and I will get working directions for Rbenv. For those interested, RVM installation is great for those who want to maintain multiple Ruby versions and is simple to install and configure:
\curl -L https://get.rvm.io | bash -s stable --ruby source $HOME/.rvm/scripts/rvm # you should add this to your shell profile/rc file
OK, you are now ready to install BOSH! I will cover details around Micro BOSH in my next post.
© 2013, Steve Flanders. All rights reserved.