feat: add health check and restore frontend routes

Health check endpoint:
- Add /health endpoint that pings database with 2-second timeout
- Returns 200 when DB connected, 503 when unavailable
- Provides true end-to-end health verification

Frontend routes restoration (routes removed in c5f327b):
- Add public routes: /, /login, /register with smart auth detection
- Add redirect routes: /bookshelf, /dashboard
- Add admin routes: /admin, /admin/profile, /admin/library
- Add SSR routes: /api/devices-page, /api/conflicts-page
- Add 'FRONTEND ROUTES - DO NOT DELETE' comment block to prevent future removal

Docker Compose healthcheck:
- Update to use curl on /health endpoint (pg_isready not in Alpine)
- Add 10s start_period for app initialization
- Accurately reflects app + database health status

All changes maintain backward compatibility and existing API behavior.
This commit is contained in:
2026-02-06 10:52:54 -05:00
parent 79373dd225
commit 2a7338200c
2 changed files with 225 additions and 2 deletions
+3 -2
View File
@@ -53,10 +53,11 @@ services:
- ./uploads:/app/uploads
- bookhoard_conversion_cache:/app/cache/kepub
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
test: ["CMD-SHELL", "curl -f http://localhost:8765/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# Named Volumes
volumes: