Last Updated: February 25, 2016
· vimishor

Custom 503 page while deploy on openshift

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.

Python to the rescue !

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.


  1. 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/ > /tmp/nohup.out 2>&1&
echo $! > ${OPENSHIFT_RUN_DIR}/
  1. 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}/`

# 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.

You can view the sample files here

1 Response
Add your response

Looking over this as a potentially brilliant fix to the drab default 503 page, however I'm wondering how you actually created the files in the OPENSHIFTRUNDIR as when I try and create the files and folders I get permission errors.

over 1 year ago ·