Improve healthcheck

This commit is contained in:
Tobias Reisinger 2022-11-28 19:27:37 +01:00
parent e7c78aa678
commit ee59f0258b
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
11 changed files with 20 additions and 19 deletions

View file

@ -2,11 +2,6 @@
email tobias@msrg.cc email tobias@msrg.cc
} }
db.serguzim.me:80,
dns.serguzim.me:80 {
reverse_proxy host.docker.internal:4444
}
import /etc/caddy/snippets import /etc/caddy/snippets
import /etc/caddy/conf.d/*.conf import /etc/caddy/conf.d/*.conf
import /etc/caddy/conf-hidden.d/*.conf import /etc/caddy/conf-hidden.d/*.conf

View file

@ -1,2 +0,0 @@
/mailcheck.mail
/msmtprc

View file

@ -41,7 +41,7 @@ check_url "www.reitanlage-oranienburg.de"
if [ "$error" = "" ] if [ "$error" = "" ]
then then
curl_hc "$hc_url" >/dev/null 2>&1 curl_hc "$hc_url"
else else
curl_hc --data-raw "$error" "$hc_url/fail" >/dev/null 2>&1 curl_hc --data-raw "$error" "$hc_url/fail"
fi fi

9
healthcheck/data/mail Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/sh
set -e
cd /opt/ || exit
envsubst < template.msmtprc > /tmp/msmtprc
envsubst < mailcheck.template.mail > /tmp/mailcheck.mail
msmtp -C /tmp/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /tmp/mailcheck.mail

View file

@ -10,7 +10,7 @@ x-common-elements:
- .env - .env
- .secret.env - .secret.env
volumes: volumes:
- ./:/opt - ./data/:/opt
services: services:
http: http:

View file

@ -0,0 +1,4 @@
[Service]
Type=oneshot
ExecStart=/usr/bin/docker compose run --rm %i
WorkingDirectory=/opt/services/healthcheck/

View file

@ -0,0 +1,4 @@
[Timer]
OnCalendar=*:0/5
[Install]
WantedBy=timers.target

View file

@ -1,9 +0,0 @@
#!/usr/bin/sh
set -e
cd /opt/ || exit
envsubst < template.msmtprc > msmtprc
envsubst < mailcheck.template.mail > mailcheck.mail
msmtp -C /opt/msmtprc -a default "$MAIL_HC_UID@hc-ping.com" < /opt/mailcheck.mail