diff --git a/Workbench/scripts/gethealth.py b/Workbench/scripts/gethealth.py new file mode 100644 index 0000000..715f8ef --- /dev/null +++ b/Workbench/scripts/gethealth.py @@ -0,0 +1,24 @@ +#!/bin/python + +containers = ["idp", "grouper_ui", "grouper_ws", "grouper_daemon", "grouper_data", "comanage", "comanage-cron", "comanage_data", "midpoint_server", "midpoint_data", "webproxy", "wordpress_server", "wordpress_data", "mq", "directory", "sources"] + +print("") +for container in containers: + from subprocess import Popen, PIPE + dcmd = "docker ps -f name=workbench_" + container + "_1 --format '{{ .Status }} '" + pipe = Popen(dcmd, shell=True, stdout=PIPE) + healthstatus = 'unknown' + for line in pipe.stdout: + if ('(' in line): + healthstatus=line.split('(')[1].split(')')[0].strip() + if (healthstatus == "healthy"): + healthstatus='' + healthstatus + '' + elif (healthstatus == "unhealthy"): + healthstatus='' + healthstatus + '' + else: + healthstatus='' + healthstatus + '' + else: + healthstatus='unspecified' + + print("") +print("
ContainerHealth Status
" + container + "" + healthstatus + "
") diff --git a/Workbench/scripts/setupcron.sh b/Workbench/scripts/setupcron.sh new file mode 100644 index 0000000..afd1f5c --- /dev/null +++ b/Workbench/scripts/setupcron.sh @@ -0,0 +1,10 @@ +#!/bin/bash +CRONFILE=/csp-tap/InCommonTAP-Examples/Workbench/scripts/csp-cron + +#build crontab file +echo "#update CSP container status" > ${CRONFILE} +echo "*/3 * * * * /csp-tap/InCommonTAP-Examples/Workbench/scripts/update-health-status.sh" >> ${CRONFILE} +chmod 644 ${CRONFILE} + +#install crontab +crontab ${CRONFILE} diff --git a/Workbench/scripts/update-health-status.sh b/Workbench/scripts/update-health-status.sh new file mode 100644 index 0000000..c981f42 --- /dev/null +++ b/Workbench/scripts/update-health-status.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +/csp-tap/InCommonTAP-Examples/Workbench/scripts/gethealth.py > /csp-tap/InCommonTAP-Examples/Workbench/scripts/gethealth-output.txt + +docker cp /csp-tap/InCommonTAP-Examples/Workbench/scripts/gethealth-output.txt workbench_webproxy_1:/var/www/html/status/index.html \ No newline at end of file diff --git a/Workbench/webproxy/Dockerfile b/Workbench/webproxy/Dockerfile index 46ec76f..e548133 100644 --- a/Workbench/webproxy/Dockerfile +++ b/Workbench/webproxy/Dockerfile @@ -3,6 +3,8 @@ FROM tier/shibboleth_sp:latest ARG CSPHOSTNAME=localhost ENV CSPHOSTNAME=$CSPHOSTNAME +RUN yum -y install cronie + #COPY container_files/httpd/httpd.conf /etc/httpd/conf/ COPY container_files/httpd/proxy.conf /etc/httpd/conf.d/ COPY container_files/httpd/shib.conf /etc/httpd/conf.d/ @@ -14,6 +16,7 @@ COPY container_files/httpd/.htpasswd /etc/httpd/ COPY container_files/httpd/localhost.crt /etc/pki/tls/certs/localhost.crt COPY container_files/httpd/localhost.key /etc/pki/tls/private/localhost.key RUN chmod 600 /etc/pki/tls/certs/localhost.crt && chmod 600 /etc/pki/tls/private/localhost.key +RUN mkdir -p /var/www/html/status COPY container_files/shibboleth/ /etc/shibboleth/ COPY container_files/system/setservername.sh /usr/local/bin/