Skip to content

Commit

Permalink
Merge pull request #2 from black-redoc/fix/healthcheck
Browse files Browse the repository at this point in the history
fix: added healthcheck
  • Loading branch information
black-redoc authored May 18, 2024
2 parents 246cf7c + 8dfca5f commit 8fed510
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 8fed510

Please sign in to comment.