Showing posts with label cloud foundry. Show all posts
Showing posts with label cloud foundry. Show all posts

Saturday, May 19, 2012

How to host your own instance of Cloud Foundry

There are companies out there making the business based on the Cloud Foundry instances hosted on their own infrastructure (instead of the VMware's one). Cloud Foundry platform is released as Open Source project. So theoretically I also could build my own instance of Cloud Foundry and start hosting services.

So what steps I need to perform in order to start my brand new Cloud Foundry instance?

  • install VMware's VM image of Ubuntu 10.04.02 .
  • download and execute VCAP (VMware Cloud Application Platform) installer:
  • $ sudo apt-get install curl
    $ bash < <(curl -s -k -B https://raw.github.com/cloudfoundry/vcap/master/dev_setup/bin/vcap_dev_setup)
  • make yourself a cup of coffee and wait until the installation process completes.
  • restart Ubuntu VM.
  • start VCAP service (~/cloudfoundry/vcap/dev_setup/bin/vcap_dev start).
  • validate your installation:
  • $ vmc target api.vcap.me
    $ vmc info

If you see something similar to...

VMware's Cloud Application Platform
For support visit support@cloudfoundry.com

Target:   http://api.vcap.me (v0.999)
Client:   v0.3.10M
... it means that you've just successfully started your own Cloud Foundry instance.

Wednesday, May 16, 2012

Custom domain for application deployed on Cloud Foundry (or any other cloud provider)

The problem

The problem with an amazing Cloud Foundry, is that due to the limitations of beta version, it doesn't support mapping of custom (aka external) domains to the applications. It's a pity since free Cloud Foundry account has some impressive quota and could be used for initial production deployment of many web applications.

Are we then doomed to the http://applicationWithUglyUrl.cloudfoundry.com kind of URLs when deploying to the Cloud Foundry?


Reverse proxy to the rescue

The trick to deal the with ugly domain names is to use reverse proxy to forward requests from our custom domain to the Cloud Foundry application.

Reverse proxy allows to transparently forward HTTP requests from one server to another. The interesting side effect of the usage of reverse proxy is that you can hide your destination server behind the domain name mapped to that proxy.


Probably the most popular reverse HTTP proxy implementation is Apache HTTP server with enabled mod_proxy module.


Reverse proxy and the Cloud Foundry

In the case of Cloud Foundry you need to configure your custom domain (for example myapplication.com) to point to some reverse proxy.  Then configure the reverse proxy to forward the requests matching your custom domain (http://myapplication.com) to the Cloud Foundry instance (for example http://myapplication.cloudfoundry.com).


What if I don't have Apache HTTP instance?

You don't have your personal Apache HTTP to host reverse proxy? No problem. As I read at this brilliant blog you can use bs2grproxy reverse proxy application hosted on free Google App Engine Account. Here's what exactly you need to do:
  • download Python Google App Engine SDK and unzip it.
  • create application for proxy on Google App Engine (give it a nice name, like myapplication-proxy).
  • download bs2grproxy application template and unzip it.
  • open file bs2grpconfig.py in text editor and change value of TARGET_HOST property to the address of your Cloud Foundry application (for example to the http://myapplication.cloudfoundry.com).
  • open file app.yaml in text editor and set the proper id and version of your Google App Engine proxy application (for example application: myapplication-proxy and version: 1).
  • install Python (sudo apt-get install python under Ubuntu) since bs2grproxy is written in it.
  • from Python GAE SDK directory execute the following command - ./appcfg.py update /home/user/projects/myapplication-proxy . The latter command will deploy your proxy application to the Google App Engine infrastructure.
  • since Google App Engine allows you to configure custom external domains even for free accounts, set your custom domain (myapplication.com in our example) to point to the proxy deployed on the Google App Engine (for example to myapplication-proxy.appspot.com).
Congratulations. From now on all requests to the http://myapplication.com will be transparently forwarded by reverse proxy to the http://myapplication.cloudfoundry.com.


What about the other hosting providers?

Remember that you can use reverse HTTP proxy to mirror any domain. So you can use it to deal with all kinds of ugly URL mappings.

Saturday, May 12, 2012

Praise for the Cloud Foundry

I'm pretty excited about beta version of VMware's Cloud Foundry. Probably as excited as disappointed by Google App Engine.

GAE is a vendor-lock-in PAAS providing services with little business value for the majority of the projects I've been involved into. On the other hand Cloud Foundry is a PAAS providing amazingly simple hosting services. The services that just works. For example:


If you're looking for the good place to deploy your WAR and make use of the following types of resources...
  • file system (sic!)
  • MySQL
  • PostgreSQL
  • Redis
  • MongoDB
...you will be at home using Cloud Foundry.

I cannot overemphasize the fact that pretty decent Cloud Foundry account is available for free. By saying "pretty decent" I mean  2 GB of memory (sic!), 2 GB of disc space and 4 core CPU. Such free account really encourage to play with the Cloud Foundry.

At this moment VMware doesn't tell how much will it charge for Cloud Foundry after closing the beta phase. However practically no vendor-lock-in makes CF a perfect choice for the initial deployment of many web applications. With no vendor burden you can just switch to another provider without any special effort.

VMware, kudos for you :) .