Skip to content

Commit 0e8fb80

Browse files
committed
Add healthcheck endpoint.
1 parent 2f4351e commit 0e8fb80

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

api/api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,15 @@ async def delete_wiki_cache(
471471
logger.warning(f"Wiki cache not found, cannot delete: {cache_path}")
472472
raise HTTPException(status_code=404, detail="Wiki cache not found")
473473

474+
@app.get("/health")
475+
async def health_check():
476+
"""Health check endpoint for Docker and monitoring"""
477+
return {
478+
"status": "healthy",
479+
"timestamp": datetime.now().isoformat(),
480+
"service": "deepwiki-api"
481+
}
482+
474483
@app.get("/")
475484
async def root():
476485
"""Root endpoint to check if the API is running"""
@@ -489,6 +498,9 @@ async def root():
489498
],
490499
"LocalRepo": [
491500
"GET /local_repo/structure - Get structure of a local repository (with path parameter)",
501+
],
502+
"Health": [
503+
"GET /health - Health check endpoint"
492504
]
493505
}
494506
}

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ services:
2020
# Resource limits for docker-compose up (not Swarm mode)
2121
mem_limit: 6g
2222
mem_reservation: 2g
23+
# Health check configuration
24+
healthcheck:
25+
test: ["CMD", "curl", "-f", "http://localhost:${PORT:-8001}/health"]
26+
interval: 60s
27+
timeout: 10s
28+
retries: 3
29+
start_period: 30s

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev --turbopack",
6+
"dev": "next dev --turbopack --port 3000",
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint"

0 commit comments

Comments
 (0)