The Cloud Foundry Blog

Working Offline with Micro Cloud Foundry

While 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

This entry was posted in CloudFoundry. Bookmark the permalink.

2 Responses to Working Offline with Micro Cloud Foundry

  1. Pingback: Removing the Operating System Barrier with Platform as a Service (PaaS), Part 2 - a guest post from Adron Hall | New Relic blog

  2. Alex De Lara says:

    Almost got it – when I use to open another shell on the MicroCloud, I can login, no problem and I can ping the cloud with “ping “, however, when I switch to the terminal of the laptop instead (running on a MacBook laptop), I keep getting “unknown host”, so I’m not sure where things are stopping, but seems that the Micro Cloud is not passing up to the DNS what I am expecting ( api.customercontrolhub.cloudfoundry.me )
    I did a test with “host api.customercontrolhub.cloudfoundry.me”, which returns:
    api.customercontrolhub.cloudfoundry.me is an alias for customercontrolhub.cloudfoundry.me.
    api.customercontrolhub.cloudfoundry.me is an alias for customercontrolhub.cloudfoundry.me.
    but none pings back …
    Tried also a “dscacheutil -flushcache” which seemed to work.
    Tried “curl 192.168.47.129″, it returns:
    VCAP ROUTER: 404 – DESTINATION NOT FOUND
    So, clearly the Micro Cloud is not available outside the virtual machine.
    And at different stages, tried
    # vmc target api.customercontrolhub.cloudfoundry.me
    Host is not available or is not valid: ‘http://api.customercontrolhub.cloudfoundry.me’
    Would you like see the response? [yN]: y
    Cannot access target (getaddrinfo: nodename nor servname provided, or not known)

    What gives ??

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>