Skip to content

Commit

Permalink
fix: added healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
black-redoc committed May 18, 2024
1 parent 246cf7c commit 8dfca5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ jobs:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
healthcheck: "https://${secrets.HEROKU_APP}}/healthcheck"
rollbackonhealthcheckfailed: true
10 changes: 10 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ async def lifespan(app: FastAPI):
models.Base.metadata.create_all(bind=engine)


@app.get("/healthcheck")
def health():
return "OK"


@app.get("/", status_code=200)
def health():
return None


@app.middleware("http")
async def db_session_middleware(request: Request, call_next):
response = Response("Internal server error", status_code=500)
Expand Down

0 comments on commit 8dfca5f

Please sign in to comment.