Play framework is an interesting web development option, using Netty directly as a web server, providing a basic MVC framework to build web applications on. A
Here's how you marry them both.. The documentation out there (git quick starts ) seem to be outdated. But, its simple really and truly DIY.. So, thought I would let people know.
$ cat .openshift/action_hooks/start
#!/bin/bash
# The logic to start up your application should be put in this
# script. The application will work only if it binds to
# $OPENSHIFT_DIY_IP:8080
nohup $OPENSHIFT_REPO_DIR/diy/target/start -Dhttp.port=$OPENSHIFT_DIY_PORT -Dhttp.address=$OPENSHIFT_DIY_IP >> $OPENSHIFT_HOMEDIR/app-root/logs/server.log 2>&1 &
$ cat .openshift/action_hooks/stop
#!/bin/bash
# The logic to stop your application should be put in this script.
kill `ps -ef | grep "play.core.server.NettyServer" | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1
exit 0
$ git add diy/target
$ git commit -a
$ git push
That's it..
Here's how you marry them both.. The documentation out there (git quick starts ) seem to be outdated. But, its simple really and truly DIY.. So, thought I would let people know.
1. Install Play 2.0
Spin up the play server and make sure something renders on the localhost.2. Open an account with openshift.com and create a DIY application
When you checkout the git projects, by default, you get the following directory structure with a Ruby script to serve up a index.html page.$ ls -a
. .. .git .openshift README diy misc
$ ls diy
logs index.html testrubyserver.rb
$ ls .openshift/action_hooks
build deploy post_deploy pre_build start stop
3. Package your Play app
$ play stageNow, copy target folder to
$ target/start
$ cp -rf target $OPENSHIFT_PROJECT_GIT_REPO/diy/Throw away the index.html
$ git rm diy/index.html
4. Change the start and stop scripts
Make sure we bring up the Play server on the correct ip and port.$ cat .openshift/action_hooks/start
#!/bin/bash
# The logic to start up your application should be put in this
# script. The application will work only if it binds to
# $OPENSHIFT_DIY_IP:8080
nohup $OPENSHIFT_REPO_DIR/diy/target/start -Dhttp.port=$OPENSHIFT_DIY_PORT -Dhttp.address=$OPENSHIFT_DIY_IP >> $OPENSHIFT_HOMEDIR/app-root/logs/server.log 2>&1 &
$ cat .openshift/action_hooks/stop
#!/bin/bash
# The logic to stop your application should be put in this script.
kill `ps -ef | grep "play.core.server.NettyServer" | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1
exit 0
$ git add diy/target
$ git commit -a
$ git push
That's it..
Comments
Post a Comment