-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
root
authored and
root
committed
Apr 17, 2024
1 parent
88f48a8
commit 8a4e08c
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/python | ||
|
||
containers = ["idp", "idp_ui", "idp_ui_data", "idp_ui_api", "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: | ||
print(str(line)) | ||
if (b'(' in line): | ||
healthstatus=line.strip() | ||
if (b"healthy" in healthstatus): | ||
healthstatus='<font color="green">' + str(healthstatus) + '</font>' | ||
elif ("unhealthy" in healthstatus): | ||
healthstatus='<font color="red">' + str(healthstatus) + '</font>' | ||
else: | ||
healthstatus='<font color="blue">' + str(healthstatus) + '</font>' | ||
else: | ||
healthstatus='<font color="orange">unspecified</font>' | ||
|
||
print("<tr><td>" + container + "</td><td>" + healthstatus + "</td></tr>") | ||
print("</table>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
. /etc/profile | ||
|
||
DELETE_VOLUMES="false" | ||
|
||
if [[ $1 == "-dv" ]]; then | ||
echo "will delete volumes..." | ||
DELETE_VOLUMES="true" | ||
fi | ||
|
||
function DisplayUsage() { | ||
echo "** This script will bring down the workbench containers, " | ||
echo "grab the latest workbench code and config from the main repo, " | ||
echo "then restart the containers." | ||
echo "" | ||
echo "Usage:" | ||
echo "$0 [-dv]" | ||
echo "" | ||
echo "Pass the -dv flag to also delete data volumes when refreshing this instance." | ||
echo "" | ||
exit 1 | ||
} | ||
|
||
if [[ $1 == "--?" ]] | [[ $1 == "--help" ]]; then | ||
DisplayUsage | ||
fi | ||
if [[ $# -eq 1 ]]; then | ||
if [[ $1 != "-dv" ]]; then DisplayUsage; fi | ||
fi | ||
|
||
pushd /csp-tap/InCommonTAP-Examples/Workbench | ||
docker-compose down | ||
if [[ $DELETE_VOLUMES == "true" ]]; then | ||
echo "deleting volumes..." | ||
docker volume rm $(docker volume ls -q) | ||
fi | ||
git pull | ||
docker-compose up --build -d | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |