OpenShift#


After a failed attempt to run a local cloudfoundry instance with bosh-lite , because my laptop only has 4 GB memory, I started to check out running OpenShift on my own box.
This can be done by running OpenShift origin as a VirtualBox guest.

I also want to try and get the WebSphere Liberty Profile cartridge working.

Resources#

Install VirtualBox and setup the openshift VM.#

First install VirtualBox and then install the prebuilt openshift origin as described in the OpenShift Origin Virtual Machine Deployment Guide. Make sure to set the first network interface to bridging (instead of adding a second interface as described in the doc).
The web console is available at https://10.0.0.171/console, there you can upload your public SSH key, which you need when git-cloning your app.

Set up client tools#

The next thing is installing the client tool , rhc. This can be done with gem install rhc. You do have to setup ruby: sudo apt-get install ruby ruby-gems.

Run rhc setup, this will create ~/.openshift/express.conf

For the OpenShift origin install a user demo with password changeme was created, so will use that one :

Connection to aap-origin.openshift.local closed.
metskem@athena:~/cloud/openshift/apps/aap$ rhc setup
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git are properly installed.

If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for OpenShift Online: openshift.redhat.com.
Enter the server hostname: |openshift.redhat.com| 10.0.0.171

You can add more servers later using 'rhc server'.

The server's certificate is self-signed, which means that a secure connection can't be established to '10.0.0.171'.

You may bypass this check, but any data you send to the server could be intercepted by others.

Connect without checking the certificate? (yes|no): yes
Login to 10.0.0.171: demo
Password: ********

OpenShift can create and store a token on disk which allows to you to access the server without using your password. The key is stored in your home directory and should be kept secret.  You can
delete the key at any time by running 'rhc logout'.
Generate a token now? (yes|no) yes
Generating an authorization token for this client ... lasts about 1 day

Saving configuration to /home/metskem/.openshift/express.conf ... done

Checking for git ... found git version 1.9.1

Checking common problems .. done

Checking for a domain ... origin

Checking for applications ... found 1

  aap http://aap-origin.openshift.local/

  You are using 1 of 100 total gears
  The following gear sizes are available to you: small

Your client tools are now configured.
metskem@athena:~/cloud/openshift/apps/aap$ 

You can also upload your public SSH key via the webconsole, this SSH key is necessary when you git-checkout your application.

Install the Liberty cartridge#

The WebSphere Liberty Cartridge, available at https://github.com/WASdev/cloud.openshift.cartridge.wlp can be installed via the web-console by entering the URL to the manifest file.

This install will fail because the Source-Url element is required. I forked the github project and change the manifest file to include the Source-Url

During this install you also have to create an application, so I created an application called "aap", which is then accessible at http://aap-origin.openshift.local/ , but this gives a 503 error. No idea why.

So further debugging, you can login to the node with the applications generated account and ssh keys :

metskem@athena:~/cloud/openshift/apps/aap$ ssh 54908968653e8a8670000013@aap-origin.openshift.local

    *********************************************************************

    You are accessing a service that is for use only by authorized users.
    If you do not have authorization, discontinue use at once.
    Any use of the services is subject to the applicable terms of the
    agreement which can be found at:
    https://www.openshift.com/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with "rhc app delete"
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.


[aap-origin.openshift.local 54908968653e8a8670000013]\> 
[aap-origin.openshift.local 54908968653e8a8670000013]\> help
Help menu: The following commands are available to help control your openshift
application and environment.

gear            control your application (start, stop, restart, etc)
                or deps with --cart      (gear start --cart mysql-5.1)
tail_all        tail all log files
export          list available environment variables
rm              remove files / directories
ls              list files / directories
ps              list running applications
kill            kill running applications
mysql           interactive MySQL shell
mongo           interactive MongoDB shell
psql            interactive PostgreSQL shell
quota           list disk usage

Deprecated:
ctl_app         control your application (start, stop, restart, etc)
ctl_all         control application and deps like mysql in one command
[aap-origin.openshift.local 54908968653e8a8670000013]\> gear
  NAME:

    ["OpenShift Gear Control"]

  DESCRIPTION:

    ["An assortment of gear utilities"]

  COMMANDS:
	
    activate             Activate a build		
    archive-deployment   Archive the current deployment		
    binary-deploy        Deploy a binary artifact		
    build                Run the build steps		
    create-deployment-dir Create a deployment directory. Should only be used by CI builders		
    deploy               Run the deploy steps		
    deployments          List the gear's deployments		
    distribute           Distribute a build		
    help                 Display global or [command] help documentation.		
    postreceive          Run the git postreceive steps		
    prepare              Prepare a binary deployment artifact for distribution and activation		
    prereceive           Run the git prereceive steps		
    reload               Reload a cart		
    remotedeploy         Run the remotedeploy steps		
    restart              Restart a cart		
    restore              Restore an application		
    rotate-in            Enables this gear to receive traffic from the proxy		
    rotate-out           Disables this gear from receiving traffic from the proxy		
    snapshot             Snapshot an application		
    start                Start the gear/cart		
    status               Get the status for a cart		
    stop                 Stop the gear/cart	

  GLOBAL OPTIONS:
	
    --trace 
        Enable stack traces when reporting errors
	
    -h, --help 
        Display help documentation
	
    -v, --version 
        Display version information
	
    -t, --trace 
        Display backtrace when an error occurs
	
[aap-origin.openshift.local 54908968653e8a8670000013]\> 

And then we find the cause :

[aap-origin.openshift.local 54908968653e8a8670000013]\> gear restart
Cart to restart?
1. liberty-8.5.5
?  1
app is not running
missing Liberty license, set IBM_LIBERTY_LICENSE env var
[aap-origin.openshift.local 54908968653e8a8670000013]\> 

The Liberty Profile License code is L-EWOD-99YA4J which can be found here

Setting environment variables #

To use the Liberty Profile, you have to set an envvar, this can be done with the rhc only:

metskem@athena:~/cloud/openshift/apps/aap$ rhc set-env IBM_LIBERTY_LICENSE=L-EWOD-99YA4J --app aap
Setting environment variable(s) ... done

TODO#

  • find out how to set envvars (for the IBM_LIBERTY_LICENSE = L-EWOD-99YA4J} , must be done with client tool , webUI does not offer this option...