Sunday, June 30, 2013

Running existing applications on SAP HANA Cloud



In my recent blog I mentioned that I gave up on running my own server and now I'm entirely dependent on services provided via Internet in some cloud. 

Since I'm working for SAP and developing the HANA Cloud thingie I intend to start a series of blogs about my experience with the clouds and in particular the PaaS I'm working on. Not really a complete surprise I guess, so to catch up I'll try to post stuff that's nowhere to be found :) 

Having said all the above I want to make the statement that I'm expressing just my opinion. You probably noticed that this is not an official SAP site, I'm neither SAP spokesman nor my blog is the official SAP documentation.

So here it comes my first blog for SAP HANA Cloud ...


Isn't this already available in the documentation?

Well not exactly ...

Developing and deploying an application on SAP HANA Cloud is described in numerous blogs, articles and tutorials. But most of the stuff out there ignores the fact that there are cloud users that want to run an existing application on the platform. 

Some of them need to check if their application written for standalone servers will require modification (or will it run at all), and some of them just want to see how all this cloud stuff behaves without going through all the development hustle and pain. 

And what is this blog about then?

It turns out that if one wants to step into the shoes of an operator, administrator (or whatever it is called in your organization) then you're out of luck. There are bits and pieces scattered in various places so it becomes quite difficult to get a decent overview.

While my target is not to gather such an overview and provide it at once in the next year or so, I want to assemble some guidelines on how you can use HANA Cloud and where you can get the operator's information.

Get an account

To be able to use SAP HANA Cloud for free you'll need to create a developer account. It gives you access to the trial landscape for an unlimited period. 
The access to the trial landscape allows you to:
  • deploy and run your own application
  • get access to the Cloud Cockpit to do some operator's tasks

Download and configure the SDK

Go to the tools page and download the latest SDK. Extract the downloaded ZIP somewhere and then check the official documentation on how the console client can be configured to use proxy.

To try-out if everything works ok go to the directory where you extracted the SDK and start a console/terminal/command line.

Now use:
cd tools
neo
You should see a list with commands available with the SDK:


C:\neo-sdk-javaweb-1.30.8\tools>neo

SAP HANA Cloud Console Client

No arguments specified


Usage: neo [group:]command [parameters] [properties file]

Available commands:

 --- connectivity ---
  delete-destination
        Deletes destination or JKS file from SAP HANA Cloud
  get-destination
        Downloads destination or JKS file to local file system
  put-destination
        Uploads destination or JKS file to SAP HANA Cloud

 --- deploy ---
  deploy
        Deploys WARs or installable units
... <output trimmed> ...

Now let's try if your account works correctly. Go to <SDK root>/tools/samples/deploy_war/example_war.properties and open it with your favourite text editor. Change the first four keys in the properties file like this:

# Your account name
account=i024099trial

# Application name
application=test

# User for login to hana.ondemand.com.
user=i024099

# URL of the landscape admin server. Optional. Defaults to hana.ondemand.com.
host=hanatrial.ondemand.com
Please note that you'll have to use your own account and user names.

Save the changes in the properties file and check if the account works ok using the following command line:
C:\neo-sdk-javaweb-1.30.8\tools>neo deploy samples\deploy_war\example_war.properties
Enter your password when prompted and if everything works fine you should see:

SAP HANA Cloud Console Client


Requesting deployment for:
   application    : test
   account        : i024099trial
   source         : samples/deploy_war/example.war
   elasticity data: [1 .. 1]
   severity       : error
   host           : https://hanatrial.ondemand.com
   SDK version    : 1.30.8
   user           : i024099

Password for your user:

[Sat Jun 29 18:30:51 FET 2013] Deployment started......
[Sat Jun 29 18:31:01 FET 2013] Deployment finished successfully
What does "landscape" mean? Isn't the cloud a single and somehow lonely place?

If you haven't noticed I mentioned registering a "trial" account in "trial" landscape with some URL. I'm not sure adding "trial" to the URL will make the things better. Then the URL for SDK download was not really with the subdomain of the trial landscape. This perhaps means we have more than one landscape?

