Geaux Virtual

Helping virtualize the datacenter…

Archive for the ‘Random’ Category

Working with Sinatra and Cloud Foundry

with 2 comments

The other night I had idea pop in my head, that honestly, I was quite surprised hadn’t thought about before. I then set about working through the design of what would be needed to pull this idea off (sorry, the idea is under strict NDA that requires many pints of Guinness to even be able to sign).

Recently, I have started to move most of my work to Ruby, even working on another side project in Ruby that this project will be able to utilize. This project is a web based application, so with that, I needed a web/application server plus a platform to run it on. Now I have done my share of setting up Linux boxes with the required software before, but this time I wanted to see if the open source Cloud Foundry bits (VCAP) would prove useful in what I was looking to do. For the web/application server, I decided to go with Sinatra and Thin.


This was not my first time setting up a VCAP server or deploying apps to one. For some reason, I decided to stand up yet another VCAP VM on my laptop instead of using an existing instance :/. Of course in this process, I ran into issues, such as corrupted vmc profiles and a rvm installation issue in the soon to be deprecated default install process. Using the experimental Chef based installation, I had no issues getting a VCAP VM up and running. One interesting point to note when using the default or Chef based installation off of github, the default domain is When you ping, this resolves to :). So how do you access the VM via DNS? Well you set up an SSH tunnel from your workstation to the VCAP VM (also explained in the installation instructions).

In order to deploy applications to your VCAP VM, you need to install VMC to your workstation. This is as simple as running gem install vmc. If you want the latest beta, add –pre behind that command like so gem install vmc --pre. With your SSH tunnel setup and VMC installed, now you can follow the “Trying your setup” section on the VCAP github page (VCAP).


Now with VCAP up and running, I focused on getting Sinatra and Thin working. Sinatra is actually quite simple, actually. First install the Sinatra gem:

gem install sinatra

and here is a simple web application

require 'sinatra'
get '/' do
  "Hello World"

And that’s it. When you run ruby app.rb (or whatever you named the file), Sinatra fires up webrick and starts serving your page. See? Simple.

So lets move on. Now there are two ways to run Sinatra apps. The first is classic mode, as shown above. The second is in modular mode in a file called server.rb, shown below:

require 'sinatra/base'

class Server < Sinatra::Base
  get '/' do
    "Hello World"

Each mode of Sinatra application is also started differently. With the classic mode, you can start it with! However, in modular mode, Rack is used to start the server, and here in comes the fun of getting Sinatra/Thin working on Cloud Foundry VCAP VM. Classic mode works quite well on the VCAP VM, but modular mode requires a little bit more configuration.

First, you want to create a file in the root of your application. The location is key. By default, Rack looks for in the root of your application directory. There is a :config setting that can be changed, but for some reason when I set this key with a different location, the default port Thin starts on changed from 9292 to 8080. I have not figured out why this is occurring as nothing in my changed the Thin port; however, this will cause it to start on port 8080 in VCAP and not be accessible. The file needs to look like the following:

require 'sinatra'

set :run, false #This disables Sinatra trying to start Thin and let's Rack start Thin

require File.dirname(__FILE__) + "/path/to/server/file"

#The following is key. Sinatra Modular apps could
#be started with just run Server, but when deployed to
#VCAP, you need to map the application #to a location.
#In this instance, I want my server application
#to be mapped to the default path.
map '/' do
  run Server

Ok, now that our is configured (and of course more configurations could be added to it), we need to configure our main application file. For this, we need to use Rack to start our server. Lets say this file is called app.rb

require File.dirname(__FILE__) + "/path/to/server/file"
require 'rack'
require 'sinatra' #required for VCAP to detect this is a Sinatra Application
require 'thin'

server =

Now before we push our application to our VCAP VM, we need to create a Gemfile that looks like the following:

source ""

gem 'sinatra'
gem 'thin'

