Using Bosh to Bootstrap Cloud Foundry via Stark & Wayne Consulting

I finally sat down and really started to take a stab at Cloud Foundry Bosh. Here’s the quick lowdown on installing the necessary bits and getting an initial environment built. Big thanks out to Dr Nic @drnic, Luke Bakken & Brain McClain @brianmmcclain for initial pointers to where the good content is. With their guidance and help I’ve put together this how-to. Enjoy…  boshing.

Prerequisites

Step: Get an instance/machine up and running.

To make sure I had a totally clean starting point I started out with an AWS EC2 Instance to work from. I chose a micro instance loaded with Ubuntu. You can use your local workstation if you want to or whatever, it really doesn’t matter. The one catch, of course is you’ll have to have a supported *nix based operating system.

Step: Get things updated for Ubuntu.

sudo apt-get update

Step: Get cURL to make life easy.

sudo apt-get install curl

Step: Get Ruby, in a proper way.

\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm autolibs enable
rvm requirements

Enabling autolibs sets up so that rvm will install all the requirements with the ‘rvm requirements’ command. It used to just show you what you needed, then you’d have to go through and install them. This requirements phase includes some specifics, such as git, gcc, sqlite, and other tools needed to build, execute and work with Ruby via rvm. Really helpful things overall, which will come in handy later when using this instance for whatever purposes.

Finish up the Ruby install and set it as our default ruby to use.

rvm install 1.9.3
rvm use 1.9.3 --default
rvm rubygems current

Step: Get bosh-bootstrap.

bosh-bootstrap is the easiest way to get started with a sample bosh deployment. For more information check out Dr Nic’s Stark and Wayne repo on Github. (also check out the Cloud Foundry Bosh repo.)

gem install bosh-bootstrap
gem update --system

Git was installed a little earlier in the process, so now set the default user name and email so that when we use bosh it will know what to use for cloning repositories it uses.

git config --global user.name "Adron Hall"
git config --global user.email plzdont@spamme.bro

Step: Launch a bosh deploy with the bootstrap.

bosh-bootstrap deploy

You’ll receive a prompt, and here’s what to hit to get a good first deploy.

Stage 1: I select AWS, simply as I’ve no OpenStack environment. One day maybe I can try out the other option. Until then I went with the tried and true AWS. Here you’ll need to enter your access & secret key from the AWS security settings for your AWS account.

For the region, I selected #7, which is west 2. That translates to the data center in Oregon. Why did I select Oregon? Because I live in Portland and that data center is about 50 miles away. Otherwise it doesn’t matter which region you select, any region can spool up almost any type of bosh environment.

Stage 2: In this stage, select default by hitting enter. This will choose the default bosh settings. The default uses a medium instance to spool up a good default Cloud Foundry environment. It also sets up a security group specifically for Cloud Foundry.

Stage 3: At this point you’ll be prompted to select what to do, choose to create an inception virtual machine. After a while, sometimes a few minutes, sometimes an hour or two – depending on internal and external connections – you should receive the “Stage 6: Setup bosh” results.

Stage 6: Setup bosh

setup bosh user
uploading /tmp/remote_script_setup_bosh_user to Inception VM
Initially targeting micro-bosh…
Target set to `microbosh-aws-us-west-2′
Creating initial user adron…
Logged in as `admin’
User `adron’ has been created
Login as adron…
Logged in as `adron’
Successfully setup bosh user
cleanup permissions
uploading /tmp/remote_script_cleanup_permissions to Inception VM
Successfully cleanup permissions
Locally targeting and login to new BOSH…
bosh -u adron -p cheesewhiz target 54.214.0.15
Target set to `microbosh-aws-us-west-2′
bosh login adron cheesewhiz
Logged in as `adron’
Confirming: You are now targeting and logged in to your BOSH

ubuntu@ip-yz-xyz-xx-yy:~$

If you look in your AWS Console you should also see a box with a key pair named “inception” and one that is under the “microbosh-aws-us-west-2″ name. The inception instance is a m1.small while the microbosh instance is an m1.medium.

That should get you going with bosh. In my next entry around bosh I’ll dive into some of Dr Nic & Brian McClain’s work before diving into what exactly Bosh actually is. As one may expect, from Stark & Wayne we can expect some pretty cool stuff, so keep an eye over there on Stark & Wayne.

