Eric D. Schabell: Software
Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Monday, August 22, 2016

Understanding the 3 kinds of debt haunting your CIO

3 kinds of debt, path to understanding pressures on your CIO
In the modern world we are all familiar with debt.

We all owe a debt to someone.

We all owe a debt of something.

We all owe a debt somewhere.

It can be as simple as debt on your credit card, it can be a large lode stone that the bank puts around your neck when you buy your dream house or it can be as tiny as promises you have made to those that trust you.

There are three kinds of debt that can be haunting your boss at work, your CIO, and understanding what pressures are on her shoulders will help you when pitching your suggestions to the C-level audiences in your organization. In this series I will take a deeper look at the following three kinds of debt that are facing your CIO. It will help you when positioning your projects within your organization and help you to succeed in your C-level interactions.

Technical debt

The typical definition references Ward Cunningham, relating to quick and easy development solutions that require rework later are chosen over more complex solutions that are done right the first time. The idea being that if you do enough of these quick and easy solutions, you are accruing an ever growing pile of technical debt.

If you take this to the level of the CIO, where many of the technical decision eventually are given a final blessing, you are now looking at technical debt that can span more than just a single development solution.

I believe that technical debt is also created when you are implementing infrastructure solutions that will lead to major expensive changes down the road. The difference with technical debt from solutions development and with infrastructure development will be the focus of this topic with a look at why it is a burden on innovation.

Stay tuned for an in depth look in this series at how technical debt is haunting your CIO.

Relationship debt

This kind of debt is less visible in an organization if you don't know how to read the signs. Every CIO has to manage relationships with their suppliers and vendors, though most of these will be of the nature that they are run transactionally through commercial departments like procurement or purchasing.


There will be a few key, or strategic, relationships that the CIO will want to maintain personally to keep a finger on the pulse of the vendors that are delivering the key components to the operation. These can be software or infrastructure or a combination of both, but they will be vital to the personal agenda of your CIO. The question is how can you watch your CIO and have a good understanding of which vendors are the strategic ones and which are just throwing around the word strategic when they visit your organization?

Stay tuned for an in depth look in this series at how relationship debt is haunting your CIO.

Political debt

When you start to understand how your CIO has committed to certain choices within your organization, then you are into the arena of political debt. This is where a CIO has chosen a solution to solve a critical path in her agenda and is going to do all she can to ensure this path is successfully navigated.

Political debt is one that can span technology choices, solution choices, personnel choices and vendor choices that will often not even be the best choices in hindsight. One must tread carefully when dealing with political debt, as they will weigh just as heavily on decision made around your project proposals as any of the other two.

Stay tuned for an in depth look in this series at how political debt is haunting your CIO.

Haunting call

By introducing the three kinds of debt that are haunting in their effect on your CIO, I intend to lay the ground work before diving into a deeper look at each one of these kinds of debt. I will be giving you valuable insights into how you can use this knowledge when positioning your projects, such as Open Source Cloud solutions, JBoss architectures, Cloud Suite, OpenStack or OpenShift strategies to your CIO.

Debt is everywhere, even in your organization, and it's haunting your CIO every single day. Let's make sure you can use these situations to your advantage.

Thursday, September 26, 2013

OpenShift Primer - an example for hosting your awestruct presentations in the cloud

It has never been easier to combine excellent cloud and JBoss technology, like Ruby, that a nifty presentation tool called impress.js, a site generation tooling known as awestruct, and cloud hosting from OpenShift to dazzle at your next presentation.

Introduction

The example I am going to take you through will eventually look just like this site, where you find some of my presentations for the last hear, deployed in a Ruby based OpenShift cloud instance, written using impress.js, and generated by awestruct.

Note that you can browse through the presentations, use the arrows provided in the bottom right corner to walk through the slides, embed your site and presentations anywhere as it is HTML (just use an iframe), and that it is automatically available on all mobile devices without any more adjustments from your side.



Getting started

You will need Git, Ruby, some editor, an OpenShift account, and awestruct installed, you know the basics. I am not going to walk through all of this with you, but assume you can follow these components getting started guides.

What I have done is put together a quickstart to get your site as shown above up and running, which is then a template for adding in your very own presentations. It is giving you a head start, to save some time. Follow along as I walk you through putting this together on your own, first from the web admin console from OpenShift, then from the command line with OpenShift tooling (rhc).

