We are considering deploying Witty applications on OpenShift. In theory, it should be possible to do it but it’s still necessary to test things out. There are some unanswered questions on how such a deployment might work.

This blog entry was very useful in getting things deployed on a DIY cartridge. However, there are some minor issues that needed to be tweaked.

Starting

The start action hook that I used was:

nohup $OPENSHIFT_REPO_DIR/diy/hello.wt --http-port=$OPENSHIFT_DIY_PORT --http-address=$OPENSHIFT_DIY_IP --docroot=$OPENSHIFT_REPO_DIR/www |& /usr/bin/logshifter -tag hello.wrt &

This is the very minimum that is needed for it to work. Witty would fail to start if no docroot was specified.

There are a number of environment variables defined for OpenShift cartridges as detailed here. The OPENSHIFT_DATA_DIR is probably useful for use as a persistent data read/write directory.

Stopping

For some reason, the built-in ps -ef command on OpenShift was not returning the full information.

UID PID PPID C STIME TTY TIME CMD
3109 240117 1 0 10:24 ? 00:00:00 lo.wt --http-port=... --http-address=... --docroot=/var/lib/openshift/...

As you can see, the hello.wt command was missing, which meant that the default stop script had to be modified slightly using ps -C into this.

if [ -z "$(ps -C hello.wt | grep wt)" ]
then
client_result "Application is already stopped"
else
kill `ps -C hello.wt | grep wt | awk '{ print $1 }'` > /dev/null 2>&1
fi

The stop action hook then works correctly to kill the server when asked to.

[2014-Nov-24 10:49:31.842350] 335442 - [info] "WServer/wthttp: shutdown (signal = 15)"
[2014-Nov-24 10:49:31.842432] 335442 - [info] "WebController: shutdown: stopping sessions."
[2014-Nov-24 10:49:31.842456] 335442 - [info] "WServer/wthttp: Shutdown: stopping web server."

So, from this preliminary test, Witty apps work well enough with OpenShift. However, there are still a lot of other integration issues that we will need to investigate further before coming up with a proper work-flow.

Having things work with OpenShift would be a boon since it would simplify deployment as we are already using git for development.


2 Comments

me · 2015-12-29 at 08:14

hi did you got it working cuz i want to try?

    Shawn Tan · 2016-01-08 at 09:01

    Yes, we got it working, but not in a good way. So, we are still trying to find a better way to do it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.