summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-11-17 04:43:40 -0500
committerMalfurious <m@lfurio.us>2023-11-18 00:45:27 -0500
commit5e0a24511d51f1b1ba56fe80d5c5b673fe3245b0 (patch)
tree85d69d10f19f2c1c47abce14a376f7317926a8e8
parenta85783ed0b1ae567574f5f9986a235ce747b8af0 (diff)
downloadcychedelic-5e0a24511d51f1b1ba56fe80d5c5b673fe3245b0.tar.gz
cychedelic-5e0a24511d51f1b1ba56fe80d5c5b673fe3245b0.zip
dmt: Add services page
Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-xdmt/dmt6
-rw-r--r--dmt/html/master.html2
-rw-r--r--dmt/html/services.html49
-rw-r--r--dmt/style.css4
4 files changed, 60 insertions, 1 deletions
diff --git a/dmt/dmt b/dmt/dmt
index f3e68f3..9234d97 100755
--- a/dmt/dmt
+++ b/dmt/dmt
@@ -4,6 +4,7 @@
# cychedelic is an automated Continuous Deployment solution. See the README for
# more information.
+CYCHE_SERVICE_DIR="/data/services"
CYCHE_LOG_DIR="/data/logs"
CYCHE_STATUS_FILE="/data/status"
CYCHE_VERSION_FILE="/version"
@@ -110,6 +111,11 @@ case ${route[0]} in
template "html/master.html" text/html
;;
+ "services")
+ page_template="html/services.html"
+ template "html/master.html" text/html
+ ;;
+
"style.css")
template "style.css" text/css
;;
diff --git a/dmt/html/master.html b/dmt/html/master.html
index 570c511..fd57476 100644
--- a/dmt/html/master.html
+++ b/dmt/html/master.html
@@ -9,7 +9,7 @@
<body>
<nav class="links">
<a href="/">jobs</a>
- | etc...
+ | <a href="/services">services</a>
<span class="right">
%{ echo -n "$CYCHE_SITE_NAME" | escape_html %}
diff --git a/dmt/html/services.html b/dmt/html/services.html
new file mode 100644
index 0000000..ae4dee6
--- /dev/null
+++ b/dmt/html/services.html
@@ -0,0 +1,49 @@
+<h1>Services</h1>
+
+% show() {
+% $gitcmd show --quiet --format="$1" HEAD | escape_html
+% }
+
+% describe() {
+% $gitcmd describe --all --exact-match "$1" 2>/dev/null | escape_html
+% }
+
+% for serv in $CYCHE_SERVICE_DIR/*; do
+% gitcmd="git --git-dir=$serv/.git"
+% url=$($gitcmd remote get-url origin | escape_html)
+% previous_hash=$(cat $serv/.git/previous_hash)
+% current_hash=$(show '%H')
+% [ "$current_hash" == "$previous_hash" ] && class="" || class="standout"
+
+ <div class="box %($class%)">
+ <div class="box-title">
+ %{ basename $serv %}
+ <span class="right"><a href="%($url%)">%($url%)</a></span>
+ </div>
+
+ <div class="box-text">
+ <table>
+ <tr>
+ <td>Deployed:</td>
+ <td>%($previous_hash%)</td>
+ <td>%{describe $previous_hash%}</td>
+ </tr>
+ <tr>
+ <td>Commit:</td>
+ <td>%($current_hash%)</td>
+ <td>%{describe $current_hash%}</td>
+ </tr>
+ <tr>
+ <td>Committer:</td>
+ <td>%{show '%cn <%ce>'%}</td>
+ <td>%{show '%cD'%}</td>
+ </tr>
+ <tr>
+ <td>Tree:</td>
+ <td>%{show '%T'%}</td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+% done
diff --git a/dmt/style.css b/dmt/style.css
index 915a6cd..f95eb6a 100644
--- a/dmt/style.css
+++ b/dmt/style.css
@@ -12,6 +12,10 @@ pre {
margin: 0;
}
+td {
+ font-family: monospace;
+}
+
a {
color: #c8c8c8;
text-decoration: none;