Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nTAP-Examples into CSPWB-19
  • Loading branch information
ethan committed Dec 14, 2020
2 parents df29a7a + 3f26499 commit 85d5bf0
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Workbench/scripts/gethealth.py
Original file line number Diff line number Diff line change
@@ -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("<table><tr><th style='text-align:left;width:150px'>Container</th><th style='text-align:left'>Health Status</th></tr>")
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 = '<font color="grey">unknown</font>'
for line in pipe.stdout:
if ('(' in line):
healthstatus=line.split('(')[1].split(')')[0].strip()
if (healthstatus == "healthy"):
healthstatus='<font color="green">' + healthstatus + '</font>'
elif (healthstatus == "unhealthy"):
healthstatus='<font color="red">' + healthstatus + '</font>'
else:
healthstatus='<font color="blue">' + healthstatus + '</font>'
else:
healthstatus='<font color="orange">unspecified</font>'

print("<tr><td>" + container + "</td><td>" + healthstatus + "</td></tr>")
print("</table>")
10 changes: 10 additions & 0 deletions Workbench/scripts/setupcron.sh
Original file line number Diff line number Diff line change
@@ -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}
5 changes: 5 additions & 0 deletions Workbench/scripts/update-health-status.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Workbench/webproxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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/
Expand Down

0 comments on commit 85d5bf0

Please sign in to comment.