From abafaa3f80e1cdc8513280727dbb28fe0bb542cc Mon Sep 17 00:00:00 2001 From: Kenzo-Hugo Hillion <kenzo-hugo.hillion1@pasteur.fr> Date: Mon, 23 Mar 2020 17:06:16 +0100 Subject: [PATCH] add health check to local dev app --- backend/Pipfile | 1 + backend/Pipfile.lock | 17 +++++++++-------- backend/metagenedb/settings/django.py | 9 +++++++++ backend/metagenedb/urls.py | 1 + ci/kubernetes/redis.yaml | 2 +- nginx/dev/nginx.conf | 2 +- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/backend/Pipfile b/backend/Pipfile index b66218d..d41ca44 100644 --- a/backend/Pipfile +++ b/backend/Pipfile @@ -66,6 +66,7 @@ celery = "*" redis = "*" django-health-check = "==3.0.0" django-redis = "*" +kombu = "*" [requires] python_version = "3.7" diff --git a/backend/Pipfile.lock b/backend/Pipfile.lock index 89e7ea5..8b089bd 100644 --- a/backend/Pipfile.lock +++ b/backend/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "7a57302feb304e2e7a2b4eee0639908bbd8c66a0c5e86fc82c82f9dec0ed0af1" + "sha256": "92db23f20aeda23e0c9540438d0a34f33d1d3a41422a09e9d721c98b6cb3b754" }, "pipfile-spec": 6, "requires": { @@ -214,6 +214,7 @@ "sha256:2d1cda774126a044d91a7ff5fa6d09edf99f46924ab332a810760fe6740e9b76", "sha256:598e7e749d6ab54f646b74b2d2df67755dee13894f73ab02a2a9feb8870c7cb2" ], + "index": "pypi", "version": "==4.6.8" }, "markupsafe": { @@ -518,7 +519,7 @@ "sha256:5b26757dc6f79a3b7dc9fab95359328d5747fcb2409d331ea66d0272b90ab2a0", "sha256:8b995ffe925347a2138d7ac0fe77155e4311a0ea6d6da4f5128fe4b3cbe5ed71" ], - "markers": "platform_system == 'Darwin'", + "markers": "sys_platform == 'darwin'", "version": "==0.1.0" }, "astroid": { @@ -664,10 +665,10 @@ }, "ipykernel": { "hashes": [ - "sha256:7f1f01df22f1229c8879501057877ccaf92a3b01c1d00db708aad5003e5f9238", - "sha256:ba8c9e5561f3223fb47ce06ad7925cb9444337ac367341c0c520ffb68ea6d120" + "sha256:37c65d2e2da3326e5cf114405df6d47d997b8a3eba99e2cc4b75833bf71a5e18", + "sha256:39746b5f7d847a23fae4eac893e63e3d9cc5f8c3a4797fcd3bfa8d1a296ec6ed" ], - "version": "==5.1.4" + "version": "==5.2.0" }, "ipython": { "hashes": [ @@ -1178,11 +1179,11 @@ }, "wcwidth": { "hashes": [ - "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603", - "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8" + "sha256:cafe2186b3c009a04067022ce1dcd79cb38d8d65ee4f4791b8888d6599d1bbe1", + "sha256:ee73862862a156bf77ff92b09034fc4825dd3af9cf81bc5b360668d425f3c5f1" ], "index": "pypi", - "version": "==0.1.8" + "version": "==0.1.9" }, "webencodings": { "hashes": [ diff --git a/backend/metagenedb/settings/django.py b/backend/metagenedb/settings/django.py index 35e6f33..ef58c6e 100644 --- a/backend/metagenedb/settings/django.py +++ b/backend/metagenedb/settings/django.py @@ -23,6 +23,15 @@ INSTALLED_APPS = [ 'corsheaders', 'drf_yasg', 'django_admin_listfilter_dropdown', + + # Running Health Checks + 'health_check', + 'health_check.db', + 'health_check.cache', + 'health_check.contrib.celery', + + # Test Celery beat + 'metagenedb.demoapp' ] MIDDLEWARE = [ diff --git a/backend/metagenedb/urls.py b/backend/metagenedb/urls.py index cc83bb9..97910ed 100644 --- a/backend/metagenedb/urls.py +++ b/backend/metagenedb/urls.py @@ -40,4 +40,5 @@ urlpatterns = [ url(r'^swagger(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'), url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), + url(r'^ht/', include('health_check.urls')), ] diff --git a/ci/kubernetes/redis.yaml b/ci/kubernetes/redis.yaml index 206fd37..3e184e5 100644 --- a/ci/kubernetes/redis.yaml +++ b/ci/kubernetes/redis.yaml @@ -15,7 +15,7 @@ spec: pod: redis spec: containers: - - name: master + - name: redis-app image: redis resources: requests: diff --git a/nginx/dev/nginx.conf b/nginx/dev/nginx.conf index c2d8bd6..957ca61 100644 --- a/nginx/dev/nginx.conf +++ b/nginx/dev/nginx.conf @@ -49,7 +49,7 @@ http { } # backend urls - location ~ ^/(admin|api|swagger|redoc|static) { + location ~ ^/(admin|api|swagger|redoc|static|ht) { proxy_redirect off; proxy_pass http://backend; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -- GitLab