-
Notifications
You must be signed in to change notification settings - Fork 2
Health routes for status page #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
edd7540
some health changes
sritanmotati 74a147b
example frontend page for health check
sritanmotati 002db1a
fixed lint issue
sritanmotati 5287ddf
frontend health route
sritanmotati aa6e90f
backend health check
sritanmotati 6637972
backend + k8s update
sritanmotati 8bc32f8
fixed frontend/backend check issues
sritanmotati 579bf29
restored yarn lock
sritanmotati 4f06e73
Merge branch 'master' of https://github.com/pennlabs/platform into sr…
sritanmotati 77e0157
pls work
sritanmotati 695aa58
more linting :sob:
sritanmotati c0eeede
bro
sritanmotati 0e5721a
auth type fix
sritanmotati e7a2dbe
pls fix lint
sritanmotati 318758f
attempt #2
sritanmotati 7d23da1
attempt #2
sritanmotati b25746f
attempt #3
sritanmotati e361ecb
healthbackend:health renamed to healthcheck:backend
sritanmotati 9c45ed2
brought back extra line at the end in yarn.lock
sritanmotati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from django.http import HttpResponse | ||
|
|
||
|
|
||
| class HealthCheckMiddleware: | ||
| def __init__(self, get_response): | ||
| self.get_response = get_response | ||
|
|
||
| def __call__(self, request): | ||
| if request.path == "/health": | ||
| return HttpResponse("ok") | ||
| return self.get_response(request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class HealthConfig(AppConfig): | ||
| name = "health" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class HealthConfig(AppConfig): | ||
| name = "health" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from django.urls import path | ||
| from health.views import HealthView | ||
|
|
||
|
|
||
| app_name = "health" | ||
|
|
||
| urlpatterns = [ | ||
| path("backend/", HealthView.as_view(), name="backend"), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from http import HTTPStatus | ||
|
|
||
| from django.http import JsonResponse | ||
| from django.views.generic import View | ||
|
|
||
|
|
||
| class HealthView(View): | ||
| def get(self, request): | ||
| """ | ||
| Health check endpoint to confirm the backend is running. | ||
| --- | ||
| summary: Health Check | ||
| responses: | ||
| "200": | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| message: | ||
| type: string | ||
| enum: ["OK"] | ||
| --- | ||
| """ | ||
| return JsonResponse({"message": "OK"}, status=HTTPStatus.OK) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| /// <reference types="next" /> | ||
| /// <reference types="next/types/global" /> | ||
| /// <reference types="next/image-types/global" /> | ||
|
|
||
| // NOTE: This file should not be edited | ||
| // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { GetServerSideProps } from "next"; | ||
|
|
||
| const HealthPage = () => { | ||
| return <div>OK</div>; | ||
| }; | ||
|
|
||
| export const getServerSideProps: GetServerSideProps = async ({ req }) => { | ||
| const userAgent = req.headers["user-agent"] || ""; | ||
|
|
||
| if (userAgent !== "service-status") { | ||
| return { | ||
| redirect: { | ||
| destination: "/", | ||
| permanent: false, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| props: {}, | ||
| }; | ||
| }; | ||
|
|
||
| export default HealthPage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.