OpenShift web console
You will need to login to OpenShift (http://openshift.com) with your user and create a ruby 1.9 cartridge (not the older ones you might see listed there). Just name it presos and leave the rest to default settings.
Ruby 1.9 cartridge creation.
You will be presented with a getting started screen, with half way down the page instructions for cloning the repository of the instance you just created. You will need to open a console and clone this into your local machine:

$ git clone ssh://5242ecxxxxxxxxx0000aa@presos-inthe.rhcloud.com/~/git/presos.git/

Now change into the presos directory and we will be copying into your repository, the setup I have ready for you in my repository (https://github.com/eschabell/openshift-presos-awestruct/tree/v0.3). Run the following commands.

$ cd presos
$ git remote add upstream -m master git://github.com/eschabell/openshift-presos-awestruct.git
$ git pull -s recursive -X theirs upstream master
$ git push

This will pull down my code into your project, merge the results, then you push it up to your OpenShift instance. Watch the console output as it merges in the new code, installs the required awestruct dependencies, kick starts the server, and you are ready to check out your project online at http://presos-$yourdomain.rhcloud.com.

Command line tooling
Once you have installed the OpenShift command line tooling (just a gem install rhc command for unix based machines), you can do the folowing to get your ruby instance setup and populated with my quickstart project.

$ rhc app create -a presos -t ruby-1.9 --from-code=https://github.com/eschabell/openshift-presos-awestruct.git

This will pull down my code into your project, merge the results, then you push it up to your OpenShift instance. Watch the console output as it merges in the new code, installs the required awestruct dependencies, kick starts the server, and you are ready to check out your project online at http://presos-$yourdomain.rhcloud.com.

Bring it to life

You will notice that the site you are looking at is found in presos/lib/*, here you will need to place your own presentations. Each presentation is represented by a .haml file. This is used to generate the eventual .html file.

$ cat judcon2013_rockstar.html.haml 
---
layout: judconbase
---

.slides
  %section.title(data-state="judcon2013" )
    .title-information
      %h2 Do you want
      %h4 to be a
      %h2 JBoss Rock Star
      %h5
    .title-author
      Eric D. Schabell
      %br
        JBoss Technology Evangelist (Integration & BPM)
      %a{ :href=>"http://twitter.com/ericschabell"}@ericschabell

  %section(data-state="judcon2013" )
    .title-information
    %h1 What does it take?

If we take a closer look at the rockstar presentation haml file, we see that it starts with a layout referencing a base file, in this case called judconbase. We find this is just an included haml file locating in the _layouts directory. Review this for things you might want to adjust for your presentation, but you will note a line that is important which links to a css file where we will set up any images we want to use.

%link{ :rel=>'stylesheet', :type=>'text/css', :href=>"#{site.base_url}/css/theme/judcon.css", :id=>'theme'}

Then you will find a .slides line that starts the slides, here we show only two slides, which are defined using markdown. The data-state attribute is a link to the css file we mentioned above, where if you look there you will find the images used in the slides setup to display as a background, cover, or somewhere inside the slide canvas area.

The easiest way to determine how your changes are affecting the layout of your slides is to run the awestruct command from the lib directory and in daemon mode. This will provide a local server for you to access at http://localhost:4242, and it is auto updated each save of a file in the lib directory.

$ cd presos/lib
$ awestruct -d

By default the build that awestruct is creating is for localhost, but you can adjust the file in presos/lib/_config/site.yml to have several profiles. Just run awestruct with the -P flag and provide one of your profiles to generate a new target site in _site.

Code, deploy, enjoy

The motto is code, deploy, enjoy! I hope this article provides a bit of a helping hand to get you started in pushing your presentations online.

Friday, August 2, 2013

Setup KPN Experia Box for external administration via port fowarding

This is a post in the category, I don't wanna forget this.

To setup your KPN Experia Box (ADSL modem) so that you can manage it from anywhere on the planet:

  1. Access your KPN Experia Box from its LAN (http://192.168.2.254)
  2. Go to Applications -> Port Forwarding
  3. Click on click here to add an application
  4. Give your application a name, like KPNExperiaBox
  5. Choose the ports you want to open, in our case 80, 80, 80, 80 in the four boxes.
  6. Choose Add
  7. In the IP Address field put in the WAN address you will find under Status -> WLAN -> IP field
  8. Choose in the pull down menu the entry you created, KPNExperiaBox
You should now be able to reach the KPN Experia Box administration login page by putting the step #7 WAN IP address into your browser.

Wednesday, June 6, 2012

OpenShift Primer Demo - Drools Planner rises to new heights in the Clouds

The following demo is an OpenShift World Premier for the Drools Planner Project.

I am a fan of the Drools Planner project and know the lead Geoffrey for some time now. I have always wondered why this project was not showcasing in an OpenShift demo and we got to chatting about it. I promised to provide the HowTo if he would push me a working WAR file, which he did that same night.

The demo is available live online here: http://droolsplanner-onthe.rhcloud.com/droolsplanner

Here is how to run the demo application from any OpenShift instance, which will highlight a vehicle routing (planning) problem that optimizes and refreshes your browser every few seconds. Note that the performance is a bit slower to resolve the problem than on a local machine, but that is just the limiting resources that have been allocated to my OpenShift instance.


Drools Planner on OpenShift Express



Installing the Drools Planner tool on OpenShift was never easier!

Running on OpenShift

Create an account at http://openshift.redhat.com/
Create a jbossas-7 application
rhc app create -a droolsplanner -t jbossas-7
Add this upstream openshift-droolsplanner repo
cd droolsplanner
git remote add upstream -m master git://github.com/eschabell/openshift-droolsplanner.git
git pull -s recursive -X theirs upstream master
# note that the git pull above can be used later to pull updates.
Then push the repo upstream
git push
That's it, you can now checkout your application at:
http://droolsplanner-$your_domain.rhcloud.com/droolsplanner


You too can now be a Planner in the Clouds in minutes! ;-)


Tuesday, January 10, 2012

jBPM5 - add native Eclipse BPMN2 Visual Editor to Eclipse or JBoss Developer Studio

Eclipse Native BPMN2 Editor
Interested in using the Eclipse native BPMN2 editor when designing your jBPM processes? Here is how you can pull in the project that is now hosted within the Eclipse Foundation.
Figure 1: Name the update site.

First you need to add the update site at Help -> Install New Software -> Add as shown in Figure 1. Then you give it a name as shown in Figure 2.

http://download.eclipse.org/bpmn2-modeler/site

Figure 2: Watch install.
This will pull up the BPMN2 Editor check box that you can select to install the editor. Just select this box and select Next + Next + Accept agreement + Finish.

Figure 3: Open with Visual Editor
Watch the software install, see Figure 2 and a restart will give you the option to use the Eclipse Native BPMN2 editor. Select a process.bpmn2 file, right mouse click, select Open With and you should see the menu entry BPMN2 Visual Editor.


Note:
A note about the processes to be displayed. If you do not have any location information in the file, such as a default generated jBPM Migration Tool conversion output file, then it will not display in this editor. The jBPM Migration Tool relies on the BPMN2 Process Editor and its Arrange buttons to generate this information.

Enjoy! ;-)

Taking screenshots on an OS X Macbook

I was looking for the various ways to make a screenshot on my macbook and wanted to log these for future reference.


Each capture sequence below saves a file to your desktop, unless you add a Control key to any sequence which will give you the capture as a copy to the clipboard.

Also see the Grab utility for more complex captures, including recording desktop activities.


  • Entire desktop - Cmd + Shift + 3
  • Specific area - Cmd + Shift + 4, gives crosshairs that can be positioned for click and drag
  • Single window - Cmd + Shift + 4 + Spacebar, gives a camera that highlights windows to be captured


Friday, January 6, 2012

Released jBPM Migration Tooling v0.11


Right behing release the previous release we have pushed out jBPM Migration Tooling v0.11.

Wow, you must be thinking this team is working really hard and must not be getting any sleep at all! Nothing could be further from the truth. We are just getting integrated into the JBoss family way of working with regards to releasing a project into the wild.

We were missing some necessary components that need to be generated by our Maven configuration so that we were allowed through the JBoss Nexus process. When jbpmmigration-0.10 failed to meet the Nexus standards, we are forced to restart the process and therefore you now can be the proud owners of jbpmmigration-0.11! ;-)

The change log can be found on the project wiki, but for posterity it is provided here:
  • update the project POM file to generate a sources jar, needed to deploy into JBoss Nexus.
The OpenShift jBPM Migration WebApp has been updated to run with the current release, http://jbpmmigration-ishereon.rhcloud.com/jbpmmigration_upload-0.4.

Enjoy!

Wednesday, January 4, 2012

Released jBPM Migration Tooling v0.10

A new year and a new version is appropriate, don't you think? :-)

The jBPM Migration Tooling project is happy to release v0.10 into the wild, you can get it from github and soon in the JBoss Nexus repository.

The change log can be found on the project wiki, but for posterity it is provided here:
  • issue 41 resolved, unique ids for context variables.
  • issue 42 resolved, added ability to select xsd to use for conversion, default is jpdl 3.2.
  • issue 43 resolved, adjusted stylesheet usage in migration class.
  • issue 44 resolved, added JbpmMigration test class.
  • issue 46 & 47 resolved, cleaned up api for JpdlValidation and BpmnValidation classes.
  • issue 48 resolved, test output is now sorted in the directories related to the called tests, provides overview of all migration test output after a testing run, was over writing previously.
  • issue 51 resolved, pom adjusted to provide an optional cli jar (more dependencies included in resulting jar).
  • issue 52 resolved, fixed gateway nodes to provide gatewayDirection attributed needed by some editors to correctly display.
  • maven pom adjustments for JBoss jBPM team jenkens setup.
The OpenShift jBPM Migration WebApp has been updated to run with the current release, http://jbpmmigration-ishereon.rhcloud.com/jbpmmigration_upload-0.3/.


Enjoy!

Wednesday, October 5, 2011

jBPM Migration Tooling available in the OpenShift Cloud!

After our latest evening of coding on the jBPM Migration project we were able to fix quite a few bugs and pushed a web based jBPM Migration application into the cloud that enables everyone to play with the migration tooling right now!

I admit, it is in a crude form, but I am a fan of release early (if not often due to real life!). We will be massaging this to spiffy it up a bit, but the idea is there. You can upload your jBPM 3.2 process definition file (processdefinition.xml) and on the results page you will find a copy of your jPDL and below that the resulting BPMN2 XML. This is not formatted, but you can paste it into your IDE for formatting, viewing in the diverse jBPM5 editor tools and verify your process is migrated.

Even better, you can replicate this setup by following our Readme in the jBPM Migration Upload project. The basic steps to setup an OpenShift JBoss AS 7 instance and deploy the jBPM Migration Tool is as follows:

jBPM Migration Tooling on OpenShift Express
Installing the jBPM Migration tool on OpenShift was never easier! This git repository helps you get up and running quickly with the jBPM Migration Tooling.

# Running on OpenShift.
# Create an account at http://openshift.redhat.com/
#
# Create a jbossas-7.0 application
#
$ rhc-create-app -l $username -a jbpmmigration -t jbossas-7.0

# Add this upstream openshift-jbpmmigration repo.
#
$ cd jbpmmigration
$ git remote add upstream -m master git://github.com/eschabell/openshift-jbpmmigration.git
$ git pull -s recursive -X theirs upstream master
    
# Then push the repo upstream.
#
$ git push

That's it, you can now checkout your application at: http://jbpmmigration-$your_domain.rhcloud.com/jbpmmigration_upload-0.1

Usage notes: You can submit a jBPM jPDL 3.2 process definition as an xml file upload, the resulting page will show you first your submitted file (if all goes well) and the resulting BPMN2 process definition. This can be cut and paste into your IDE for formatting and testing against the jBPM5 editor(s).

I will be discussing this tooling at JUDCon in London and the London JBUG, drop by and we can chat about it. For now, get busy and start testing your process definitions before migration to jBPM5! ;-)

OpenShift Express - how to get started with ZendFramework

I was looking to upgrade a rough draft article in the Express forums and place it into a structured git repo howto form so I put the following together. You can follow the Readme file to push this into your very own OpenShift Express instance!








# Create an account at http://openshift.redhat.com/
#
# Create a php-5.3 application.
#
$ rhc-create-app -l $username -a zendphp -t php-5.3

# Add this upstream zendphp repo.
#
$ cd zendphp
$ git remote add upstream -m master git://github.com/eschabell/openshift-zendframework.git
$ git pull -s recursive -X theirs upstream master
# note that the git pull above can be used later to pull updates to zendphp

# Then push the repo upstream.
#
$ git push

That's it, you can now checkout your application at: http://zendphp-$your_domain.rhcloud.com, easy isn't it! ;-)

Wednesday, September 28, 2011

Fedora 15 - Chrome 14.x won't start for you?

I was having this problem after and update and first ran it from the console to find out what the problem was:





# running google-chrome from the command line.
#
$ google-chrome

/opt/google/chrome/chrome: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied

# seems this is due to some permission errors, so you can run chrome 
# without the sandbox...
#
$ google-chrome --no-sandbox

# ...or you can fix the permission problem by turning it off.
#
$ sudo setenforce 0

Hope this helps you get back into your Chrome experience! ;-)

Saturday, September 3, 2011

Live PHP demo: The OpenShfit Babygame is available in the Cloud!

I wanted to run through how to push a simple PHP application that used a MySQL database into the new OpenShift Express environment. Follow along as we show you how to do it.

You can jump right to the OpenShift Babygame if you can't wait to see it live at: http://babygame-ishereon.rhcloud.com/babygame.php.

 We will assume you have registered a user at http://www.openshift.com.


Get Babygame code
First step is to pull a copy of the BabyGame from github.

Next you will want to setup your client tools for OpenShift access as outlined in their Quick Start. I am running Fedora 15 so just had to add the yum repo and install rhc. This brings us to the point of actually getting into setup of our applications new home.

Create your domain
# We need to create the domain for Express to start setting up
# our URL with the client tooling using 
# rhc-create-domain -n domainname -l rhlogin
#
$ rhc-create-domain --help

Usage: /usr/bin/rhc-create-domain
Bind a registered rhcloud user to a domain in rhcloud.

  NOTE: to change ssh key, please alter your ~/.ssh/libra_id_rsa and
        ~/.ssh/libra_id_rsa.pub key, then re-run with --alter

  -n|--namespace   namespace   Namespace for your application(s) (alphanumeric - max 16 chars) (required)
  -l|--rhlogin     rhlogin     Red Hat login (RHN or OpenShift login with OpenShift Express access) (required)
  -p|--password    password    RHLogin password (optional, will prompt)
  -a|--alter                   Alter namespace (will change urls) and/or ssh key
  -d|--debug                   Print Debug info
  -h|--help                    Show Usage info

# So we setup one for the Babygame. Note that I already have setup my ssh keys for OpenShift,
# if you have not yet done that, then it will walk you through it.
#
$ rhc-create-domain -n ishereon -l [registered-user] -p [your-password]

OpenShift Express key found at /home/[homedir]/.ssh/libra_id_rsa.  Reusing...
Contacting https://openshift.redhat.com
Creation successful

You may now create an application.  Please make note of your local config file
in /home/[homedir]/.openshift/express.conf which has been created and populated for you.


Create your application
Next we want to create our application, which means we want to tell the OpenShift Express which stack we need. This is done with the rhc-create-app client tool.

# Let's take a look at the options available before we setup a php stack for
# our babygame app.
#
$ rhc-create-app --help
Contacting https://openshift.redhat.com to obtain list of cartridges...
 (please excuse the delay)

Usage: /usr/bin/rhc-create-app
Create an OpenShift Express app.

  -a|--app   application     Application name  (alphanumeric - max 16 chars) (required)
  -t|--type  type            Type of app to create (perl-5.10, jbossas-7.0, wsgi-3.2, rack-1.1, php-5.3) (required)
  -l|--rhlogin  rhlogin      Red Hat login (RHN or OpenShift login with OpenShift Express access) (Default: xxxxxxxxx)
  -p|--password  password    RHLogin password  (optional, will prompt)
  -r|--repo  path            Git Repo path (defaults to ./$app_name)
  -n|--nogit                 Only create remote space, don't pull it locally
  -d|--debug                 Print Debug info
  -h|--help                  Show Usage info

# It seems we can choose between several but we want the php-5.3 
# stack (called a cartridge). I provide a user, password and location 
# for the git repo to be created called 'babygame-express', see the 
# documentation for the defaults. Let's watch the magic happen!
#
$ rhc-create-app -a babygame -t php-5.3 -l [registered-user] -p [password] -r /home/[homedir]/git-projects/babygame-express

Found a bug? Post to the forum and we'll get right on it.
    IRC: #openshift on freenode
    Forums: https://www.redhat.com/openshift/forums

Attempting to create remote application space: babygame
Contacting https://openshift.redhat.com
API version:    1.1.1
Broker version: 1.1.1

RESULT:
Successfully created application: babygame

Checking ~/.ssh/config
Contacting https://openshift.redhat.com
Found rhcloud.com in ~/.ssh/config... No need to adjust
Now your new domain name is being propagated worldwide (this might take a minute)...
  retry # 1 - Waiting for DNS: babygame-ishereon.rhcloud.com
  retry # 2 - Waiting for DNS: babygame-ishereon.rhcloud.com
  retry # 3 - Waiting for DNS: babygame-ishereon.rhcloud.com
  retry # 4 - Waiting for DNS: babygame-ishereon.rhcloud.com
Pulling new repo down
Warning: Permanently added 'babygame-ishereon.rhcloud.com,174.129.64.40' (RSA) to the list of known hosts.
Confirming application babygame is available
  Attempt # 1

Success!  Your application is now published here:

      http://babygame-ishereon.rhcloud.com/

The remote repository is located here:

    ssh://14b02b5262ce41daba2a70ad4b01657b@babygame-ishereon.rhcloud.com/~/git/babygame.git/

To make changes to your application, commit to /home/[homedir]/git-projects/babygame-express/.
Then run 'git push' to update your OpenShift Express space

If we take a look at my given path to the repo we find a git-projects/babygame-express git repository! Note that if you decide to alter your domain name you will have to adjust the git repository config file to reflect where the remote repository is, see above the line with 'ssh:.....'. Also the page is already live at http://babygame-ishereon.rhcloud.com/, how about that!

It is just a splash screen to get you started, so now we move on to getting the babygame running.

First lets look at the provided README in our babygame-express project which gives some insight to the repository layout.

Repo layout
===========
php/ - Externally exposed php code goes here
libs/ - Additional libraries
misc/ - For not-externally exposed php code
../data - For persistent data (full path in environment 
             var: OPENSHIFT_DATA_DIR)
deplist.txt - list of pears to install
.openshift/action_hooks/build - Script that gets run 
               every push, just prior to starting your app

The babygame app also comes with a README file that states we need to just add the babygame.php, const.inc.php, introtext.php, and *.jpg files to a webserver, so we will place these in the git repository that was created into the php directory.

# placing our application into our express git repo.
#
$ cp babygame/babygame.php git-projects/babygame-express/php/
$ cp babygame/const.inc.php git-projects/babygame-express/php/
$ cp babygame/introtext.php git-projects/babygame-express/php/
$ cp *.jpg git-projects/babygame-express/php/

# lets see what is going on in our project, for git commands please refer to git online help.
#
$ git st

# On branch master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#	php/babyblue.jpg
#	php/babygame.php
#	php/babypink.jpg
nothing added to commit but untracked files present (use "git add" to track)

# now we need to add, commit and push them to the master repo.
#
$ git add php/*.jpg php/*.php
$ git st

# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	new file:   php/babyblue.jpg
#	new file:   php/babygame.php
#	new file:   php/babypink.jpg
#	new file:   php/introtext.php
#	new file:   php/const.inc.php
#

$ git commit -m "Added babygame and images."

[master 8b73d1a] Added babygame and images.
 3 files changed, 364 insertions(+), 0 deletions(-)
 create mode 100644 php/babyblue.jpg
 create mode 100644 php/babygame.php
 create mode 100644 php/babypink.jpg

$ git push origin
Counting objects: 8, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 10.48 KiB, done.
Total 6 (delta 1), reused 0 (delta 0)
remote: Stopping application...
remote: Waiting for stop to finish
remote: Done
remote: Running .openshift/action_hooks/build
remote: Starting application...
To ssh://14b02b5262ce41daba2a70ad4b01657b@babygame-ishereon.rhcloud.com/~/git/babygame.git/
   ff8218d..8b73d1a  master -> master

Now we should be able to find our application online at http://babygame-ishereon.rhcloud.com/babygame.php.


Some cleanup
# clean out the default files.
#
$ git rm php/index.php

rm 'php/index.php'

$ git rm php/health_check.php

rm 'php/health_check.php'

$ git st

# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	deleted:    php/health_check.php
#	deleted:    php/index.php
#

$ git commit -m "Removed default files."

[master 820db4f] Removed default files.
 0 files changed, 0 insertions(+), 2 deletions(-)
 delete mode 100644 php/health_check.php
 delete mode 100644 php/index.php  (100%)

$ git push origin
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 384 bytes, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Stopping application...
remote: Waiting for stop to finish
remote: Done
remote: Running .openshift/action_hooks/build
remote: Starting application...
To ssh://14b02b5262ce41daba2a70ad4b01657b@babygame-ishereon.rhcloud.com/~/git/babygame.git/
   8b73d1a..820db4f  master -> master
Babygame without a database

Setup mySQL database on OpenShift
So for now we have our project on line, but the MySQL database needs to be setup. The babygame without a database is just a bunch of garbled layout and empty tables. We can't have that now can we?

Let's get our mySQL database setup on OpenShift.

# First we need to add the mysql database instance to our Express instance,
# by making use of the rhc-ctl-app client tool.
#
$ rhc-ctl-app --help

Usage: /usr/bin/rhc-ctl-app
Control an OpenShift express app

  -a|--app   application   Application name  (alphanumeric) (required)
  -l|--rhlogin rhlogin     Red Hat login (RHN or OpenShift login with OpenShift Express access) (Default: xxxxxx)
  -p|--password password   RHLogin password  (optional, will prompt)
  -c|--command command     (start|stop|restart|reload|status|destroy)
  -L|--embedded-list       List supported embedded cartridges
  -e|--embed               (add-$cartridge|remove-$cartridge) eg: add-mysql-5.1
  -b|--bypass              Bypass warnings
  -d|--debug               Print Debug info
  -h|--help                Show Usage info

# now lets add the mysql-5.1 embedded cartridge.
#
$ rhc-ctl-app -a babygame -l [registered-user] -p [password] -e add-mysql-5.1

Contacting https://openshift.redhat.com
Contacting https://openshift.redhat.com
API version:    1.1.1
Broker version: 1.1.1

RESULT:

Mysql 5.1 database added.  Please make note of these credentials:

   Root User: admin
   Root Password: XXXXXXXXX
   Database Name: babygame

Connection URL: mysql://XXX.X.X.X:3306/

Now we need to add the const.inc.php file and adjust to reflect the proper db variables. So we adjust this and push the file to our repo.

# edit our const.inc.php file to add mysql database info and set the initial birth dates.
#
$ cat const.inc.php

[skip boring parts]
// Database settings.
//
define( "DB_SERVER",    $_ENV['OPENSHIFT_DB_HOST'] );
define( "DB_USER",      $_ENV['OPENSHIFT_DB_USERNAME'] );	
define( "DB_PASSWORD",  $_ENV['OPENSHIFT_DB_PASSWORD'] );	
define( "DB_DATABASE",  "babygame" );	


# Add the config file, push to repo.
#
$ git add php/const.inc.php; git commit -m "Added mysql config file."; git push origin

[master b7f9973] Added mysql config file.
 1 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 php/const.inc.php
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 778 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Stopping application...
remote: Waiting for stop to finish
remote: Done
remote: Running .openshift/action_hooks/build
remote: Starting application...
To ssh://14b02b5262ce41daba2a70ad4b01657b@babygame-ishereon.rhcloud.com/~/git/babygame.git/
   820db4f..b7f9973  master -> master


Managing your mySQL database
One problem I had was that the database was created, but not the table 'guesses' that I needed. To achieve this I had to put some configuration changes into the build script that runs on each push to the repo (causing a fresh deploy of your application).

# addded this to my .openshift/action_hooks/build file in 
# the babygame project.
#
set -e

if [ -z $OPENSHIFT_DB_HOST ]
then
    echo 1>&2
    echo "Could not find mysql database.  Please run:" 1>&2
    echo "rhc-ctl-app -a $OPENSHIFT_APP_NAME -e add-mysql-5.1" 1>&2
    echo "then make a sample commit (add whitespace somewhere) and re-push" 1>&2
    echo 1>&2
    exit 5
fi

# check for database.
if ! /usr/bin/mysql -u "$OPENSHIFT_DB_USERNAME" --password="$OPENSHIFT_DB_PASSWORD" -h "$OPENSHIFT_DB_HOST" -e "show tables;" $OPENSHIFT_APP_NAME > /dev/null
then
    echo 1>&2
    echo "Could not find mysql database. " 1>&2
    echo "Creating database for application named: $OPENSHIFT_APP_NAME." 1 >&2
    /usr/bin/mysqladmin -u "$OPENSHIFT_DB_USERNAME" --password="$OPENSHIFT_DB_PASSWORD" -h "$OPENSHIFT_DB_HOST" create "$OPENSHIFT_APP_NAME"
fi

# Confirm database exists, if not create it
if ! /usr/bin/mysql -u "$OPENSHIFT_DB_USERNAME" --password="$OPENSHIFT_DB_PASSWORD" -h "$OPENSHIFT_DB_HOST" -e "select * from guesses;;" "$OPENSHIFT_APP_NAME" > /dev/null
then
    echo
    echo "Schema not found!  Importing schema from .openshift/action_hooks/baby.sql"
    echo
    /usr/bin/mysql -u "$OPENSHIFT_DB_USERNAME" --password="$OPENSHIFT_DB_PASSWORD" -h "$OPENSHIFT_DB_HOST" "$OPENSHIFT_APP_NAME" < "$OPENSHIFT_REPO_DIR/.openshift/action_hooks/baby.sql"
    echo
    echo "done."
else
    echo "Database found, skipping import."
fi

Fully configured babygame!
If you look closely you will see that I also added the baby.sql file in the same directory so that the 'guesses' table is created if needed. Now we fire up the application and add a guess!

This completes the migration of the original PHP Babygame application from a local installation to the cloud with OpenShift Express!

I will be pushing this project soon to github at https://github.com/eschabell.

Happy guessing! :-)

Thursday, July 21, 2011

Fedora 15 - howto set default application for open document formats to LibreOffice

My new installation of Fedora 15 seems to have a problem finding the right application to start for all the OpenOffice or open document formatted files. She needs to be using Libreoffice, but starts Calibre app on my machine. The standard assignment of default applications via System Settings is only for a small set of applications, so you need to dive into the configuration files like this:


# Fix system wide in /usr/share/applications/defaults.list

# by changing all 'openoffice.org' entries into 'libreoffice'

# with for example in VIM this cmd:

#

:%s:openoffice.org:libreoffice:g



# Fix in local user settings with ~/.local/share/applications/mimeapps.list

# but you will most likely need to copy the above entries into

# your local settings.

Wednesday, July 6, 2011

Fedora 15 - how to get 8GB of RAM recognised in 32 bit installation

When adding to the original 4GB of RAM my laptop had I wanted to max it out to 8GB. Off to the shop, purchased and installed 2x 4GB cards and booted it up. The Bios recognises 8GB out of the box, but Fedora 15 does not with the default 32bit kernel. You need to install the following packages:

# install PAE kernel.
#
$ sudo yum install kernel-PAE kernel-PAE-devel

Once I did this, rebooted and you can see the memory is recognised:

# memory shown for 8GB after PAE kernel installed.
#
$ free
             total       used       free
Mem:       8154348    5368672    2785676


$ grep MemTotal /proc/meminfo
MemTotal:        8154348 kB

Now my Java efforts are rocket fast on this machine!

Friday, June 17, 2011

Fedora 15 Gnome 3 power user tips

I know you can find all of these out there on the Internet, but I don't want to have to search for all of them again so my collection of power user tips are collected here. Note that these are not 'extensions' but just basic tooling or configuration adjustments that are pretty well hidden from you by default:

# I want to see the date on my desktop clock.
#
$ gsettings set org.gnome.shell.clock show-date true


# If you want to modify your menu and create launchers
# just install Alacare. For example, you can use this
# to create Power Off and Reboot buttons in your menu.
#
$ sudo yum install alacarte


# I want the right-hand top of app buttons back. Install
# the 'gnome-tweak-tool' and you'll find the app under 
# 'Accessories > Tweak Advanced Settings.'
#
$ sudo yum install gnome-tweak-tool


# Click on Shell, then select "Arrangement of buttons on 
# title bar" - All. Log out and on login your buttons are
# back.
#

# Use the gnome-tweak-tool to get your Desktop icons back.
# Click on 'File Manager' and turn on "have file manager 
# handle the desktop". Now the usual icons are back, plus 
# anything you want to add to Desktop.
#

# Alternative to the Power off button.
#
$ sudo yum install gnome-shell-extensions-alternative-status-menu


# An alternative window manager Avant. Once installed try 
# opening a terminal and launch it: "avant-window-navigator"
# Get it into the start-up: Click on the avant-window-navigator
# icon and play with the many options. Down at the bottom, 
# under General, there's "start Awn automatically". Reboot
# and test.
#
$ yum install avant-window-navigator awn-extras-applets


# Add theme functionality to your Gnome Shell.
#
$ sudo yum install gnome-shell-extensions-user-theme

Saturday, May 28, 2011

Fedora 15 screen casting with Gnome 3

GNOME 3 has embedded software that allows you to record your desktop. This makes it very easy to create a screencast in GNOME 3.

Start/stop recording your GNOME 3 Desktop by pressing the Ctrl+Shift+Alt+R key combination.

The first time when you press this key combination, GNOME 3 will start recording your Desktop. A red circle is displayed in the bottom right corner of the screen when the recording is in progress. Pressing the same key combination a second time will stop the recording.

After the recording is finished, a file named 'shell-%d%u-%c.webm' is saved in the home directory. In the filename, %d is the date, %u is a string that makes the filename unique, and %c is a counter that is incremented each time a recording is made within a single gnome-shell session. The recording is saved in the WebM format.

Now we can do our Red Hat JBoss screencasts without much trouble, but next step is to get audio track included. ;-)


Friday, May 27, 2011

Upgrade Fedora 14 to Fedora 15 howto

This upgrade when smoother than any so far, did not lose any Network settings for example! This is all you need to do:

# As root you would like to have a clean start to the
# upgrade, so get an update out of the way.
#
$ yum update rpm

$ yum -y update

$ yum clean all

# Should a new kernel install/update require it,
# reboot before continuing with the rest.
#
# Then install the preupgrade package.
#
$ yum install preupgrade

# For console upgrade, use:
#
$ preupgrade-cli "Fedora 15 (Lovelock)"

# If you like gui's to upgrade, use this.
#
$ preupgrade

That was it, just watch the action, drink some coffee/beer and reboot when asked to. Presto change-o you now have a Fedora 15 installation!

Monday, February 7, 2011

Eclipse Helios and JBoss Tools from Eclipse Marketplace missing jBPM designer tooling

I mostly use the JBoss Developer Studio which integrates all my JBoss Tooling in a painless Eclipse experience, so it has been some time since I looked at a vanilla Eclipse version.

Since I have heard a lot about Eclipse Marketplace I thought I would install Eclipse Helios and try to work on my jBPM Migration project as a test. After the installation I went to the Eclipse Marketplace:

Help -> Eclipse Marketplace...

I installed Git, Subversive and JBossTools, but when I imported my project and tried to view a jBPM process I suddenly only have an XML viewer and not the usual jBPM Graphical Process Designer.

It appears that the feature org.jbpm.gd.jpdl.feature is missing from the tooling there.

To fix this we need the jBPM3 features, that can be found by installing new Eclipse software as follows:

Help -> Install New Software... -> (in pulldown menu select jbosstools updates development site) -> (in window appears) All JBoss Tools 3.2.0 -> open this and select jBPM3 Tools Runtime

Once this finishes and restarts Eclipse you will be ready to go!

Thursday, December 23, 2010

Firefox tip - how to turn off the Downloads Complete popup

Figure 1: about:config
I was getting real tired of the pop-ups in Firefox telling me that the file download just completed. To turn these off just us the about:config page as shown in figure 1 to set the highlighted variable in figure 1 to false. You can toggle this setting by just clicking on the line.

The less interruptions, the less context switching, the easier it is to concentrate on the code you are working on! ;-)

Monday, December 20, 2010

JBoss Developer Studio - remove Spring support and live Spring free

I am not a Spring developer, so why should I put up with it in my Eclipse IDE of choice? A friend of mine pointed me to the stuff that needs to be drop-kicked-without-backspin:

# We just want to remove all the plugin and feature stuff that is
# related to Spring.
#
$ cd ~/jbdevstudio/studio/eclipse/plugins

$ ls -l | grep spring

# This displays about 90 jar files related to Spring tooling, just 
# dump them as follows.
#
$ rm com.springsource*

$ rm org.jboss.tools.vpe.spring*

$ rm org.springframework*

# Now we need to remove the features directories related to 
# Spring.
#
$ cd ../features

$ ls -l | grep spring

# This displays about 7 directories containing Spring tooling, just 
# dump them as follows.
#
$ rm -rf org.springframework*

That was all there was to it. Now fire up your streamlined IDE and enjoy a Spring fee existence!