diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml index c84d5be..bf3c759 100644 --- a/argocd/deployment.yaml +++ b/argocd/deployment.yaml @@ -27,7 +27,7 @@ spec: mountPath: /data containers: - name: web - image: git.baumann.gr/adebaumann/labhelper:0.080 + image: git.baumann.gr/adebaumann/labhelper:0.081 imagePullPolicy: Always ports: - containerPort: 8000 @@ -137,7 +137,7 @@ spec: mountPath: /app/data readinessProbe: httpGet: - path: / + path: /health/ port: 8000 initialDelaySeconds: 5 periodSeconds: 10 @@ -145,7 +145,7 @@ spec: failureThreshold: 6 livenessProbe: httpGet: - path: / + path: /health/ port: 8000 initialDelaySeconds: 20 periodSeconds: 20 diff --git a/boxes/views.py b/boxes/views.py index ae981ae..d793e25 100644 --- a/boxes/views.py +++ b/boxes/views.py @@ -18,6 +18,11 @@ from .forms import ( from .models import Box, BoxType, Facet, Tag, Thing, ThingFile, ThingLink +def health_check(request): + """Health check endpoint for Kubernetes liveness/readiness probes.""" + return HttpResponse('OK', status=200) + + def _strip_markdown(text, max_length=100): """Convert Markdown to plain text and truncate.""" if not text: diff --git a/labhelper/urls.py b/labhelper/urls.py index e4e4a50..2f708df 100644 --- a/labhelper/urls.py +++ b/labhelper/urls.py @@ -34,6 +34,7 @@ from boxes.views import ( edit_box_type, edit_thing, fixme, + health_check, index, resources_list, search_api, @@ -43,6 +44,7 @@ from boxes.views import ( urlpatterns = [ path('oidc/', include('mozilla_django_oidc.urls')), path('login/', TemplateView.as_view(template_name='login.html'), name='login'), + path('health/', health_check, name='health_check'), path('', index, name='index'), path('box-management/', box_management, name='box_management'), path('box-type/add/', add_box_type, name='add_box_type'),