File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ services:
7070 migration :
7171 condition : service_completed_successfully
7272 healthcheck :
73- test : ["CMD-SHELL", "curl -f http://localhost:8080/docs || exit 1"]
73+ test : ["CMD-SHELL", "curl -f http://localhost:8080/ready || exit 1"]
7474 interval : 5s
7575 timeout : 10s
7676 retries : 10
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ services:
6363 migration :
6464 condition : service_completed_successfully
6565 healthcheck :
66- test : ["CMD-SHELL", "curl -f http://localhost:8080/docs || exit 1"]
66+ test : ["CMD-SHELL", "curl -f http://localhost:8080/ready || exit 1"]
6767 interval : 10s
6868 timeout : 10s
6969 retries : 5
Original file line number Diff line number Diff line change 11from contextlib import asynccontextmanager
22
3- from fastapi import APIRouter , FastAPI
3+ from fastapi import APIRouter , Depends , FastAPI
4+ from sqlalchemy import text
5+ from sqlalchemy .orm import Session
46
57from strava .config import settings
8+ from strava .db .depends import get_db
69from strava .db .session import engine
710from strava .observability import configure_observability
811from strava .routes import routes
@@ -21,3 +24,14 @@ async def lifespan(_: FastAPI):
2124app = FastAPI (title = settings .PROJECT_NAME , lifespan = lifespan )
2225configure_observability (app , settings , engine )
2326app .include_router (v1_router , prefix = settings .API_V1_STR )
27+
28+
29+ @app .get ("/health" )
30+ async def health ():
31+ return {"status" : "ok" }
32+
33+
34+ @app .get ("/ready" )
35+ def ready (db : Session = Depends (get_db )):
36+ db .execute (text ("SELECT 1" ))
37+ return {"status" : "ok" }
You can’t perform that action at this time.
0 commit comments