add health check

This commit is contained in:
2023-10-30 12:11:06 +01:00
parent cf6213cca3
commit acee6b0686
4 changed files with 10 additions and 4 deletions

View File

@@ -23,7 +23,7 @@ services:
env_file: env_file:
- .env - .env
ports: ports:
- 8000:8000 - "8000:8000"
user: "1000:1000" user: "1000:1000"
volumes: volumes:
- ./marbas:/app/marbas - ./marbas:/app/marbas
@@ -32,6 +32,9 @@ services:
- ./manage.py:/app/manage.py - ./manage.py:/app/manage.py
- ./static_eve:/app/static_eve - ./static_eve:/app/static_eve
command: ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--reload"] command: ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--reload"]
healthcheck:
test: python manage.py health_check
interval: 3s
depends_on: depends_on:
redis: redis:
condition: service_healthy condition: service_healthy
@@ -45,7 +48,7 @@ services:
redis: redis:
image: redis:latest image: redis:latest
ports: ports:
- 6379:6379 - "6379:6379"
healthcheck: healthcheck:
test: redis-cli ping test: redis-cli ping
interval: 3s interval: 3s
@@ -53,7 +56,7 @@ services:
db: db:
image: postgres:13-alpine image: postgres:13-alpine
ports: ports:
- 5432:5432 - "5432:5432"
volumes: volumes:
- marbas_dbdata:/var/lib/postgresql/data - marbas_dbdata:/var/lib/postgresql/data
env_file: env_file:
@@ -67,7 +70,7 @@ services:
# elasticsearch: # elasticsearch:
# image: elasticsearch:latest # image: elasticsearch:latest
# ports: # ports:
# - 9200:9200 # - "9200:9200"
# environment: # environment:
# - discovery.type=single-node # - discovery.type=single-node
# - cluster.name=elasticsearch # - cluster.name=elasticsearch

View File

@@ -55,6 +55,7 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_filters', 'django_filters',
'health_check',
'rest_framework' 'rest_framework'
] ]

View File

@@ -37,4 +37,5 @@ urlpatterns = [
template_name='redoc.html', template_name='redoc.html',
extra_context={'schema_url': 'openapi-schema'} extra_context={'schema_url': 'openapi-schema'}
), name='redoc'), ), name='redoc'),
path('ht/', include('health_check.urls')),
] ]

View File

@@ -8,3 +8,4 @@ redis
pyyaml pyyaml
uritemplate uritemplate
django-esi django-esi
django-health-check