[Container-tools] Fwd: OpenShift Project Templates for EAP and JWS

John Mark Walker jowalker at redhat.com
Fri Apr 24 14:51:56 UTC 2015


Forwarding this along. Is anyone working with Rob on this? Is there a way to make sure this is "nulecule-compatible" or "nulecule-compliant"?

Will that piece automatically "just work" because it's via OpenShift templates? 

-JM



----- Forwarded Message -----
From: "Rob Cernich" <rcernich at redhat.com>
To: "Cloud Enablement" <cloud-enablement at redhat.com>
Cc: "Ben Parees" <bparees at redhat.com>, "Clayton Coleman" <ccoleman at redhat.com>, "Michal Fojtik" <mfojtik at redhat.com>, "Max Rydahl Andersen" <max.andersen at redhat.com>, "Carl Trieloff" <ctrielof at redhat.com>, "Matt Hicks" <mhicks at redhat.com>, "Heiko Rupp" <hrupp at redhat.com>, "James Strachan" <jstracha at redhat.com>, "John Keck" <jkeck at redhat.com>, "Peter Muir" <pmuir at redhat.com>, "Rodney Russ" <rruss at redhat.com>, "Thomas Heute" <theute at redhat.com>, "Rob Davies" <rdavies at redhat.com>, "James Rawlings" <jrawling at redhat.com>, "Aaron Weitekamp" <aweiteka at redhat.com>, "Daniel Veillard" <veillard at redhat.com>, "Langdon White" <langdon at redhat.com>, "Ian McLeod" <imcleod at redhat.com>, "Christoph Goern" <cgoern at redhat.com>, "Mark Lamourine" <mlamouri at redhat.com>, "John Mark Walker" <jowalker at redhat.com>
Sent: Thursday, April 23, 2015 2:33:20 PM
Subject: OpenShift Project Templates for EAP and JWS

Hey all, (cc'ing the folks involved with the container app spec discussion)

I've finished testing most of the project templates, including the database ones.  I'm using a modified version of the spring-petclinic project, derived from jboss-developer/jboss-wfk-quickstarts.  I made a few modifications to allow selecting the database type from environment variables, added support for postgres, and added jndi resource mapping for eap (jboss-web.xml).  I've tested the following templates: (found here: https://github.com/jboss-integration/cloud-enablement)
 * eap6-basic-sti
 * eap6-mysql-sti
 * eap6-postgresql-sti
 * jws-tomcat7-basic-sti
 * jws-tomcat7-mysql-sti

Note, prior to OSE beta3, you'll need to post-process the processed template, since the current release, v0.4.3, does not yet process template properties used outside env values.  See the readme in the templates folder of the cloud-enablement project.

To use any of the templates, you'll need to first install the image repositories referenced by them:
  openshift cli create -n <your-project> -f templates/jboss-image-streams.json

If you'd like to try one of the basic templates, you'll need to specify the following for the template parameters:
 * GIT_URI: https://github.com/rcernich/jboss-wfk-quickstarts
 * GIT_REF: openshift-test
 * GIT_CONTEXT_DIR: spring-petclinic

If you'd like to give one of the db templates a try (mysql or postgresql), use the same settings above, along with the following additional parameter settings:
 * DB_DATABASE: petclinic
 * DB_JNDI: "java:/jdbc/petclinic" for eap, or "jdbc/petclinic" for jws

...and you'll need to add the following env variables to the application's pod template _after_ processing the template (these are because the project above can be used for either mysql or postgresql, but needs to be configured differently to use them):
 * DB_TYPE: "mysql" or "postgresql"
 * SPRING_PROFILES_ACTIVE: jpa,javaee

DB_TYPE specifies which set of properties should be used by the application (e.g. mysql-data-access.properties).
SPRING_PROFILES_ACTIVE specifies which profiles should be activated.  By default, jpa is active, but you need to add javaee so that it uses jndi to retrieve the datasource instead of using jdbc directly.

You can also use the basic templates with the "stock" jboss-wfk source:
 * GIT_URI: https://github.com/jboss-developer/jboss-wfk-quickstarts
 * GIT_REF: 2.7.x
 * GIT_CONTEXT_DIR: spring-petclinic

A couple of gotchas to watch out for:
 * I've been testing with APPLICATION_NAME=petclinic.  I'm not sure, but the default might cause problems, since it contains a hyphen, which could mess up the db configuration.  If you have issues, specify a name with no hyphens.

 * The sti images are not automatically pulled prior to building.  If you're trying to test a newer sti image, you may need to manually update the image on the minions to make sure the newer image is being used.

 * Tailing the build logs causes problems when OS tries to update the build configuration, which can cause it to spin off another build.  If you see a bunch of builds for your project, stop tailing the logs and it should stop scheduling builds.

Let me know if you have any questions, comments, concerns....

Have fun!

Rob

PS, here's the json for the extra env variables, to make it easier:
{
    "name": "DB_TYPE",
    "key": "DB_TYPE",
    "value": "postgresql"
},
{
    "name": "SPRING_PROFILES_ACTIVE",
    "key": "SPRING_PROFILES_ACTIVE",
    "value": "jpa,javaee"
}




More information about the Container-tools mailing list