Friday, June 20, 2014

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 https://access.redhat.com/home.  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 127.0.0.1' 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.






No comments: