From 07488996594c470653a49f4ecb9bba8e2b5c4798 Mon Sep 17 00:00:00 2001 From: Ole Mathias Heggem Date: Wed, 9 Oct 2024 20:36:06 +0200 Subject: [PATCH] ci: add healthcheck endpoint --- requirements.txt | 3 ++- tgno/settings/base.py | 7 +++++++ tgno/urls.py | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index de6e6a6..65a769f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ Django>=4.2,<4.3 wagtail>=6.2 psycopg>=3.1.8,<4.0 -social-auth-app-django==5.4.2 \ No newline at end of file +social-auth-app-django==5.4.2 +django-health-check==3.18.3 diff --git a/tgno/settings/base.py b/tgno/settings/base.py index cf8beca..55e6c86 100644 --- a/tgno/settings/base.py +++ b/tgno/settings/base.py @@ -49,6 +49,11 @@ "wagtail", "modelcluster", "taggit", + "health_check", + "health_check.db", + "health_check.cache", + "health_check.storage", + "health_check.contrib.migrations", "social_django", "django.contrib.admin", "django.contrib.auth", @@ -207,3 +212,5 @@ if DISABLE_LOCAL_AUTH is False: AUTHENTICATION_BACKENDS.append("django.contrib.auth.backends.ModelBackend") + +HEALTH_CHECK = {"SUBSETS": {"liveness": ["DatabaseBackend"]}} diff --git a/tgno/urls.py b/tgno/urls.py index fda5d2c..f38c86b 100644 --- a/tgno/urls.py +++ b/tgno/urls.py @@ -12,6 +12,7 @@ from .api import api_router as base_api_router urlpatterns = [ + path(r"backend-health/", include("health_check.urls")), path("django-admin/", admin.site.urls), path("admin/", include(wagtailadmin_urls)), path("", include("social_django.urls")),