Debug Bluemix application on your local PC

When I discuss with Bluemix application developers, I frequently hear about how to debug the application on Bluemix. There are several technique for it. One of the best known technique is probably to use cf-debug-tools written by Pivotal engineer. This tool opens a websocket connection between web browser and container, and it accept command. To be able to use this tool on Bluemix, web socket URL needs to be changed from “ws” to “wss”. I used Chrome browser to run it.

2014-09-17 cf-debug-tools sample screen

Another promising way to debug Bluemix application is to use “Cloud Focker” from CloudCredo team ( https://github.com/CloudCredo/cloudfocker ). This project has just started, but I like this project from various view points.

  • I can run the application in my local environment with less memory resource compared to 1VM Cloud Foundry (Bosh-lite).
  • I can try new buildpack, and potentially debug the buildpack itself.
  • Prepare for Docker integration expected to happen in Cloud Foundry community space.

Running Cloud Focker is very simple.

  1. Install Vagrant and VirtualBox in advance.
  2. Clone the Cloud Focker Project.
    $ git clone https://github.com/CloudCredo/cloudfocker.git
  3. Deploy Cloud Focker image and run it.
    $ cd cloudfocker
    $ vagrant up –provider virtualbox
    $ vagrant ssh

Good thing of Cloud Focker is support for Cloud Foundry community buildpacks  ( some of buildpacks may not run with it). For example, I can add Node.js buildpack, and then deploy the application as follows.

 $ fock add-buildpack https://github.com/cloudfoundry/nodejs-buildpack
 $ cd <node-js-app>
 $ fock up

The last command kicks off Cloud Foundry container image, and then just like Cloud Foundry PaaS, it will stage and run the application on the container.

2014-09-17 15_20_19-Cloud Focker

For example, I can now debug my favorite “Sentiment Analysis App” application available on IBM DevOps Service in my local PC (note about URL is localhost:8080 ).

2014-09-04 16 twitter sentiment

Another good thing is I can enter into container image using “nsentor” command.

$ docker ps
$ PID=$(docker inspect --format {{.State.Pid}} <container id>)
$ sudo nsenter --target $PID --mount --uts --ipc --net --pid

2014-09-17 inside docker container

Again, Cloud Focker project has just started, so probably you need to have skill on Docker and Golang to trouble shoot if there is any issue, and then contribute. Hopefully, I’ll be able to contribute to this project as well.

Advertisements
This entry was posted in Bluemix. Bookmark the permalink.

2 Responses to Debug Bluemix application on your local PC

  1. hansb001 says:

    Reblogged this on hansboef and commented:
    Great Article! Everybody is asking for this!

  2. Pingback: Debugging | Cloudfoundry Rocks

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