From acee6b0686d9df7d65c783550a26e4c826e83cd1 Mon Sep 17 00:00:00 2001 From: Kaladaran Date: Mon, 30 Oct 2023 12:11:06 +0100 Subject: [PATCH] add health check --- docker-compose.dev.yml | 11 +++++++---- marbas/settings.py | 1 + marbas/urls.py | 1 + requirements.txt | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index d623bf9..1fa99ae 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -23,7 +23,7 @@ services: env_file: - .env ports: - - 8000:8000 + - "8000:8000" user: "1000:1000" volumes: - ./marbas:/app/marbas @@ -32,6 +32,9 @@ services: - ./manage.py:/app/manage.py - ./static_eve:/app/static_eve command: ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--reload"] + healthcheck: + test: python manage.py health_check + interval: 3s depends_on: redis: condition: service_healthy @@ -45,7 +48,7 @@ services: redis: image: redis:latest ports: - - 6379:6379 + - "6379:6379" healthcheck: test: redis-cli ping interval: 3s @@ -53,7 +56,7 @@ services: db: image: postgres:13-alpine ports: - - 5432:5432 + - "5432:5432" volumes: - marbas_dbdata:/var/lib/postgresql/data env_file: @@ -67,7 +70,7 @@ services: # elasticsearch: # image: elasticsearch:latest # ports: -# - 9200:9200 +# - "9200:9200" # environment: # - discovery.type=single-node # - cluster.name=elasticsearch diff --git a/marbas/settings.py b/marbas/settings.py index a432644..950e1bc 100644 --- a/marbas/settings.py +++ b/marbas/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'django_filters', + 'health_check', 'rest_framework' ] diff --git a/marbas/urls.py b/marbas/urls.py index 0c03814..0b13171 100644 --- a/marbas/urls.py +++ b/marbas/urls.py @@ -37,4 +37,5 @@ urlpatterns = [ template_name='redoc.html', extra_context={'schema_url': 'openapi-schema'} ), name='redoc'), + path('ht/', include('health_check.urls')), ] diff --git a/requirements.txt b/requirements.txt index b304495..06b16ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ redis pyyaml uritemplate django-esi +django-health-check