The default 503 page that is shown while a deployment is in progress on Openshift is not very "user friendly". I wanted to change that page for my DIY app and the solution I found is to start a temporary server that will serve the custom 503 page, while the deployment is in progress.
To keep things simple, I will use python's base http server to serve a static html page. This python web server will be started after the nginx process is stopped and will be terminated at the end of the deployment, right before the nginx server will be started again.
- In my
stop
action hook I will start python web server right after I stop nginx:
# stop nginx
echo "Starting maintenance web server."
nohup python ${OPENSHIFT_RUNTIME_DIR}/maintenance/maintenance.py > /tmp/nohup.out 2>&1&
echo $! > ${OPENSHIFT_RUN_DIR}/maintenance.pid
- In my
start
action hook I will stop python web server right before I start nginx:
echo "Stopping maintenance web server."
kill -9 `cat ${OPENSHIFT_RUN_DIR}/maintenance.pid`
# start nginx
So basically when the deployment starts, nginx will be stopped and python's web server will be started and when the deployment is done, python's web server will be stopped and nginx will be started.
so do you just put this in your php directory?