From 7a1a8a348ad62fb69e0691c14c05a91c57acaba1 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Mon, 7 Oct 2024 22:28:23 +0200 Subject: [PATCH] Remove http healthcheck --- modules/infrastructure/healthchecksio.tf | 2 +- roles/healthcheck/files/data/http | 52 ------------------- .../templates/docker-compose.yml.j2 | 3 -- roles/healthcheck/vars/main.yml | 3 -- 4 files changed, 1 insertion(+), 59 deletions(-) delete mode 100755 roles/healthcheck/files/data/http diff --git a/modules/infrastructure/healthchecksio.tf b/modules/infrastructure/healthchecksio.tf index aecd369..c8de994 100644 --- a/modules/infrastructure/healthchecksio.tf +++ b/modules/infrastructure/healthchecksio.tf @@ -32,7 +32,7 @@ resource "healthchecksio_check" "backup" { } resource "healthchecksio_check" "healthcheck" { - for_each = toset(["http", "mail", "matrix"]) + for_each = toset(["mail", "matrix"]) name = "service: ${each.value}" desc = "Monitoring for service (group) ${each.value}" diff --git a/roles/healthcheck/files/data/http b/roles/healthcheck/files/data/http deleted file mode 100755 index 7f346b7..0000000 --- a/roles/healthcheck/files/data/http +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/sh - -cd /opt/ || exit - -services_down="" -error="" - -alias curl_hc='curl -LA "$USER_AGENT" --retry 3' - -check_url () -{ - url="https://$1$2" - printf "checking url %s ." "$url" - dig A "$1" >/dev/null - printf "." - result=$(curl -LsSfv --connect-timeout 30 --retry 3 "$url" 2>&1) - code="$?" - printf ".\n" - #shellcheck disable=SC2181 - if [ "$code" = "0" ] - then - echo "... good" - else - services_down=$(printf "%s\n%s" "$services_down" "$1") - error=$(printf "%s\n==========\n%s:\n%s" "$error" "$1" "$result") - echo "... bad" - fi -} - -#check_url "acme.serguzim.me" "/health" -check_url "analytics.serguzim.me" -check_url "auth.serguzim.me" -check_url "ci.serguzim.me" -#check_url "cloud.serguzim.me" "/login?noredir=1" -check_url "git.serguzim.me" -check_url "hook.serguzim.me" -check_url "mail.serguzim.me" -#check_url "msrg.cc" # disabled because it keeps creating false alerts -check_url "rss.serguzim.me" -#check_url "serguzim.me" # disabled because it keeps creating false alerts -#check_url "status.serguzim.me" "/status/serguzim-net" -check_url "tick.serguzim.me" -check_url "wiki.serguzim.me" -check_url "www.reitanlage-oranienburg.de" - -if [ "$error" = "" ] -then - curl_hc "$HTTP_HC_URL" >/dev/null - echo "ALL GOOD" -else - curl_hc --data-raw "$services_down$error" "$HTTP_HC_URL/fail" >/dev/null -fi diff --git a/roles/healthcheck/templates/docker-compose.yml.j2 b/roles/healthcheck/templates/docker-compose.yml.j2 index b073224..0a4e7c6 100644 --- a/roles/healthcheck/templates/docker-compose.yml.j2 +++ b/roles/healthcheck/templates/docker-compose.yml.j2 @@ -11,9 +11,6 @@ x-common-elements: network_mode: host services: - http: - <<: *common-elements - command: "/opt/http" matrix: <<: *common-elements command: "/opt/matrix" diff --git a/roles/healthcheck/vars/main.yml b/roles/healthcheck/vars/main.yml index a1b7988..499cbb0 100644 --- a/roles/healthcheck/vars/main.yml +++ b/roles/healthcheck/vars/main.yml @@ -2,15 +2,12 @@ healthcheck_svc: name: healthcheck checks: - - http - mail - matrix healthcheck_env: USER_AGENT: healthcheck-bot for serguzim.net - HTTP_HC_URL: "{{ opentofu.healthchecksio.healthcheck.http.ping_url }}" - MATRIX_SERVER: https://matrix.serguzim.me MATRIX_SERVER_FEDTESTER: msrg.cc MATRIX_HC_URL: "{{ opentofu.healthchecksio.healthcheck.matrix.ping_url }}"