The answer is yes - we have two landscapes which can be used for different purposes:
  • trial landscape - for experimenting and writing blogs :)
  • factory landscape - for running business applications and making money out of it

The SAP HANA Cloud is supposed to be singular, but as we can see we have two clouds with the same name. So what's the difference?

To put it in a simple way - the trial landscape is not the big thing. Yes you can do a lot of things with it but you don't get all the bells and whistles of the real product. For example you don't get support (and the sweet support SLAs).

And ... you don't get to pay for it. So we'll continue using the trial in this blog.
 
Does "latest SDK" ring a bell? 

You probably noticed the "download the latest SDK" part above. This in practice means that we update the SDK once in a while. 

So if you want to use the latest and greatest you need to download it every 2 weeks. And yes - we try to keep it compatible.

The blog is indeed targeted more at operators, so why should you bother to download the SDK every 2 weeks then? The answer is that the SDK contains not only development stuff (APIs, local runtime, samples, ...) but the client part tools as well.

So even if you have an application you don't want to modify you may still want to download the latest SDK to get all the improvements poured inside on a bi-weekly base.

Some of my next blogs for HANA Cloud will shed some light on the tooling in the SDK.

I don't have an existing application. Now what?

Here are some places where you can find applications to try out:

The rules here are that the application:
  • does not require modification in Tomcat scripts, OS resources (plain WAR), native executables to do their job
  • is DB vendor neutral (no DB exotics)

Let's start. Or is it rather deploy and start?

If you've read this far you should have:
  • downloaded and configured SDK tools (so far only proxy settings)
  • application to run on SAP HANA Cloud

Running your application is actually a two phase process with HANA Cloud:
  • uploading the application (we call this deployment) 
  • starting an application process with the uploaded binaries

Let's start with the upload part for JPetstore:
  1. Download JPetstore
  2. Extract the mybatis-jpetstore-6.0.0.war
  3. Rename it to ROOT.war
  4. Copy the ROOT.war to <SDK root>/tools/samples/deploy_war
  5. Modify the example_war.properties file and change:

    source=samples/deploy_war/example.war 

    to 

    source=samples/deploy_war/ROOT.war

  6. Deploy the application using:
C:\neo-sdk-javaweb-1.30.8\tools>neo deploy samples\deploy_war\example_war.properties
SAP HANA Cloud Console Client


Requesting deployment for:
   application    : test
   account        : i024099trial
   source         : samples/deploy_war/ROOT.war
   elasticity data: [1 .. 1]
   severity       : error
   host           : https://hanatrial.ondemand.com
   SDK version    : 1.30.8
   user           : i024099


[Sat Jun 29 23:38:56 FET 2013] Deployment started...............................
........
[Sat Jun 29 23:40:45 FET 2013] Deployment finished successfully

Now we have the binaries uploaded it is time to start the application with the following command:
C:\neo-sdk-javaweb-1.30.8\tools>neo start samples\deploy_war\example_war.properties

SAP HANA Cloud Console Client


Requesting start for:
   application: test
   account    : i024099trial
   host       : https://hanatrial.ondemand.com
   synchronous: false
   SDK version: 1.30.8
   user       : i024099

Password for your user:

Start request performed successfully.

Triggered start of application processes.
Component status: STARTING
You may noticed that the command is actually asynchronous and just triggers the start process. To check the status of the application we've just attempted to start you may use the status command. Once the application is started we'll get the access points:

C:\neo-sdk-javaweb-1.30.8\tools>neo status samples\deploy_war\example_war.properties

SAP HANA Cloud Console Client


Requesting status for:
   application: test
   account    : i024099trial
   host       : https://hanatrial.ondemand.com
   SDK version: 1.30.8
   user       : i024099

Status: STARTED

URL: https://testi024099trial.hanatrial.ondemand.com

Access points:
  https://testi024099trial.hanatrial.ondemand.com

Let's try to access the provided URL. And voilà we have the JPetstore running.

Trying the same with a GWT sample:
  1. Go to gwt-2.5.1/samples/Showcase/war
  2. ZIP the content into ROOT.war
  3. Copy and overwrite the JPetstore 
  4. Deploy and start the application


