Installing and Configuring Cloud Foundry
Cloud Foundry is a pretty cool, open-source P_latform-_a_s-_a-_S_ervice from VMWare. It allows you to run Java, Node.JS and Rails applications without having to worry about deployment or the maintance of services.
If you ask me, it’s the way we should manage software. For a really high-level over view, read this
There is one caveat to this: we’re installing from the Ubuntu PPA archives from LaunchPad which are really out of date. I created a ticket to which they are claiming that they will be updating it soon. I don’t know what soon means to them, but the sooner the better.
Let’s start this
I’m assuming that you are starting with a fresh, mostly empty install of Ubuntu 11.10. It doesn’t matter if you’re running this on a virtual machine or not, it should work the same way.
First, we need to install some special packages:
sudo apt-get install python-software-properties sudo apt-add-repository ppa:cloudfoundry/ppa
And then lets update and upgrade the machine to the latest and greatest:
sudo apt-get update sudo apt-get -y dist-upgrade
Go get yourself a drink, this may take a while.
Done? Okay, lets install Cloud Foundry!
The installer will ask you three questions: the password for mysql, and for two IP addresses. The password for mysql you will need later and I suggest you use the IP adress of the machine that you are installing the software on.
sudo apt-get install cloudfoundry-server
Again, this will take a while. Just answer the two questions when asked and let it run.
Done? Now for hard part, which really isn’t all that hard.
For some reason the installer doesn’t update cloud foundry configuration with the mysql password.
cd /opt/cloudfoundry/vcap/services/mysql/config sudo nano mysql_node.yml
Scroll down to the very last line in the file and change the password: root to be the password that you used for the installation. Then:
sudo /etc/init.d/cloudfoundry-server restart
Guess what? It should now work!
The Cloud Foundry guys have a nice work-up on how to use the command line tool called VMC. I won’t copy it here but you can read it over here. You will use the tool to interface with your Cloud Foundry instance so read up on it and understand what it does.
There are a few things that annoy me about installing Cloud Foundry this way, outside of the fact that it is months out-of-date. One is the old version of node.js that it installs.
But, we can fix that.
Install an Updated Node.js
We need to add another PPA:
sudo apt-add-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get -y dist-upgrade sudo apt-get install npm
You will need to know what version of the node runtime you are using:
Now we need to modify the DEA configuration to accept the new runtime:
sudo nano /opt/cloudfoundry/vcap/dea/config/dea.yml
Change the line line version in the node section to be the same as what we got for the output of the previous command, then you will need to restart Cloud Foundry.
Most of the time things just work, but occasionally things don’t. If you look in the /tmp/vcap-run directory you will see logs for the various components. Just look through them and that will get you started.