diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index 22e831933ea0013274ed9a36964fea84bdd09b08..433ec235a8988fdca604d32204ab43d7cf8b6fdd 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -63,6 +63,11 @@ INSTALLED_APPS = [ "polymorphic", "django_global_request", "dbbackup", + "health_check", + "health_check.db", + "health_check.cache", + "health_check.storage", + "health_check.contrib.psutil", "settings_context_processor", "sass_processor", "easyaudit", @@ -648,6 +653,7 @@ elif HAYSTACK_BACKEND_SHORT == "whoosh": if _settings.get("celery.enabled", False) and _settings.get("search.celery", True): INSTALLED_APPS.append("celery_haystack") + INSTALLED_APPS.append("health_check.contrib.celery") HAYSTACK_SIGNAL_PROCESSOR = "celery_haystack.signals.CelerySignalProcessor" else: HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor" @@ -655,3 +661,8 @@ else: HAYSTACK_SEARCH_RESULTS_PER_PAGE = 10 DJANGO_EASY_AUDIT_WATCH_REQUEST_EVENTS = False + +HEALTH_CHECK = { + "DISK_USAGE_MAX": _settings.get("health.disk_usage_max_percent", 90), + "MEMORY_MIN": _settings.get("health.memory_min_mb", 500), +} diff --git a/aleksis/core/urls.py b/aleksis/core/urls.py index ad35fa8c5de7f5bf4045c28fe241aecec74235ed..4fc624dc55b040bce918783526ec5910c6ff68d7 100644 --- a/aleksis/core/urls.py +++ b/aleksis/core/urls.py @@ -9,6 +9,7 @@ from django.views.i18n import JavaScriptCatalog import calendarweek.django import debug_toolbar from django_js_reverse.views import urls_js +from health_check.urls import urlpatterns as health_urls from two_factor.urls import urlpatterns as tf_urls from . import views @@ -119,6 +120,7 @@ urlpatterns = [ {"registry_name": "group"}, name="preferences_group", ), + path("health/", include(health_urls)), ] # Serve static files from STATIC_ROOT to make it work with runserver diff --git a/pyproject.toml b/pyproject.toml index 2e7e672f44ffc66d9217ce6e483f2bfcdb0fea9c..c23bc22b01b57259fb039e29a5a3bff5a4f70764 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,6 +85,8 @@ spdx-license-list = "^0.4.0" license-expression = "^1.2" django-reversion = "^3.0.7" django-favicon-plus-reloaded = "^1.0.4" +django-health-check = "^3.12.1" +psutil = "^5.7.0" [tool.poetry.extras] ldap = ["django-auth-ldap"]