OpenShift#
Table of Contents
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#
- OpenShift docu index
- OpenShift Origin User’s Guide
- OpenShift Administration Guide
- OpenShift Origin Virtual Machine Deployment Guide
- WebSphere Liberty Profile cartridge
- OpenShift Console
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
And you can show the current one with :
metskem@athena:~/cloud/openshift/apps/aap$ rhc env-list aap IBM_LIBERTY_LICENSE=L-EWOD-99YA4J
Miscelleaneous#
start a cartridge#
metskem@athena:~/cloud/openshift/apps/aap$ rhc cartridge-start 'ibm-liberty-8.5.5' --app aap Starting ibm-liberty-8.5.5 ... Failed to execute: 'control start' for /var/lib/openshift/54908968653e8a8670000013/liberty
Starting with webconsole:
app is not running generated VCAP_APPLICATION={"host":"127.3.250.1"} generated VCAP_SERVICES={} Liberty for Java(TM) (WAR, liberty-8.5.5_4, ibmjdk-1.7.1_1) -----> Liberty Buildpack Version: 1a2d464 | https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git#1a2d464
You have not accepted the IBM JVM License.
Visit the following uri: https://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=&li_formnum=L-EWOD-99YA4J&title=IBM%C2%AE+SDK%2C+Java+Technology+Edition%2C+Version+7+Release+1&l=en Extract the license number (D/N:) and place it inside your manifest file as a ENV property e.g. ENV: IBM_JVM_LICENSE: {License Number}. E, [2014-12-17T04:35:14.623818 #2375]
ERROR -- /var/lib/openshift/54908968653e8a8670000013/liberty/ibm-websphere-liberty-buildpack/lib/liberty_buildpack/buildpack.rb:49:in `rescue in drive_buildpack_with_logger': Compile failed with exception RuntimeError
Failed to execute: 'control restart' for /var/lib/openshift/54908968653e8a8670000013/liberty
add other cartridges#
Adding MySQL as an extra cartridge:
MySQL 5.5 database added. Please make note of these credentials:
Root User: adminBly53La
Root Password: 3R-GznLXkfSR
Database Name: aap
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
You can manage your new MySQL database by also embedding phpmyadmin.
The phpmyadmin username and password will be the same as the MySQL credentials above.
Jenkins created successfully. Please make note of these credentials: User: admin Password: MgRSUwaXVm4e Note: You can change your password at: https://jenkins-origin.openshift.local/me/configure
destroy/delete an app#
metskem@athena:~/cloud/openshift/apps$ rhc app-delete aap This is a non-reversible action! Your application code and data will be permanently deleted if you continue! Are you sure you want to delete the application 'aap'? (yes|no): yes Deleting application 'aap' ... deleted
install app with ibm-libert-8.5.5 cartridge :#
metskem@athena:~/cloud/openshift/apps$ rhc create-app aap https://raw.githubusercontent.com/metskem/cloud.openshift.cartridge.wlp/master/metadata/manifest.yml -e IBM_LIBERTY_LICENSE=L-EWOD-99YA4J
The cartridge 'https://raw.githubusercontent.com/metskem/cloud.openshift.cartridge.wlp/master/metadata/manifest.yml' will be downloaded and installed
Application Options
-------------------
Domain: origin
Cartridges: https://raw.githubusercontent.com/metskem/cloud.openshift.cartridge.wlp/master/metadata/manifest.yml
Gear Size: default
Scaling: no
Environment Variables: IBM_LIBERTY_LICENSE=L-EWOD-99YA4J
Creating application 'aap' ...
generated VCAP_APPLICATION={"host":"127.7.136.129"}
generated VCAP_SERVICES={}
Liberty for Java(TM) (WAR, liberty-8.5.5_4, ibmjdk-1.7.1_1)
-----> Liberty Buildpack Version: 1a2d464 | https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git#1a2d464 You have not accepted the IBM JVM License. Visit the following uri:
https://www14.software.ibm.com/cgi-bin/weblap/lap.pl?la_formnum=&li_formnum=L-EWOD-99YA4J&title=IBM%C2%AE+SDK%2C+Java+Technology+Edition%2C+Version+7+Release+1&l=en Extract the license number (D/N:)
and place it inside your manifest file as a ENV property e.g. ENV: IBM_JVM_LICENSE: {License Number}. E, [2014-12-17T05:00:45.215174 #8644] ERROR --
/var/lib/openshift/54915422653e8a867000003e/liberty/ibm-websphere-liberty-buildpack/lib/liberty_buildpack/buildpack.rb:49:in `rescue in drive_buildpack_with_logger': Compile failed with exception
RuntimeError
downloading buildpack
Failed to execute: 'control start' for /var/lib/openshift/54915422653e8a867000003e/liberty
So, I also have to accept a JVM license apparently....wait...
Register with OpenShift Online#
After trying for a couple of hours, I could not get the Liberty cartridge working op OpenShift origin, the Liberty servers just doesn't seem to start, no logs whatsoever, so let's give a try to the Online version at RedHat
.
