Thursday, October 16, 2014

Fabric8 V2

Fabric8 v2 integrates with OpenShift v3 and Docker.

  • Fabric8 V2 documentation:
  • When an app is start as Java Main Docker uses the following docker file:
  • Use NSEnter to Connect to a running docker container:
  • Link to a running hawtio on v2: http://dockerhost:8484/hawtio/kubernetes/pods
  • See docker output: "docker logs "
  • if the docker container image's entry point of java $MAIN
    then docker run -Pit mynewlygeneratedimage will run the java main

Thursday, July 24, 2014

Hacking on Fabric8 Gateway

I'm currently adding a mbean to the Fabric8 gateway and one of the things I learned about are SRC annotations. These annotations are developed by the Apache Felix Project and they allow resource injection.

Something else I learned is that fabric8 reads its libraries straight from maven, and caches it in your local .m2 maven repository. So in development all you need to do is enable watching your repo using

Fabric8:karaf@root> fabric:watch *
Then when building your jar using 'mvn install' it will automatically be picked up by karaf without needing to restart the fabric8 server.

Tuesday, July 22, 2014

Extend a logical volume on a encrypted disk

My encrypted disk shows up as a 'double' volume in the 'Disk Utility' as shown in the following figure

You can see both volumes show up as 253 GB. I think it means the encrypted volume is using the LVM2 Physical Volume. Then the encrypted volume contains 5 mapped volumes which are listed under 'Peripheral Devices'. Initially they where:

  • Home: 4GB
  • NotBackedUp: 8GB
  • Root: 15 GB
  • Swap: 4 GB
  • VirtualMachines: 29GB
This totals  about 60 GB, and 'vgdisplay HelpDeskRHEL6' shows:

# vgdisplay HelpDeskRHEL6
  --- Volume group ---
  VG Name               HelpDeskRHEL6
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                5
  Open LV               5
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               235.47 GiB
  PE Size               4.00 MiB
  Total PE              60280
  Alloc PE / Size       15346 / 59.95 GiB
  Free  PE / Size       44934 / 175.52 GiB
  VG UUID               zXN22u-w74k-PxAn-RhB0-QZib-Pg0e-apCHx0

Which show the Alloc Size of 59.95 GB, and it also shows I still have 175.52 GB of Free Size. I want to use that as part of my 'NotBackedUp' Logical Volume and I use lvextend to add 150GB to it:

# lvextend -L 150G /dev/HelpDeskRHEL6/NotBackedUp
  Extending logical volume NotBackedUp to 150.00 GiB
  Logical volume NotBackedUp successfully resized

Next, to actually use the extra space we need to resize the filesystem using resize2fs

# resize2fs /dev/HelpDeskRHEL6/NotBackedUp
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/HelpDeskRHEL6/NotBackedUp is mounted on /NotBackedUp; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 10
Performing an on-line resize of /dev/HelpDeskRHEL6/NotBackedUp to 39321600 (4k) blocks.
The filesystem on /dev/HelpDeskRHEL6/NotBackedUp is now 39321600 blocks long.

and to verify we can see the large NotBackedUp Volume I use df:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
                       15G  7.5G  6.2G  55% /
tmpfs                 7.7G  600K  7.7G   1% /dev/shm
                      148G  7.5G  133G   6% /NotBackedUp
                       29G  8.2G   20G  30% /VirtualMachines
/dev/sda1             3.0G   93M  2.8G   4% /boot
                      4.0G  260M  3.5G   7% /home


Friday, June 20, 2014

Notes on adding the Fuse Cartridge using RPM.

Fuse can be used on OpenShift using the Fuse Cartridge, the code for which can be found on github: During the setup phase of a Fuse based application on OpenShift it downloads a big zipfile. I've been working on an rpm that includes the zip file to avoid this big download, to shorten the application setup and so it doesn't depend on a network connection to the outside.

At the moment the rpm is build from the openshift-enterprise-rpm-6.1 branch, and the finished product is placed in nexus.

If you want to build the rpm by hand use 'rpmdev-setuptree', copy the zip to ~/rpmbuild/SOURCE (this needs to be the cartridge zip containing the, copy the spec file to rpmbuild/SPEC and then build the rpm using 'rpmbuild -ba openshift-origin-cartridge-fuse.spec'.

Next copy the rpm to your OpenShift node and install it using rpm -U , and once it's done restart the
ruby193-mcollective service on node and import cartridge on broker 
 #oo-admin-ctl-cartridge -c import-node --obsolete  --activate 
You can check fuse cartridge is listed by rhc cartridge-list. Note that I only found the oo-admin-ctl-cartridge command on OpenShift Enterprise and not on Origin.

At this point the Fuse application should also be listed on the application page.

You can create a new gear from there or you can use rhc:
rhc app create fuse fuse -g medium
It should now have created a running Fuse gear. Please note that on my little laptop it took roughtly 15 minutes for it to show up and rhc and the console were sort of in a frozen state.

Add Medium Gear Capablity on OpenShift

The OpenShift Virtual Machine download is pre-configured with one node, in one district with a small gear profile. There are two ways to add another gear size
  • add another node, in a new district with medium gears, but easier is it to
  • remove the district restriction and allow both small and medium gears.
Edit the /etc/openshift/plugins.d/openshift-origin-msg-broker-mcollective.conf, and set

Next in edit the /etc/openshift/broker.conf and set

Then restart the node to let the changed take effect. If you have an existing user you may need to add the medium capability explicitly  using something like oo-admin-ctl-user -l demo --addgearsize medium.

Notes on Getting started with OpenShift

There are two versions of the RedHat Cloud: OpenShift Origin (the project) and OpenShift Enterprise. I needed the completely stable version, so I downloaded the OpenShift from  Navigate to the OpenShift Enterprise page, as shown in Figure 1.

Figure 1. Download OSEoD Virtual Machine

From here I downloaded the OSEoD Virtual Machine, which is a (large) vmdk file. This vm has a 10 Gb hard drive with only a few hunderd Mb of free space on it. On OSX I'm using VirtualBox and to increase this drive you will need to convert it to a vdi format. There is a great detailed writeup by Thomas Vial on this.

1. Convert to vdi:
VBoxManage clonehd box-disk1.vmdk box-disk1.vdi --format vdi

2. Extend to 30 Gb:
VBoxManage modifyhd box-disk1.vdi --resize 30720 
3. Now create a new virtual machine and hook it up to this new large file. Then under the settings for the CD/DVD drive point this to the GParted ISO on your disk. Now when you start the OpenShift VM, GParted is stared and you can extend the sda2 partition, and use all the newly created 20Gb. Now apply to the file system. Then disconnect the GParted iso and restart.

4. Now when the OpenShift VM comes up, sudo to root and now the new space needs to be added to the LVM. Check with 'df' what the LVM partition needs to be extended and use '
'lvm vgdisplay' to get the Free PE and using lvm lvdisplay  you can find the Current LE,
the Current LE + FreePE gives the new volume size. Use lvm lvresize -l  
to resize. Finally use resize2fs to use the new size. Verify with 'df' that the LVM is now larger. For more details see the centos docs.

5. Finally there are two small issues you have to workaround, the /etc/resolve.conf is recreated with every reboot of the server you need to manually add 'nameserver' back in. The other issue is that the harddrive is set to dynamically allocate space. This process slowed down the creation of an application for me such that OpenShift began to lock up. Copying a huge file into the filesystem, and then deleting it to force the allocation fixed that for me.