Add gatus intervals and umami external link tracking

This commit is contained in:
Tobias Reisinger 2025-01-09 15:44:29 +01:00
parent f48e702339
commit 4608081fba
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 19 additions and 0 deletions

View file

@ -75,6 +75,7 @@ class FilterModule(object):
"group": mon.get("group"),
"url": url,
"conditions": conditions,
"interval": mon.get("interval"),
"alerts": self.default_alerts,
"ui": {
"hide-url": True

View file

@ -1 +1,2 @@
<script async src="/_a/script.js" data-website-id="{{ vault_forgejo.umami }}"></script>
<script async src="/_a/track-external.js"></script>

View file

@ -22,6 +22,7 @@ forgejo_runner_compose:
docker-in-docker:
image: docker:dind
privileged: true
dns: 1.1.1.1
restart: always
command: dockerd -H tcp://0.0.0.0:2375 --tls=false
networks:

View file

@ -10,6 +10,21 @@ umami_docker_image: docker.umami.dev/umami-software/umami:postgresql-latest
umami_svc:
domain: "{{ all_services | service_get_domain(role_name) }}"
caddy_extra: |
handle /track-external.js {
header Content-Type text/javascript
respond <<JS
(() => {
const name = 'outbound-link-click';
document.querySelectorAll('a').forEach(a => {
if (a.host !== window.location.host && !a.getAttribute('data-umami-event')) {
a.setAttribute('data-umami-event', name);
a.setAttribute('data-umami-event-url', a.href);
}
});
})();
JS 200
}
port: 3000
umami_env:

View file

@ -148,6 +148,7 @@ variable "services" {
monitoring = optional(object({
url = optional(string)
group = optional(string)
interval = optional(string)
conditions = optional(list(string))
}))
ports = optional(list(object({