Compare commits

..

2 Commits

Author SHA1 Message Date
bel ae54bee23b dockerfile
cicd / ci (push) Successful in 3m14s
2026-06-28 00:28:19 -06:00
bel 84a8897bf0 it is techincally a ui 2026-06-28 00:27:14 -06:00
3 changed files with 58 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
FROM golang:1.26-trixie AS builder
WORKDIR /go/src/
COPY ./go.* ./
COPY ./cmd ./cmd/
COPY ./.vendor ./.vendor/
ENV CGO_ENABLED=0
RUN go build \
-o /go/bin/binary \
-mod=readonly \
-ldflags="-extldflags '-static'" \
./cmd/*/
FROM debian:trixie-slim AS runtime
COPY --from=builder /go/bin/binary /bin/binary
CMD []
ENTRYPOINT ["/bin/binary"]
+42
View File
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<header>
<script>
function onload() {
const results = [
{{ range $v := query
`
SELECT
start AS start
, CASE
WHEN ms < 750 OR ok THEN
'okay'
ELSE
'errored'
END AS ok
FROM
"pinger_pings"
ORDER BY start DESC
LIMIT 1000
`
-}}
[
{{.ok}}==="okay"
? "🟢"
: "🔴",
`${Math.round((new Date() - 1000*{{.start}})/1000.0)}s ago`,
new Date(1000*{{.start}}),
],
{{ end }}
]
document.getElementById("draw").innerHTML = results.map((r) => `<br>${JSON.stringify(r)}`).join("\n");
}
</script>
</header>
<body onload="onload()">
<div id="draw">
</div>
</body>
<footer>
</footer>
</html>
+1 -1
View File
@@ -187,7 +187,7 @@ func (s S) pingAndRecord(ctx context.Context) error {
(start, ms, ok, to_id)
VALUES
($1, $2, $3, $4)
`, record.start, record.ms.Milliseconds(), record.ok, toId); err != nil {
`, record.start.Unix(), record.ms.Milliseconds(), record.ok, toId); err != nil {
log.Println("!", err)
}
}