geosolutions-it / C195-azure-workspace

1 stars 2 forks source link

Add monitoring/restarting service for CKAN #10

Closed etj closed 3 years ago

etj commented 3 years ago

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.

lpasquali commented 3 years ago

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

lpasquali commented 3 years ago

https://github.com/geosolutions-it/C195-azure-workspace/pull/14

lpasquali commented 3 years ago

@etj can we close this?