My personal views, thoughts and opinions.

Saturday, November 26, 2011

Running Virgo on Cloud Foundry

In this post I provided a VM with Virgo and Cloud Foundry. Now I'll explains how to set up such VM on your own and to use updated (2011-11-27) Cloud Foundry version forked in GitHub.

Installation steps:

1. Download VirtualBox and install it.
2. Download VirtualBox's Extension Pack and install this as well. 

You may double click on the Extension Pack for Windows. Also note that the extensions are not needed if you want to setup Ubuntu on your own.

3. Download Ubuntu image and write down the user/password. 

I've tested with Ubuntu 11.04. Ubuntu Server is the best choice for productive systems, and in case you like developing with VI. 

Note that the recommended version is Ubuntu Server 10.04-2 LTS.

4. Start the image 

Some of the archives contain only HDD image, so you may need to configure the VM and attach the downloaded HDD image.

Other images come preconfigured. For those you may need to change the network adapter settings in VirtualBox.  Simply clicking on Network section and saving the auto-detected changes did the trick for me.

In general ensure the VM has at least 2GB memory. If you want to try every Cloud Foundry service and framework (or simply run the tests) you will need at least 3GB of memory.

The image may have keyboard layout you are not used to (Italy as was in my case), so it's a good idea to change this. For the Server (no GUI) you can do this with:
   sudo dpkg-reconfigure console-setup

Installing Guest Additions is definitely a good idea since it allows you to copy/paste install commands in the next steps, and what's more important allows hardware and host OS acceleration.

5. Install libtool using:
    sudo apt-get install libtool

6. Install CloudFoundry on the image as explained in this GitHub vcap repository fork

You may need to reboot the VM to allow RVM (Ruby Version Manager) to pick up the configuration in vcap folder and switch Ruby versions. Sourcing the configurations did not work for me.

7. Update Cloud Foundry with the Virgo modifications

The Cloud Controller uses vcap_staging gem that does not support Virgo, so we have to update the gem with the Virgo specific code. To do this execute: 
   cd ~/cloudfoundry/vcap
   cp -r staging/lib/* ~/.rvm/gems/ruby-1.9.2-p180/gems/vcap_staging-0.1.25/lib/

Finally restart the Cloud Foundry:
   bin/vcap restart 

To be able to use the automatic discovery of Virgo applications in VMC we need to update the client:
   cd ~/cloudfoundry/
   git clone
   cp vmc/lib/cli/frameworks.rb ~/.rvm/gems/ruby-1.9.2-p180/gems/vmc-0.3.13/lib/cli

How to install Virgo's Admin Console

1. Download and extract the archived console
2. In the directory where you extracted the archive, run:
   vmc push virgo
3. Request and you should see the Splash Screen with link to the Admin Console in the upper right corner.

How to update to the latest Virgo version:
2. Go to vcap-java/virgo-setup
3. Edit virgo_manifest.yml to specify the exact version you want
4. Run rake virgo:prepare
5. Find the new version in 
   /tmp/virgo-<your version>/
6. Replace the ZIP in  

The last two steps should be automated with the virgo:install task, but I haven't tested if this works.

    Tuesday, November 15, 2011

    Gentoo on Lenovo T520

    My new laptop is finally here. Lenovo T520 came with Windows 7, and if you ask me that's a bad choice for laptop with these specs. Neither the video (Intel HD), nor the 500GB HDD were made to be used by gamers where Windows is undisputed leader.

    So I made up my mind to made a switch and chose Gentoo Linux since I needed better git, ruby and java support, but besides all I wanted to be in control on what's happening with the hardware and software on my system :) From previous installations I found out that Ubuntu does not support odd or older hardware without kernel recompile. On the other hand the software packages in the most popular Linux distro are not the most stable thing (especially Gnome UI stuff).

    Since I had enough experience with Gentoo from setting up my development server and the surveillance system machine  I decided that I'll just stick with this source based distro with rolling updates. It is also used by several cloud computing companies, so it looks it's here to stay.

    I've done the basic setup almost exactly as recommended in the Gentoo Handbook. The concrete settings are detailed below.


    I used "native" architecture for GCC which leaves the optimization decision in the compiler. Since T520 has 4 cores the numer of compile/processing threads is set to 5. To speed up the emerge the download is made on background with "parallel-fetch" feature.

    CFLAGS="-march=native -O2 -pipe"
    FEATURES="parallel-fetch -test"
    USE="mmx sse sse2 sse3 3dnow 3dnowext \
         dvd dvdr cdr vcd cdda \
         usb wifi laptop ieee1394 \
         lm_sensors \
         bash-completion symlink \
         ftp \
         bzip2 zip unzip 7zip rar \
         jpeg svg jpeg2k png gif mng \
         ffmpeg xvid x264 theora \
         truetype gd \
         mp3 faac faad amr \
         java javascript xml ruby python \
         sqlite \
         ssl sni \
         unicode \
         daemon threads \
         X xvfb dbus hal \
         gtk gnome gdu extras device-mapper policykit cairo \
         -kde -qt3 -qt4 \
    ACCEPT_LICENSE="dlj-1.1 Oracle-BCLA-JavaSE skype-eula"
    INPUT_DEVICES="evdev synaptics mouse keyboard"
    VIDEO_CARDS="intel vesa"
    LINGUAS="bg en"

    I'm a Gnome user, so the flags are set to disable QT and KDE. The IPv6 is of no use to me currently so I disabled it as well.

    I'm Java developer so I accepted Oracle's JDK 1.5 and 1.6 licences to enable installation of the software. Since Oracle changed the 1.6 licence and download pages it is no longer possible to install Java automatically. Fortunately emerge provides quite good hints when you have to download a package manually.

    Next I inserted my hardware configuration for X - keyboard, synaptic, external mouse, and Intel HD video card.

    Language configuration can also be added in make.conf to enable localization of console, X and Gnome/KDE.

    Linux Kernel Configuration

    I used the Gentoo's 3.0.6 kernel (gentoo-sources) with this configuration.

    LAN setup

    In /etc/conf.d/net you can use ifplugd to make the annoying delay on start-up go away, when there is no cable plugged (in the end this is a laptop):
    Of course you will have to install ifplugd as described in the handbook.

    Wireless network

    The kernel configuration includes drivers for the wireless network on T520. This however is not enough to get it working.

    I found out that the network is Intel Centrino Advanced-N and followed Google to this Gentoo Forum Post. The post provides quite good guide on how to identify and emerge the right driver and firmware for your wireless chip.


    As a pleasant surprise Gnome provided me with working functional keys out of the box. From changing video output through back-light to sleep buttons everything worked as expected.

    Not working 

    Currently I don't know how to get the card reader to work.

    Tuesday, November 08, 2011

    Installing ZoneMinder in Gentoo

    Installing ZoneMinder in Gentoo turned out to be a relatively easy task:

    emerge layman

    layman -o
    layman -a zugaina

    echo "source /var/lib/layman/make.conf" >> /etc/make.conf
    ACCEPT_KEYWORDS="~x86" emerge -av zoneminder

    If you are interested in the details you can take a look at Overlays @ Gentoo wiki

    Google+ Followers