What's in the next blog?
  • Why command line?
  • Scaling your application
  • Start/Stop/Restart
  • Managing multiple applications
  • Undeploy

Tuesday, June 04, 2013

Replacing a server with free services

I have had a server with:
  • Apache Tomcat
  • Git and SVN servers
  • Gallery (Apache, PHP, MySQL)
  • IP Cam Motion
Recently I found out that all of this can be easily migrated to free internet services. What do I gain? Well ... a lot of things but amongst them:
  • silence in my living room
  • reduced electricity costs
  • data protection in case a thunder storm comes close
If you are interested what I used to replace all of the above, below is the breakout with some pros and cons.

Image hosting

I had concerns that my photos are far too big to fit any of the offerings on the web, but I replaced my self-hosted Gallery instance with Flickr since they offer a free terabyte of storage.

Pros:
  • access from my mobile 
  • I don't have to backup the data from my server
  • great groupping in Flickr (sets and collections)
  • social elements

Cons - clumsy Uploadr that:
  • does not understand some camera rotation exif info 
  • does not allow me to upload more than 200 photos no matter that I have 1 TB free in Flickr and 30 GB RAM for its JavaScript

Source code

GitHub would have been my choice but ... I needed a private repository for some of my code. So I had to go with BitBucket that offers Git hosting for teams and 5 private repos.

IP Cam

I used to run Motion to capture photos and video of my home IP Cam. I found out that I can simply mail the photos to a dedicated GMail account and make use of several GB storage they offer.

Instead of my custom web interface (simple HTML page) I now use the camera's web interface with guest access (no rotation or settings change).

The hardest part was to create a rule/filter that deletes motion detect events older than several days. After I googled on the topic I found out that this is easily achieved with Google Apps Scripts.

Tomcat

A good Tomcat hosting is not easy to find. I experimented a bit with Amazon's Free Tier but I cannot recommend it since:
  • it is not really free (once you go out of the tier usage limits)
  • it does not provide enough storage for big projects (MySQL would cost you a lot)
Torrents

I used my server to download torrents since Apple does not allow such software in the AppStore for iOS (and therefore for my iPad). I can use my Android phone to do this but this is not really reliable or cost-effective.

No real replacement I can recommend so far.

Tuesday, May 07, 2013

Vilar IP Cam - Network settings

I have 4 Vilar IP Cams. Recently I needed to move two of them to a new network. The setup program that came with the cam did not find the cameras so I had to do the setup via the web interface. It turned out however that the network settings page (Basic -> Network) did not save/apply the changes I made in to the page controls.

Since I'm Firefox user and I also do some pretty basic web development I enabled Firebug and checked what the malfunctioning Apply button actually does. 

It turned out that it was not simply a submit form button, but instead called settcpip JavaScript function. The same function was called on every click event as well. The function itself performed some IP address validation and if everyting was ok invoked:
document.form1.submit()
I debugged this settcpip function by:
  • Enabling Script debugging
  • Reloading the page (in Firebug UI)
  • In the first JavaScript shown by Firebug I searched for settcpip
  • Set breakpoint at the line
element = document.getElementById('StaticIP');
To my surpise the element turned out to be ... null. I checked the HTML source and yes - there was no such id.

I had two options:
  • Adapt the HTML to what JavaScript expected (i.e. change the options of the select tag to "StaticIP")
  • Short-circuit the function used to check for correct IP address

Since I already spent too much time fixing a bug present in ~20 obviously never tested versions of the firmware I decided to check if the form submit will work at all.

What I did was to go the Apply button source and replace settcpip with document.form1.submit()

After that hitting Apply worked like a charm and I was able to change my cam's IP address.

If you want to use the same trick, please bear in mind that a single mistake in the form may trigger your cam unreachable. Then you'll most probably need to reset it to factory defaults by pressing the reset switch for at least 20 seconds.

Thursday, May 31, 2012

Power supply for my Vilar IP camera

My Vilar IP camera served me well for almost an year until I had to replace its power supply. The symptoms were strange - the camera crashed, the PTZ was not working, but yet it transmitted ok.

