Skip to content

Commit f65e659

Browse files
committed
feat: use django-helsinki-health-endpoints for readiness and healthz
django-health-check is replaced by django-helsinki-health-endpoints. Refs: KEH-242
1 parent 56f6741 commit f65e659

11 files changed

Lines changed: 9 additions & 240 deletions

File tree

custom_health_checks/README.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

custom_health_checks/__init__.py

Whitespace-only changes.

custom_health_checks/apps.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

custom_health_checks/backends.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

custom_health_checks/tests/test_backends.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

custom_health_checks/tests/test_healthz.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

custom_health_checks/views.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

kukkuu/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,8 @@ def sentry_before_send(event: Event, hint: Hint):
303303
"guardian",
304304
"rest_framework",
305305
"drf_spectacular",
306-
"health_check", # requirement
307306
"social_django", # For django-admin Keycloak login
308307
# local apps
309-
"custom_health_checks",
310308
"users",
311309
"children",
312310
"utils",
@@ -323,6 +321,7 @@ def sentry_before_send(event: Event, hint: Hint):
323321
"logger_extra",
324322
"resilient_logger",
325323
"kukkuu",
324+
"helsinki_health_endpoints",
326325
"django_cleanup.apps.CleanupConfig", # This must be included last
327326
]
328327

@@ -618,3 +617,5 @@ def sentry_before_send(event: Event, hint: Hint):
618617
with open(local_settings_path) as fp:
619618
code = compile(fp.read(), local_settings_path, "exec")
620619
exec(code, globals(), locals())
620+
621+
SENTRY_RELEASE = env("SENTRY_RELEASE")

kukkuu/urls.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
from csp.decorators import csp_update
33
from django.conf import settings
44
from django.conf.urls.static import static
5-
from django.http import JsonResponse
65
from django.urls import include, path, re_path
76
from django.utils.translation import gettext_lazy as _
87
from django.views.decorators.csrf import csrf_exempt
9-
from django.views.decorators.http import require_http_methods
108
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView
119
from helusers.admin_site import admin
1210
from rest_framework import routers
1311

1412
from common.utils import get_api_version
15-
from custom_health_checks.views import HealthCheckJSONView
16-
from kukkuu import __version__
1713
from kukkuu.views import SentryGraphQLView
1814
from reports.api import ChildViewSet, EventGroupViewSet, EventViewSet, VenueViewSet
1915

@@ -65,27 +61,8 @@ def graphql_view(request, *args, **kwargs):
6561
path("gdpr-api/", include("helsinki_gdpr.urls")),
6662
]
6763

68-
69-
#
70-
# Kubernetes liveness & readiness probes
71-
#
72-
73-
74-
@require_http_methods(["GET", "HEAD"])
75-
def readiness(*args, **kwargs):
76-
response_json = {
77-
"status": "ok",
78-
"release": settings.APP_RELEASE,
79-
"packageVersion": __version__,
80-
"commitHash": settings.REVISION,
81-
"buildTime": settings.APP_BUILD_TIME.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
82-
}
83-
return JsonResponse(response_json, status=200)
84-
85-
8664
urlpatterns += [
87-
path(r"healthz", HealthCheckJSONView.as_view(), name="healthz"),
88-
path("readiness", readiness),
65+
path("", include("helsinki_health_endpoints.urls")),
8966
]
9067
if settings.DEBUG:
9168
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ django-environ
77
django-filter
88
django-graphql-jwt
99
django-guardian
10-
django-health-check
10+
django-helsinki-health-endpoints
1111
django-helusers
1212
django-ilmoitin
1313
django-parler

0 commit comments

Comments
 (0)