geosolutions-it/C195-azure-workspace

Add monitoring/restarting service for CKAN

Closed this issue · 3 comments

etj commented

We need a service that checks whether CKAN is still alive, and restarts it if needed.

The check/restart should be configurable, in order to be active in production, but not active in staging/test, so that any freeze or death of CKAN can be investigated.

howdy @etj

I'd do a very simple script:

#!/bin/bash
date=$(date '+%Y-%m-%d %H:%M:%S')
response="$(curl -I -s http://localhost:5000/ --max-time 10 --connect-timeout 10 | head -1 | tr -d '\r')"
if [ "$response" != 'HTTP/1.0 200 OK' ]; then 
        docker restart ckan
	echo "$date - restarted ckan because it was stuck" >> $HOME/ckan_restart_log
fi

and put it in crontab every minute

* * * * * $HOME/check_ckan_alive.sh

where do you want me to place this? somewhere under here?
https://github.com/geosolutions-it/C195-azure-workspace/tree/master/azure

@etj can we close this?