The new power supply didn't last that long and even the video transmission failed.

Therefore I digged out an old 230W computer power supply (PS) and started thinking on wiring it to the 5V input of my camera.

Cutting the original power cable to get a connector that will fit was easy. Next I had to find out that the (+) was the red wire, while the (-) was the black one.

In order to check the needed wires of the computer PS it had to be working. Plugging it in did not made the trick, so I remembered that ATX PS had a low-power switch. Googling this I came across a page that made the obvious proposal to short-cicuit pin 14 and 15 (PS on and GND).

Luckily I wear a switcher with self-made zip handle made of clip. I took out the clip, cut it in half and bend it to produce an always-on power supply :)

I measured the different currents and found out that the black out is again GND. I've been burned by even more obvious things so I like to double check things. The red one turned ot to be +12V, while the yellow wire was the needed +5.12V

I soldered the cable from my camera to the wires of the ATX PS (red-red and balck-black), checked that the (+) is +5V and (-) is GND and decided to gave the IP camera a go with the new supply.

Suddenly the camera movement was faster (it sloooowly turned left/right with the old supply) and it responded to all requests as if it was just bought :)

Now I intend to power my Arduino Nano circut with the same ATS PS.

Thursday, April 05, 2012

Eclipse Right Through (RT) the Clouds

I prepared a Virtual Box image (accessible also here) that contains a tutorial on how to:
  • extend Cloud Foundry with a new framework
    • replace Tomcat with Virgo
    • add auto-detect code in VMC
    • add download/packaging code
  • use Cloud Foundry services
    • parse JSON from environment variables
    • connect to MySQL via JDBC
    • share Cloud Foundry services between applications
  • use Eclipse Link JPA
    • programatically initialize Data Source

You will need:
  • 10GB of disk space
  • 4GB memory
  • Virtual Box
  • 7-Zip

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 https://github.com/hsiliev/vmc.git
   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 virgo.vcap.me 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>/virgo.zip
