Tuesday, January 6, 2015

Running Cloud Foundry on Your Machine

Apparently there are two ways to install cloud foundry on your local development environment; bosh-lite and cf_nise_installer. I followed the steps specified in bosh-lite. Make sure that you have  Go and Ruby (default Ruby that comes with Mac ask you to run in root which is unnecessary/frightening and I ended up use rbenv for managing multiple versions of Ruby). You also need vagrant for setting up your virtual machine and virtualbox for virtualization. Also make sure that you have the latest versions of all of them.
  1. Install Xcode command line tools: xcode-select --install
  2. Install bosh cli: gem install bosh_cli
  3. Install vagrant
  4. mkdir workspace
  5. cd workspace
  6. git clone https://github.com/cloudfoundry/bosh-lite.git
  7. Install Virtualbox
  8. cd bosh-lite
  9. vagrant up (This will download and run your ubuntu virtual machine in virtualbox using the vagrantfile in the same directory you run this command).
  10. export no_proxy=192.168.50.4,xip.io
  11. bosh target 192.168.50.4 lite
  12. bosh login (use admin/admin for username/password)
  13. bin/add-route
  14. Install spiff (you may need homebrew if you still don't have it)
  15. cd ~/workspace
  16. git clone https://github.com/cloudfoundry/cf-release
  17. cd bosh-lite
  18. ./bin/provision_cf
Above are the basic steps I followed, it takes an 30-40 minutes to download and compile all components of cloud foundry. As far as I see most people had gone through the steps until 11 smoothly. However they stucked in step 12, complaining that they got an error saying cannot access to the bosh director. If you get such errors, that means that you most probably have a networking problem when setting up the virtual machine. It happened to me too, in order to resolve it, I disconnected my VPN client and restarted my computer and run vagrant up command again. That solved the problem for me! Finally make sure that you have enough space in your hard-disk, downloading and compiling all packages takes enormous amount of space (more than 50 GB).

If everything goes well, after the installation you can login to your cf instance as follow;
cf api --skip-ssl-validation https://api.10.244.0.34.xip.io
Then you can authenticate yourself by running;
cf login
and use admin/admin for username and password. Once you logged in you can create org, space and push applications, services with no cost :-).

Once you're done, give yourself a moment and think about the fact that you're running a cloud in your local machine. You've gone really far. Thanks cloud foundry and the open source community! You may also want to try Bluemix (PaaS offering of IBM) which runs in cloud foundry.

No comments:

Post a Comment