Blog

OpenShift: reviewed part 2

30 Nov, 2012
Xebia Background Header Wave

In the previous post I’ve explained in short what OpenShift is about and how you can use it. In this post I’ll go a bit further in how to use the OpenShift origin framework in a private pass environment. I’ll do this by creating an application based on the “Do it yourself” cartridge.
Step 1
Download the OpenShift origin image and install it in a virtual image manager. As virtual image manager you can use kvm or VirtualBox. I’m currently using kvm, as it takes a lot less resources of my system.

Step 2
After you’ve started the image you’ll see that you can directly create an application by ssh’ing to the virtual machine
ssh openshift@$IP_OPENSHIFT_VM
where $IP_OPENSHIFT_VM is the IP address of the virtual machine and the default password is also ‘openshift’. After that you can directly create an application with the RedHat command line tools.
Use the following to create a domain:
rhc domain create -n cloudit -l admin
And to create the first application within the cloudit domain:
rhc app create -a firstapp -t php-5.3

This might look nice, but you actually do not want to give ssh access to all users for that vm.
Step 3
We want to use the RedHat command line tools, local on our machine, and let the OpenShift vm run somewhere on a vmware stack, or some other cloud iaas provider.
To do so, first install the RedHat command line tools local.
After installation run rhc setup
After that you will find under ~/.openshift/ a file named ‘express.conf’. Edit that file with your favorite editor and change the libra_server value with you $IP_OPENSHIFT_VM.
Step 4
You still must add your public ssh key to the OpenShift server by adding:
rhc sshkey add -k ~/.ssh/id_rsa.pub -i host --config ~/.openshift/express.conf
After that you can check your own domain status from your local development machine using:
rhc domain show
Step 5
Now you can create any application on your OpenShift private paas using the command line tools without first using ssh.
So for example you could run:
rhc app create -a deploy -t diy-0.1
which will give you a Do it Yourself application, that can be accessed using your web browser at https://deploy-cloudit.example.com

Step 6. You want to know more?
Join us at the next JBoss Netherlands usergroup event Wed Dec 12: meetup

jdewinne
IT Architect @ Xebia
Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts