Skip to content

Commit 82e90cd

Browse files
authored
Merge pull request #77 from gcivil-nyu-org/darsh
Add /health endpoint and configure EB health check path
2 parents f744997 + 06016c1 commit 82e90cd

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.ebextensions/django.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ option_settings:
33
WSGIPath: restaurants.wsgi:application
44
aws:autoscaling:launchconfiguration:
55
InstanceType: t3.micro
6+
aws:elasticbeanstalk:environment:process:default:
7+
HealthCheckPath: /health/
68

79
container_commands:
810
00_create_db:

nomz/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
urlpatterns = [
66
path('', views.landing_page, name='landing'),
7+
path('health/', views.health_check, name='health_check'),
78
path('home/', views.home, name='home'),
89
path('map/', views.map_view, name='map'),
910
path('api/restaurants/map-data/', api_views.map_restaurant_data, name='api_restaurants_map'),

nomz/views.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.http import HttpResponseForbidden
1+
from django.http import HttpResponseForbidden, JsonResponse
22
from django.shortcuts import get_object_or_404, render, redirect
33
from django.contrib.auth import authenticate, login, logout
44
from django.contrib.auth.decorators import login_required
@@ -40,6 +40,14 @@ def home(request):
4040
return render(request, 'nomz/home.html', context)
4141

4242

43+
def health_check(request):
44+
"""
45+
Lightweight health endpoint for ELB/EB health checks.
46+
Must return HTTP 200 quickly and without auth redirects.
47+
"""
48+
return JsonResponse({"status": "ok"}, status=200)
49+
50+
4351
def map_view(request):
4452
"""
4553
Render interactive restaurant map page with filters and server-provided options.

0 commit comments

Comments
 (0)