Simulate RabbitMQ via RabbitMQSimulator on CloudFoundry

EDIT: These instructions are a bit out of date on the Cloud Foundry portion since the release of Cloud Foundry v2 at http://run.pivotal.io.  I'll post an updated entry describing how to publish to the latest version of Cloud Foundry.  For the mean time, you can access my updated version of the simulator at http://rabbitmq-sim.cfapps.io

Alvaro Videla recently posted a great article about a simulator he created to help describe how RabbitMQ passes messages.  This simulator can be run locally, and you can even set up examples ahead of time, export them, and then re-import them as needed.  

I was surprised there weren't instructions given for deploying this to Cloud Foundry as well, so I went through the process and documented my steps.  Obviously, for demo purposes, you would probably want to run the the simulator locally to prevent any reliance on the network.  However, for experimentation purposes, Cloud Foundry makes it simple to host and deploy this Node.JS based app as a publicly accessible, hosted service.

If you don't want to go through this process yourself, you can even access my deployed instance at http://rabbitmq-sim.cloudfoundry.com.


Initial procedure

To get started, clone the RabbitMQ Simulator project from GitHub:

git clone https://github.com/RabbitMQSimulator/RabbitMQSimulator.git

After cloning the project, cd to the RabbitMQSimulator directory for the remaining commands.

Next, since I'm on a Mac, I used Brew to install Node.JS.  If you don't have Brew, you should install it from http://mxcl.github.com/homebrew/.  Then, issue the following command to install Node.JS:

brew install node.js

brew install node.js output
After a few seconds, the Node.JS supporting libraries and binaries will be available.  Next (you did cd to the RabbitMQSimulator directory, right?) we install the necessary modules to the RabbitMQSimulator project with the following command:


npm install


After a bunch of HTTP GETs, and some "grunt"-ing, we now need to install the "grunt" command line interface to be able to execute some small tasks to finish building the simulator.  Install the grunt CLI with the following command:


npm install -g grunt-cli


After some more HTTP GETs, we can now invoke grunt to finish the build tasks:


/usr/local/share/npm/bin/grunt


grunt command output
Now, you could fire up the app locally to make sure it works with the following command:


node app.js


If the app seems functional, then we can move on to install it in Cloud Foundry.

Install to Cloud Foundry

First, sign up for a free Cloud Foundry account if you don't have one already.  While you wait for your account to be confirmed, also follow the instructions for installing the "vmc" tool so that you can push the RabbitMQ Simulator to your account.

Once you have your account confirmed and vmc is installed, go back to your terminal window.  Login to your Cloud Foundry account with the following command:

vmc login

You'll be prompted to enter the email you used to sign up with, and the password for your account.

Now, if you aren't there already, cd to the RabbitMQSimulator folder you cloned from git.  From that directory, issue the following command:

vmc push rabbitmq-sim --runtime=node08

This command will start the process to push your application that will be called "rabbitmq-sim" in your account, and it will use a 0.8.x runtime version of the Node.JS Droplet Execution Agent.  The command will prompt you for various bits of info, and it is ok to take defaults on most everything but the "Application Deployed URL" prompt.  I have already deployed this application to my account under the rabbitmq-sim.cloudfoundry.com host name.  You will need to select a different host name to publish your own rabbitmq-sim instance.

vmc push of the RabbitMQ Simulator

Once you have answered all the prompts, the vmc tool will push the application to Cloud Foundry.  Once the application is finished starting, you can browse to the host name that you chose for the application, and start working with your simulator instance.

Running RabbitMQ Simulator on Cloud Foundry



Comments

Popular posts from this blog

Using Snapshot Isolation with SQL Server and Hibernate

FreeNAS, CIFS, and user login problems

Official Pandora Desktop and Hotkey Support?