You may wonder why Rack is not listed. Sinatra is dependent on Rack and will install the Rack gems when its installed. With the Gemfile created, we can run bundle package && bundle install to package up all the gems required by our application. If you require any more gems for your application, you will want to run bundle package && bundle install before you update your application.

With done, we need to push our application. We start this process with the command:

vmc push --runtime ruby19

If you are still using Ruby 1.8.7, do not add the –runtime ruby19. There is one more key step when pushing the application. VMC will ask for the “Application Deployment URL”. The default url it will show will be [APPLICATION NAME][SSH TUNNEL PORT]. You will receive an error if you keep the default. You will want to remove the [SSH TUNNEL PORT] from the url, so it looks like [APPLICATION NAME]

With that, you should see VMC staging and starting your application on your VCAP VM. When started, you can access via web browser or curl at [APPLICATION NAME][SSH TUNNEL PORT].

It took me a while to get this working, but now that is, it is working great. The next step will be to see if Sinatra-Synchrony will work as well. I do not believe my application will require this, but it is more for an academic purpose at this point.

Written by jguidroz

February 14, 2012 at 7:34 pm

Posted in Random, Scripting

leave a comment »

Over the past year, I dropped the ball on this blog. It’s been a busy time, but I’ll try over the next year to make a few more posts. So what has been going on? Here are a few of the items keeping me busy:

  • Received the results on the VCAP-DCA; did not pass. The equipment I was using was also moved, so I did not get the opportunity to prepare and take it again.
  • Made a couple of trips to Ireland and spent about a month in England.
  • Moved back to Louisiana.
  • Dabbled in PowerShell, PHP, Python, Scala, Ruby
  • Changed managers about two or three times.
  • Passed the VCP 5

So what’s in store in the coming year? Well hopefully a lot of cool projects. There are a few topics I want to blog about and hopefully post some useful tools. I’m looking to move everything I do to Ruby, though there may still be some internal PowerShell scripts for some items.

This is my short update. Hopefully everyone had a good year.

Written by jguidroz

December 26, 2011 at 6:48 pm

Posted in Random, Scripting, VMware

What a difference a year makes

leave a comment »

A year ago, I had just accepted an offer to join @lynxbat at his company in Fort Worth, TX.  With the change in companies, this meant I was going to VMworld 2009 on my own dime.

Fast forward a year, @lynxbat is a vSpecialist with EMC, and I’m a Network Architect with ACADIA.  Ah, how times have changed, and all for the better.

Written by jguidroz

August 18, 2010 at 5:01 pm

Posted in Random

The next chapter in my career

with one comment

I do have to say, my voluntary vacation the past 6 weeks has been great.  I did not travel anywhere exotic, or actually do much of anything.  It was just great having downtime away from work.

Now it’s time to focus on the next chapter of my professional career, which starts on May 24th.  I will be joining ACADIA as a Network Architect.  I am looking forward to the opportunities and challenges that will be presented in this position and company.

I will keep this update short and head off to today’s RAoN: Running.

Written by jguidroz

May 13, 2010 at 2:28 pm

Posted in Networking, Random, VMware

RAoN: Running

with one comment

It has been a while since my last update.  I have been trying to enjoy my time away from the IT field, and by that, I mean turning off my brain from all things IT (a very hard thing to do).  I do have some technical blog posts that will come out once I decide to turn my brain back on, so please be patient.

With that, I am adding another acronym to the long list that I see fly around on a daily basis (IaaS, PaaS, SaaS, ROFL, etc).  The new one is RAoN, or expanded, Random Acts of Nuttiness.

My first RAoN is running.  I use to run quite a bit back in the day (yes 10 years ago is back in the day for me).  I use to run 50-60 miles a week and walked on to the LSU Cross Country and Track team.  Two years later after my first two serious injuries, I decided to run away from running.  I was burnt out.  I would do a race now and then, but never at the level I was at before.  One thing with running: when you stop, you get out of shape very quickly.  I tried to start back running quite a number of times over the past 10 years.  My problem was/is in my head.  I remember the pace I used to train at, and it would frustrate me how hard it was to run slower than that for vastly shorter distances.  I was so frustrated, that I would stop after a couple of weeks.

