Working Offline with Micro Cloud Foundry

September 8, 2011 Cloud Foundry

featured-cf-genericWhile the Micro Cloud Foundry documentation states that you can use its built-in dynamic DNS capabilities to connect to their Cloud Foundry instances from any online environment, it’s possible to use Micro Cloud Foundry in offline mode if you need to work without an internet connection in just a few steps.

First you need to configure the Micro Cloud Foundry VM to use NAT instead of the default bridged mode.

In the Micro Cloud Foundry console, select option 4 and enter ‘vcap.me’ when it asks you for the token, which will configure it to use the vcap.me domain that resolves to 127.0.0.1.

It will take a a couple of minutes for the controller to reconfigure the Micro Cloud Foundry VM to use the vcap.me domain.

Once it is done, the console will display the new domain and admin info on the screen.

After the update is complete, you will need to make some changes on your local system. What you will need to do is to set up an SSH tunnel to access your Micro Cloud Foundry VM (note that you will need to supply the IP address in the command below with the actual IP of your VM, which is displayed in the console).

sudo ssh -L 80:192.168.168.149:80 vcap@192.168.168.149
Password:
vcap@192.168.168.149's password:Â

The first password being prompted is the sudo password for your machine, as it is needed to open port 80 which requires root privileges. The second password is the vcap user password which you entered during the initial configuration of your Micro Cloud Foundry.

When you are working offline, your laptop cannot do a remote DNS lookup for the *.vcap.me domain to return 127.0.0.1, so you will need to edit your local hosts file and add some entries:

127.0.0.1  localhost
127.0.0.1  vcap.me api.vcap.me

You will also need one entry per application you deploy into the micro cloud.  For example, if your application is called “foo”, you need to add the following line:

127.0.0.1  foo.vcap.me

Once you have finished adding the domain name entries, you are ready to use vmc to interact with your instance..

martin@vaccine$ vmc target api.vcap.me
Succesfully targeted to [http://api.vcap.me]

martin@vaccine$ vmc register --email admin@vcap.me
Password: *****
Verify Password: *****
Creating New User: OK
Successfully logged into [http://api.vcap.me]

martin@vaccine$ vmc push foo -n
Creating Application: OK
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK
Push Status: OK
Staging Application: OK
Starting Application: OK

martin@vaccine$ curl foo.vcap.me
<h1>Hello from the Micro Cloud! via: 127.0.0.1:54979</h1> 

We are working to streamline these steps even more to make working with Micro Cloud Foundry simple in both online and offline scenarios. So stay tuned!

  • The Cloud Foundry Team

About the Author

Biography

Previous
New Tech Talk: MongoDB Redux
New Tech Talk: MongoDB Redux

Chris Westin, a mongoDB developer from 10gen, discusses more in-depth uses of mongoDB, reveals some of the ...

Next
The Last Lean Startup Bundle by Eric Ries – with Pivotal Tracker!
The Last Lean Startup Bundle by Eric Ries – with Pivotal Tracker!

If you're involved in a startup, you've probably already discovered the transformative Lean Startup movemen...

×

Subscribe to our Newsletter

!
Thank you!
Error - something went wrong!