Monday, February 8, 2016

Bosh and Bosh Lite in Cloud Foundry

 Bosh and Bosh Lite in Cloud Foundry


 What is BOSH?  

BOSH is a project that unifies release engineering, deployment, and lifecycle management of small and large-scale cloud software. BOSH can provision and deploy software over hundreds of VMs. It also performs monitoring, failure recovery, and software updates with zero-to-minimal downtime.
While BOSH was developed to deploy Cloud Foundry PaaS, it can also be used to deploy almost any other software (Hadoop, for instance). BOSH is particularly well-suited for large distributed systems. In addition BOSH supports multiple Infrastructure as a Service (IaaS) providers like VMware vSphere, vCloud Director, Amazon Web Services EC2, and OpenStack. There is a Cloud Provider Interface (CPI) that enables users to extend BOSH to support additional IaaS providers such as Google Compute Engine and Apache CloudStack.

Why BOSH?

BOSH allows individual developers and teams to easily version, package and deploy software in a reproducible manner. 

BOSH was purposefully constructed to address the four principles of modern Release Engineering
1) Identifiability-  identify all of the source, tools, environment, and other components that make up a particular release.
2) Reproducibility - integrate source, third party components, data, and deployment externals of a software system in order to guarantee operational stability.
3) Consistency - provide a stable framework for development, deployment, audit, and accountability for software components.
4) Agility - integrates well with current best practices of software engineering.

What is a Stemcell?

A stemcell is a versioned Operating System image wrapped with IaaS specific packaging. That means the stemcell has to be selected depending on the IaaS.

A stemcell contains - 1) bare minimum OS skeleton with a few common utilities pre-installed
                                      2) BOSH Agent
                                      3) few configuration files to securely configure the OS by default

Stemcell provides a clear separation between base Operating System and later-installed software. That means Stemcell do not contain any specific information about any software that will be installed once that stemcell becomes a specialized machine in the cluster.

Stemcells for one OS are exactly the same for all infrastructures. That means the BOSH users can quickly and reliably switch between different infrastructures without worrying about the differences between OS images.

The Cloud Foundry BOSH team produces and maintains an official set of stemcells.

What is a Release?  

A release is a versioned collection of configuration properties, configuration templates, start up scripts, source code, binary artifacts, and anything else required to build and deploy software in a reproducible way.
A release is the layer placed on top of a stemcell
A release 
  • Captures all needed configuration options and scripts for deployment of the software
  • Records and keeps track of all dependencies for the software
  • can be versioned and track of software releases
  • can be IaaS agnostic
  • can be self-contained and do not require internet access for deployment
What is a Deployment?
 
A deployment is a collection of VMs, built from a stemcell, that has been populated with specific releases and disks that keep persistent data. These resources are created based on a manifest file in the IaaS and managed by the BOSH Director, a centralized management server.

When a deployment manifest is uploaded to a BOSH Director, requested resources are allocated and stored. Over time, as the deployment manifest changes, VMs are replaced and updated. 

What is BOSH- Lite?

BOSH Lite is a pre-built Vagrant box which includes the Director. It uses Warden containers to emulate VMs which makes it an excellent choice for:

  • General BOSH exploration without investing time and resources to configure an IaaS
  • Development of releases (including BOSH itself)
  • Testing releases locally or in CI  
Bosh-lite is a vagrant VM that comes with pre-installed BOSH server (Director). Once VM with Director is running we are going to use BOSH CLI to send commands to the Director.
 
How to use BOSH- Lite?

Follow the steps in this tutorial 
1) Run virtual machine with bosh- lite 
2) Get the BOSH CLI
3) Make the CLI target at BOSH Lite Director
4) Deploy an application
  1. Clone or create a release
  2. Name the release
  3. Upload the release to the BOSH Lite Director
  4. Set the deployment manifest.yml file (manifest file include what services to deploy, properties and resource configuration- ex: set director_uuid)
  5. Clone or get a stemcell (stemcell is an OS image used by BOSH to create VMs)
  6. upload the stemcell to the director
  7. deploy the release
 BOSH Components

1) BOSH init- Tool used to create and update the director
2) CLI- Interact with the director and perform actions on the cloud
3) Director- controls VM creation and deployment                    
               adds tasks (sent by an operator through the CLI) to Task Queue (manage
                                tasks used by director and workers; workers take tasks and act on them) 

4) Cloud Provider Interface (CPI) - Director used to interact with IaaS to create and manage
                                                                                stemcells, VMs and disks

5) Health Monitor- monitor the health of VMs --> if there is a problem with a VM -->
6) ressurrector recreate VMs.

7) DNS Server-Convert unique IP addresses in textual form. ex: en.wikipedia.org/wiki/
                                                    domain-name-system --> 207.142.131.248

8) Database- store information about the desired state of a deployment - stemcells, releases
                                        and deployments

9) Blobstore- operator uploads a release using CLI --> Director insert the release to the
                                        blobstore--> when deploying the release --> compile the packages
                                        and store the result in blobstore

10) Agent - BOSH include an agent on every VM 
               carries out the instructions given by Director
11) Message bus (NATS) - provide instructions to VMs
                                                inform Health Monitor the status of the VM
12) Registry- stores configuration information (used during bootsrapping stage of the VM) for
                                     the VM


References
http://bosh.io/docs/ 
http://mariash.github.io/learn-bosh/#prepare

2 comments:

  1. Good job on keeping it simple and explaining the important stuff!

    ReplyDelete
  2. I enjoyed reading the article. thank you.

    ReplyDelete