So what is different now?  Well there are a few reasons even though I am older now and my body aches more.  First, I bought myself a pair of Nike Free 5.0 shoes.  Ever since lacing these up, I have been able to run without pain in my ankles and knees.  Seriously, if you run, get yourself a pair and try them out.  Second, I am forcing myself to work through my mental blocks.  How?  As much as I hate it, I am running on a treadmill.  This allows me to better control my pace as I work myself back into shape.  It also helps me keep my distances relatively short (2 miles) because I can not stand running on a treadmill.  And third?  I set myself a goal.  I just recently completed my first Crescent City Classic in New Orleans.  For being very out of shape and not having run anything over a 5K(in a race or training) in 10 years, I completed the 10K course in 55 minutes.  Good for the shape I was in, horrible compared to 10 years ago.  So my goal for next year is 45 minutes.  I plan to get there by slowly increasing the distance of my runs (half mile at a time), and slowly increasing the pace I am running at.

I know I will never be in the shape I was in 10 years ago, and that is perfectly ok.  However, I need to train my brain while I am running that I will never be able to run at the pace I use to.  That is the difficult task at hand for the next year, oh and staying healthy.

Stay tuned for the next RAoN: Triathlons.

Written by jguidroz

April 29, 2010 at 6:22 pm

Posted in Random

And a new era begins

leave a comment »

Six months ago I decided to make career and life change and move to Fort Worth for a new job.  It was a fantastic opportunity at a small company.  I never envisioned being at the company for longer than two years, but I figured the opportunities for career growth were better.  Surprisingly, I also did not imagine my time at the company to be so short lived.  It is actually quite unfortunate, since I worked with a lot of a great of people.

There always comes a time where you have to ask yourself if you can accept and deal with the changes, or is it better to find another opportunity?

I had been fighting this for the past couple of months, and today I made the decision, for both personal and professional reasons, to move on.  I had made similar decisions before, but always because I was moving to a new employer for a better opportunity.  This time is different.  I am just moving on.  And surprisingly, I am very relaxed and happy with the decision.

So what is next for me?

The last two projects I really enjoyed were designing and architecting the server refresh at my previous company, and then the implementation of the 100% virtualized data center at my now former company.  Both revolved around VMware vSphere, Cisco Nexus 5000 switches, and EMC storage.  I would like to pursue a position around data center design and architecture using the same or similar technologies.  Along a similar path, I also have aspirations for attaining CCIE and VCDX certifications.

And that’s a wrap.  I am off to enjoy the rest of my day.

Written by jguidroz

March 29, 2010 at 2:06 pm

Posted in Networking, Random, VMware

Where is it? It’s got to be here, it just has to be…

with 2 comments

I’ve been thinking about this for a while, and since this is a new year, here is a list of 9 features or changes I would like see.

In no particular order:

9.  When doing a manual VMotion, maintain the current resource pool of the VM.  Only ask for a resource pool if I move the VM to a new cluster. (VMware)

8. Ability to configure one default alarm action to apply to some or all default alarms. (VMware)

7.  Utilize Cisco Nexus 5000 switches as VSMs for Cisco Nexus 1000v deployments. (Cisco)

6.  PowerPath support for QLogic QLE8100 series cards. (EMC; Yes, I know it’s coming, I’m just impatient)

5.  Native Mac VMware vSphere client. (VMware; I’m really reaching with this one)

4.  Removal of PowerPath License Server requirement (EMC)

3.  Port Profiles added to the Cisco Nexus 5000 switches (Cisco)

2.  vCenter Virtual Appliance (VMware)

And last, but probably the most important…..

1.  Ability to migrate templates (VMware)

Drops mic and walks off stage….

Written by jguidroz

February 2, 2010 at 8:24 am

Posted in Networking, Random, VMware