Skip to content

Commit

Permalink
feat(api): add healthcheck endpoints using django-health-check (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon authored Jul 17, 2024
1 parent 82f1654 commit 3c225d1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 20 deletions.
12 changes: 12 additions & 0 deletions default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
'rest_framework_simplejwt',
'drf_spectacular',
'corsheaders',
'health_check',
'health_check.db',
'health_check.contrib.migrations',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -261,3 +264,12 @@

# Controls values of metadata accessibility field that will turn the metadata public
METADATA_PUBLIC_ACCESSIBILITIES = ['PUBLIC', 'APPROVAL_NEEDED']

# Healthcheck subsets configuration
HEALTH_CHECK = {
"SUBSETS": {
"startup": ["MigrationsHealthCheck", "DatabaseBackend"],
"readiness": ["DatabaseBackend"],
"liveness": []
},
}
50 changes: 30 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,52 @@
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
# pipenv lock && pipenv requirements > requirements.txt
#

-i https://pypi.org/simple/
-i https://pypi.org/simple
--extra-index-url https://pypi.org/simple/
asgiref==3.7.2; python_version >= '3.7'
attrs==23.2.0; python_version >= '3.7'
babel==2.12.1; python_version >= '3.7'
certifi==2023.7.22; python_version >= '3.6'
cffi==1.15.1
charset-normalizer==3.1.0; python_version >= '3.7'
cryptography==41.0.1
charset-normalizer==3.1.0; python_full_version >= '3.7.0'
cryptography==41.0.1; python_version >= '3.7'
defusedxml==0.7.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
django==4.1.10; python_version >= '3.8'
django-allauth==0.51.0
django-cors-headers==3.13.0
django-filter==22.1
django-money==3.0.0
django==4.1.10
django-cors-headers==3.13.0; python_version >= '3.7'
django-filter==22.1; python_version >= '3.7'
django-health-check==3.18.3; python_version >= '3.8'
django-money==3.0.0; python_version >= '3.7'
djangorestframework==3.14.0; python_version >= '3.6'
djangorestframework-gis==1.0
djangorestframework-simplejwt==5.2.1
djangorestframework==3.14.0
gunicorn==20.1.0
djangorestframework-simplejwt==5.2.1; python_version >= '3.7'
drf-spectacular==0.27.1; python_version >= '3.6'
gunicorn==20.1.0; python_version >= '3.5'
idna==3.7; python_version >= '3.5'
markdown==3.4.1
inflection==0.5.1; python_version >= '3.5'
jsonschema==4.23.0; python_version >= '3.8'
jsonschema-specifications==2023.12.1; python_version >= '3.8'
markdown==3.4.1; python_version >= '3.7'
oauthlib==3.2.2; python_version >= '3.6'
psycopg2==2.9.4
psycopg2==2.9.4; python_version >= '3.6'
py-moneyed==2.0; python_version >= '3.6'
pycparser==2.21
pyjwt[crypto]==2.7.0; python_version >= '3.7'
python-dotenv==0.21.0
python-dotenv==0.21.0; python_version >= '3.7'
python3-openid==3.2.0
pytz==2023.3
requests-oauthlib==1.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pyyaml==6.0.1; python_version >= '3.6'
referencing==0.35.1; python_version >= '3.8'
requests==2.31.0; python_version >= '3.7'
setuptools==68.0.0; python_version >= '3.7'
sqlparse==0.5.0; python_version >= '3.5'
requests-oauthlib==1.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
rpds-py==0.19.0; python_version >= '3.8'
setuptools==70.3.0; python_version >= '3.8'
sqlparse==0.5.0; python_version >= '3.8'
typing-extensions==4.7.1; python_version >= '3.7'
unidecode==1.3.6
unidecode==1.3.6; python_version >= '3.5'
uritemplate==4.1.1; python_version >= '3.6'
urllib3==2.0.3; python_version >= '3.7'
whitenoise==6.2.0
drf-spectacular==0.27.1
whitenoise==6.2.0; python_version >= '3.7'
1 change: 1 addition & 0 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@
path('', include(router.urls)),
path('api/docs/schema', SpectacularAPIView.as_view(), name='schema'),
path('api/docs/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('health/', include('health_check.urls')),
] + static(settings.STATIC_URL,document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)

0 comments on commit 3c225d1

Please sign in to comment.