11 thoughts on “Using Bosh to Bootstrap Cloud Foundry via Stark & Wayne Consulting

  1. Back in the Bosh Bunker | Composite Code

  2. Back in the Bosh Bunker : CloudAve

  3. Farewell Basho, It’s Been Swell Yo! | Composite Code

  4. Farewell Basho, It’s Been Swell Yo! : CloudAve

  5. During the bosh-bootstrap command I received the following error. Any thoughts?

    Using bosh_openstack_cpi 1.2710.0
    Using membrane 0.0.5
    Using rest-client 1.6.7
    Using bosh_vcloud_cpi 0.6.0
    Using mysql2 0.3.16

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/bin/ruby -r ./siteconf20140910-8172 -1r2ncqv.rb extconf.rb
    checking for pg_config… no
    No pg_config… trying anyway. If building fails, please try again with
    –with-pg-config=/path/to/pg_config
    checking for libpq-fe.h… no
    Can’t find the ‘libpq-fe.h header
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of
    necessary libraries and/or headers. Check the mkmf.log file for more
    details. You may need configuration options.

    Provided configuration options:
    –with-opt-dir
    –without-opt-dir
    –with-opt-include
    –without-opt-include=${opt-dir}/include
    –with-opt-lib
    –without-opt-lib=${opt-dir}/lib
    –with-make-prog
    –without-make-prog
    –srcdir=.
    –curdir
    –ruby=/home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
    –with-pg
    –without-pg
    –with-pg-dir
    –without-pg-dir
    –with-pg-include
    –without-pg-include=${pg-dir}/include
    –with-pg-lib
    –without-pg-lib=${pg-dir}/lib
    –with-pg-config
    –without-pg-config
    –with-pg_config
    –without-pg_config

    extconf failed, exit code 1

    Gem files will remain installed in /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/p g-0.15.1 for inspection.
    Results logged to /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/extensions/x86_64-linux /1.9.1/pg-0.15.1/gem_make.out
    An error occurred while installing pg (0.15.1), and Bundler cannot continue.
    Make sure that `gem install pg -v ‘0.15.1’` succeeds before bundling.
    /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner': Command failed with status (5): [bundle install ...] (RuntimeError)
    from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/rake/file_u tils.rb:45:in `call’
    from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/rake/file_u tils.rb:45:in `sh’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/cli/helpers/bundle.rb:11:in `block in bundle’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547@global/gems/bundler-1.6.2/li b/bundler.rb:235:in `block in with_clean_env’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547@global/gems/bundler-1.6.2/li b/bundler.rb:222:in `with_original_env’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547@global/gems/bundler-1.6.2/li b/bundler.rb:228:in `with_clean_env’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/cli/helpers/bundle.rb:9:in `bundle’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/microbosh.rb:60:in `setup_gems’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/microbosh.rb:41:in `block in deploy’
    from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/fileutils.r b:125:in `chdir’
    from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/fileutils.r b:125:in `cd’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/microbosh.rb:40:in `deploy’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/cli/commands/deploy.rb:75:in `perform_microbosh_deploy’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/cli/commands/deploy.rb:24:in `perform’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/l ib/bosh-bootstrap/thor_cli.rb:11:in `deploy’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/co mmand.rb:27:in `run’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/in vocation.rb:126:in `invoke_command’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor.rb :359:in `dispatch’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/ba se.rb:440:in `start’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/gems/bosh-bootstrap-0.13.2/b in/bosh-bootstrap:13:in `’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/bin/bosh-bootstrap:23:in `lo ad’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/bin/bosh-bootstrap:23:in `’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15 :in `eval’
    from /home/ubuntu/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15 :in `’

  6. After getting past the above error, I was able to get through the deploy, but hitting the URL produced an error page that just said “/ not found”. I thought maybe the deployment became corrupted because of the earlier failure, so I ran “bosh-bootstrap delete”, which seemed to execute successfully. But then running “bosh-bootstrap deploy” resulted in –
    Done deploy micro bosh (00:03:50)
    Deployed `firstbosh/micro_bosh.yml’ to `Unknown Director’, took 00:03:50 to complete

    Any thoughts? I think my next plan of action will be to start from scratch as it appears some configuration was set that is preventing things from working properly.

    • This went a bit smoother this time, although there were a few things I needed to do. Git was not installed.
      sudo apt-get install git
      git init
      sudo apt-get install libpq-dev

      Also, I didn’t get any prompts for Steps 2 and 3 at the end of the how-to. Did I miss something?

      When hitting the URL, I was prompted for a username / password. What is should I use?

      Thanks!

      • Hey Steve,

        I’d have to suggest going and checking out the repos related to Bruce & Wayne consulting on deploying Bosh and such. I’m sure a lot of my material needs updated related to what they’ve done in the last however many months. Sorry about the pointer, but I’ve really not used bosh for anything the last year or so.

        Best of luck!

      • Ah, excellent! Glad to know you got past that. I’ve been wanting to get another cloud foundry setup rolling with bosh but just haven’t had the time lately. I’ve unfortunately been hand rolling things like a mad scientist! :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s