Skip to content

add starter status page #56

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Workbench/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ services:

wordpress_server:
build: ./wordpress_server/
container_name: wordpress_server
networks:
- net
depends_on:
Expand All @@ -320,7 +319,6 @@ services:

wordpress_data:
build: ./wordpress_data/
container_name: wordpress_data
networks:
- net
volumes:
Expand Down
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 "*/5 * * * * /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
4 changes: 4 additions & 0 deletions Workbench/webproxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ 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/
COPY container_files/httpd/ssl.conf /etc/httpd/conf.d/
COPY container_files/httpd/index.html /var/www/html/
COPY container_files/httpd/index.php /var/www/html/
COPY container_files/httpd/csp_logo.jpg /var/www/html/
COPY container_files/httpd/server-chain.crt /etc/pki/tls/certs/server-chain.crt
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