6. Replace the ZIP in  
   ~/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/virgo/resources

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.

    make.conf

    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.

    CHOST="i686-pc-linux-gnu"
    CFLAGS="-march=native -O2 -pipe"
    CXXFLAGS="${CFLAGS}"
    MAKEOPTS="-j5"
    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 \
         -ipv6"
    GENTOO_MIRRORS="http://mirrors.ludost.net/gentoo/ ftp://mirrors.ludost.net/gentoo/ http://distfiles.gentoo.bg/ http://ftp.gentoo.bg/ "
    SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
    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):
    ifplugd_eth0="dhcp"
    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.

    Gnome 

    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 http://gpo.zugaina.org/lst/gpo-repositories.xml
    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

    Saturday, October 01, 2011

    Setting up Geovision 650 surveliance card in Gentoo

    I was trying to turn my old 2.2 Ghz Celeron based computer into a surveillance system. I needed a lot of computing power to be able to record from 4 cameras and to be able to integrate 2 new Vilar IP cameras as well. I chose Gentoo Linux since it does it's job as server OS quite well on my home development server.

    So after 3 hours I had a customized installation compiled with -march=native and kernel stripped down to the bare minimum.

    I tried to set up my Geovision 650 DVR card starting from the Linux module. I launched make menuconfig and was sure that I'll have everything ready in under an hour. As you can imagine this was not the case :) In the end it took me 2 days to have the card running and I decided to describe the steps.

    Gentoo installation
    I followed the handbook as usual and the installation was pretty straightforward and went smooth. The GCC configuration spared me the search for the CFLAGS of my CPU and I had to put -march=native to get everything optimized.

    USE flags
    I intended to use ZoneMinder so I added the needed flags right away (apache, mysql, php, perl). It turned out that to check the input of the card I had to use xawtv, so I enabled X as well.

    BT878 / BTTV module
    The module I needed was BTTV since Geovision 650 is equipped with two BT878 chips to allow decent capture from its 4 inputs. 

    However I was not able to find how to enable the compilation of the driver. I was more astonished than ashamed to find that the answer was the non-existent Infra-red Remote.... Turning the IR support in the kernel enabled the compilation of the module I desperately needed.

    I tried so hard to enable BT878 support so I decided to scan all options in kernel configuration screens. I removed a lot of unneeded stuff and between the flags that were unchecked was the one ensuring that my 80GB HDD was able to host single files with size more than 2TB.

    I recompiled the kernel and a few modules, replaced the old binaries, rebooted the machine...

    Missing kernel features
    ... and I found myself with read only EXT4 file system. It turned out that the LiveCD I used to create my root partition had large files suppport turned on. In fact the kernel has this by default. Using EXT4 tools seems to pick the kernel settings so before I was able to fit 2TB files on my small HDD and now the kernel was not able to process such files anymore.

    I found the solution in this blog and this was one of the reasons to describe my installation problems.

    BTTV driver configuration
    Gentoo now uses OpenRC to describe and configure modules (/etc/conf.d/modules). I put bttv driver in the list rebooted again to check if the driver will autodetect the card. Yes I know that modprobe would (or actually should) have done the same job but I had to be sure.

    What I found was card=0, autodetecting log entry shown by dmesg. So I had to find the correct card settings. Fortunatelly there are a lot of resources out there that hinted to use "card=<number>" parameter of bttv module. The question was what to put as number. Soon I found that 150 provides me with Geovision 600 which is pretty close relative to my GV-650. 

    Using my Windows experience I rebooted again and after several seconds found out that nothing changed. So time for modprobe tests with different numers only to find no change in bttv output.

    Fortunatelly the bttv sources were sitting quetly on my HDD. A dump of bttv.c showed that GV-600 has 0x96 value which was exactly 150 in decimal. I smiled happily and put the "correct" values in modules configuration: "card=150,150".

    The next Windows-style reboot revealed that bttv was not happy with this value as well. I had the same autodetect failure in the logs.

    I reported the problem in bugzilla. Meanwhile tried to search internet and found a Russian Google IRC chat that provided needed workaround. It turned out that udev kicked in too early and loaded the module before OpenRC was able to configure it correctly. OpenRC issued modprobe correctly but the module was already there. 

    So in the end - not really a bug :) Simply disabling coldplug with rc_coldplug="NO" in /etc.conf.d/udev did the trick.

    Testing video input
    I installed xawtv to test the output and after 2 hours of experiments I had no idea why the card won't work.

    Google found out several configurations working fine with GV600 or GV800 but none with GV650. Strange ... 

    I wondered what was the difference between GV600 and GV650. After some research it turned out that GV650 has one more BT878 chip than GV600, and in turn GV800 has 4 in total. 

    Consulting the bttv-cards.c file revealed that one of the chips in GV800 is "master" and the rest "slaves". This and the strange mapping between the inputs and the chips in this blog led me to the conclusion that I need to change my bttv configuration to "card=157,158" (master/slave).

    Another reboot and suddenly everything worked just fine.

    ZoneMinder
    The last time I tried to run ZoneMinder on Gentoo was 4 years ago. Too long as it turned out. 

    Today the ZoneMinder is nowhere to be found in the repositories and its configuration on your own is not easy. You have to hunt down the location of all dependencies, the libraries ffmpeg is build with and so on.
    Well I think I managed to dig all the needed info but configure just stopped with cryptic message about openssl library. Basically it says that the library is on the system but is messed up and unusable by ZoneMinder. 

    Seems like I'll have to create a new blog about this :)

    Friday, July 29, 2011

    Virgo and the Cloud

    If you wanted to try your OSGi based applications in the cloud you can now do so with Eclipse Virgo and CloudFoundry using a VM image.

    What you will need:

    The image comes with pre-installed Ubuntu 11.04 and has:
    • User / Password: virgo / cloudfoundry
    • CloudFoundry
      • installation: /home/virgo/cloudfoundry
      • version/date: 28 July 2011
      • Virgo 3.0.0.RC1
    • Applications (Splash screen & Admin Console): /home/virgo/apps

    Starting CloudFoundry
    To start CloudFoundry you have to start a Terminal and issue:
    cd ~/cloudfoundry/vcap
    bin/vcap start
    To check if the start was successful:
    bin/vcap status
     More information and examples can be found in the CloudFoundry VCAP Readme.


    Sample applications
    To push (deploy) the Virgo default applications you can use the VMC client:
    cd ~/apps
    vmc push virgo

    where "virgo" is the name of the application we want to have running on CloudFoundry. You will have to confirm the name, URL, memory reservation and that the default applications do not use services.

    As next step you can request the application at http://virgo.vcap.me. This should bring the default splash screen of Virgo with a link to the Admin Console.


    Your own applications
    Perhaps you will want to try your own application as well. To do this you will have to:
    • create a directory
    • copy your stuff inside
    • push the content with "vmc push"

    There are some extras here. If you create "repository" directory inside your application's directory then the content of this repository will be copied in Virgo's repository. 

    Virgo on CloudFoundry
    If you take a look at the provided Admin Console application you will see that it makes use of two bundles that are located inside "repository/ext". The bundles are copied in Virgo's own repository directory so the rest of the content can resolve against these bundles.


    Supported artefacts
    Currently supported artefacts:
    • WAR file (defaults to Tomcat, so you'll have to change the framework to Virgo)
    • PAR
    • Plan
    • Bundle (JAR)
    • Combination of the mentioned artefacts


    Multi-application solutions
    The last option provides you with the ability to have more than one artefact in your solution. All these are pushed to CloudFoundry and used in Virgo. 

    As an example you may have several interconnected but relatively independent applications: PAR representing some back-end, WAR that provides the end-user UI and some more artefacts (as much as you need) that can represent editors or administration logic.

    Everything can run on one Virgo server for testing/development, but you may decide to create several instances of a certain component to scale out that part of your solution. All that provided that your applications are written with scalability and cloud computing in mind of course.


    Where's the source code?
    At the time of this writing the changes made to CloudFoundry are not final and therefore no pull request is created, but I'm up to this.

    You can find the source in GitHub if you want to play with it or just check how/if it works in your case :)

      Wednesday, June 15, 2011

      Apache Gogo and SSH in Eclipse Virgo

      Step 1: Download Gogo shell
      To run the Gogo you will need three bundles from Apache Felix downloads:

      Step 2: Equinox and RFC-147
      To enable  RFC-147 integration in Equinox you will need some console supportability features that are provided by the Console supportability project in Equinox Incubator.

      Download the Incubator build that includes the bundle we'll need. Extract only the supportability JAR (org.eclipse.equinox.console.supportability) from plugins folder.


      Step 3: Enabling SSH Support
      First download Apache Mina's binary distribution for SSHD, and then from the lib directory of the archive extract these two bundles:
      • sshd-core
      • mina-core

      Step 4: Setting up Virgo
      • Copy the console supportability bundle (org.eclipse.equinox.console.supportability) in lib directory
      • Place the rest of the bundles (3xGogo, SSHD and Mina) in lib/kernel directory
      • Edit config/org.eclipse.virgo.kernel.userregion.properties file and add the bundles to base bundles list:
      baseBundles = \
       file:lib/kernel/org.eclipse.virgo.kernel.userregion-3.0.0.M05.jar@start,\
       file:lib/kernel/org.eclipse.virgo.kernel.osgicommand-3.0.0.M05.jar@start,\
       file:lib/kernel/mina-core-2.0.1.jar@start,\
       file:lib/kernel/org.apache.felix.gogo.command-0.8.0.jar@start,\
       file:lib/kernel/org.apache.felix.gogo.runtime-0.8.0.jar@start,\
       file:lib/kernel/org.apache.felix.gogo.shell-0.8.0.jar@start,\
       file:lib/org.eclipse.equinox.console.supportability_1.0.0.N20110608-2000.jar@start,\
       file:lib/kernel/sshd-core-0.5.0.jar@start
      • In lib/org.eclipse.virgo.kernel.launch.properties remove the old Virgo shell  by deleting the line org.eclipse.virgo.osgi.console.telnet.hook.TelnetHookConfigurator. The hooks entry should look like this afterwards:

        osgi.hook.configurators.include=\
         org.eclipse.virgo.osgi.extensions.equinox.hooks.ExtensionsHookConfigurator
      • Delete (or move outside lib) the bundle lib/org.eclipse.virgo.osgi.console-3.0.0.M05.jar
       
      Step 5: Configuring Virgo
      • Comment or delete osgi.console property in lib/org.eclipse.virgo.kernel.launch.properties:
      #osgi.console=2401
      • Add the following property entries to lib/org.eclipse.virgo.kernel.launch.properties:
      osgi.console.ssh=2422
      osgi.console.enable.builtin=false
      osgi.console.ssh.useDefaultSecureStorage=true
      • Add in config/org.eclipse.virgo.kernel.authentication.config file JAAS configuration for the SSH:
      equinox_console { 
          org.eclipse.equinox.console.jaas.SecureStorageLoginModule REQUIRED; 
      };
      • Edit the bin/dmk.bat or bin/dmk.sh file to add org.eclipse.equinox.console.jaas.file and ssh.server.keystore VM system properties. After the changes the file should look as follows: 
      set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.virgo.kernel.authentication.file="%CONFIG_DIR%\org.eclipse.virgo.kernel.users.properties"
      set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dorg.eclipse.equinox.console.jaas.file="%CONFIG_DIR%/store"
      set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Dssh.server.keystore="%CONFIG_DIR%/hostkey.ser"
      set KERNEL_JAVA_PARMS=%KERNEL_JAVA_PARMS% -Djava.io.tmpdir="%TMP_DIR%"
       


      Step 6: Connecting to Virgo
      Fire your favourite SSH client on the specified port (2422 for instance).
      • Login with the default user and password (equinox/equinox) 
      • Create a new user and password

      Step 7: Fun with Gogo
      Check the features provided by GoGo and Equinox Console Supportability:
      • Tab Completion / Line editing
      • Built-in commands like lb, ls, cat to name a few
      • Create some scripts
      • Create some commands using RFC-147

      Step 8: Disconnecting

      Do not use "exit" since this will exit Virgo/OSGi framework. To end the session you'll have to close the console window. There is no command to close the session currently.

      Monday, April 04, 2011

      OSGi Bundle Dependency Analysis

      To find all the bundles needed by your imports you can follow these simple steps:

      Step 1: Open the MANIFEST-MF of your bundle

      Step 2: Go to the Dependencies tab

      Step 3: Add the packages you need (if you do not already have them)

      Step 4: Save the changes

      Step 5: Go to Dependency Analysis and chose the hierarchy view

      Step 6: Browse the hierarchical list of all dependencies

      Step 7: To remove the duplicates use the Flat Layout


      Please have in mind that this approach will work only for bundles that are in your Eclipse distribution or in your currently active target platform.

      Monday, March 07, 2011

      Git Notifier on Windows

      Git Notifier is a tool that can keep you up to date with what's going on in a Git repository. Unfortunately it seems that it's only for MacOS. Until this evening...

      ...when I decided to give Google a try and searched for Growl without removing Windows from my previous search. It turned out that Growl has Windows port so the task of having notifications for Git commits on my desktop moved from the dusty "nearly impossible" corner in my mind to "doable".

      So I installed:

      The next big step was to download Git Notifier just to find out that it utilized RubyGem. Cygwin does not provide Gem so I had to install it manually.  An easy task as it turned out:
      1. Download RubyGem
      2. Install it using "ruby setup.rb" as described in RubyGems User Guide

      Now that I had RubyGem I went straight to installing the Notifier.
      gem install git-notifier --source http://gemcutter.org

      Starting Git Notifier however turned out unsuccessful since this tool brings several dependencies:
      • ruby-growl
      • growl
      • daemons

      Simply installing the dependencies did the trick:
      gem install ruby-growl growl daemons

      The rest is up to you. A good start would be to autostart Growl as well as git-notifier :)

      id_rsa.pub: invalid format, error in libcrypto

      After I upgraded my Linux and got Python 3.10 by default, it turned out that Ansible 2.9 will no longer run and is unsupported together with...