- After creating a Do It Yourself (DIY) application on your OpenShift Express account
- I logged in to the application using SSH using the bash provided by OpenShift
- We need to download and install Jetty now, the real thing here is that we will not have write permissions on any folder other than “data”, “repo” and “tmp”.
- I preferred to use the “data” folder because its persistent folder across Git pushes, the Git pushes always refreshes the contents inside the “repo” folder, and “tmp” folder is wiped off in 7-10 days time if there is not modification so i resorted to “data” the best folder for us to install Jetty/Tomcat
- Do a curl or wget to download and install Jetty
- As per OpenShift rules/constraints we need to use $OPENSHIFT_INTERNAL_IP and 8080 as the port for the server to make our applications available over the internet
- For Jetty we need to edit the $JETTY_HOME/etc/jetty.xml and edit the Connectors as follows,
…..
<Setname="connectors"><Arraytype="org.mortbay.jetty.Connector"><Item><Newclass="org.mortbay.jetty.nio.SelectChannelConnector"><Setname="host"><SystemPropertyname="jetty.host"/>$OPENSHIFT_INTERNAL_IP</Set><Setname="port"><SystemPropertyname="jetty.port"default="8080"/></Set>...</New></Item></Array></Set>
….
8. I then made a small startJetty.sh script where I added a JVM arg as shown below,
java -DSTOP.PORT=$STOP_PORT -jar $JETTY_HOME/start.jar
$STOP_PORT – for now can have only few port values that OpenShift are allowed us bind to something like mysql (3306) port, postgresql(5432) port, mongodb(27017) port ,we need to make a decision here on which port to use based on the list of unused ports that OpenShift allows us to bind to.
Viola! We now can create new applications and deploy them our Jetty server in the OpenShift PaaS.
Another nice we could do on top it is like adding a hook to our git repo to that the applications are auto deployed to our Jetty . We could see how to do this in my next blog in this series.
Hats off the Redhat OpenShift developers for developing such a cool thing!
Pingback: Running Tomcat on OpenShift - Web programming blog