This is what I do for deployment (you can can start from one of those two solutions you mentioned but you can strip them down):
- the server binary is bin/cmo and I compile it before deploy
cat /.openshift/action_hooks/start
#!/bin/bash
nohup ${OPENSHIFT_REPO_DIR}/bin/cmo >> ${OPENSHIFT_DIY_LOG_DIR}/cmo.log 2>&1 &
cat /.openshift/action_hooks/stop
#!/bin/bash
pkill cmo > /dev/null 2>&1
exit 0
I don't use any other action_hook.
I have three other directories in the repo (besides .openshift):
bin/ <--- contains the binary
tmpl/ <---- contains the templates
static/ <---- contains the static files (js,css,img) (maybe I will move demo on a CDN)
-rif