feat: add authentication and user management with Authentik integration
Build and Push / build (release) Successful in 1m16s

- Add PostgreSQL database with async SQLAlchemy
- Add Alembic migrations for schema management
- Add User, Role, UserPreferences, ApiKey models
- Add auth endpoints: /auth/me, /auth/users, /auth/users/sync-from-authentik
- Add token validation via Authentik userinfo endpoint
- Add bulk user sync from Authentik admin API
- Add database health check to diagnostics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeroen Schweitzer
2026-01-01 20:25:03 +01:00
co-authored by Claude Opus 4.5
parent cdb6344013
commit 4f45f9bf37
22 changed files with 1753 additions and 23 deletions
+22 -9
View File
@@ -10,6 +10,7 @@ from src.controllers.base import BaseController
from src.config import get_settings
from src.logging_config import get_logger
from src.models.ollama_client import get_ollama_client
from src.db import get_database
@@ -59,18 +60,15 @@ class HealthController(BaseController):
)
async def health_check():
"""
Simple health check endpoint for container orchestration
Fast health check endpoint for container orchestration
Returns a 200 OK status when the service is running properly.
Used by Docker, Kubernetes, and load balancers.
Returns a 200 OK immediately if the service is running.
Does NOT check backend connectivity (use /health/full for that).
Used by Docker, Kubernetes, and load balancers for liveness probes.
"""
ollama_client = get_ollama_client()
ollama_healthy = await ollama_client.health_check()
return {
"status": "healthy",
"version": settings.app_version,
"ollama_connected": ollama_healthy
"version": settings.app_version
}
@router.get(
@@ -131,7 +129,18 @@ class HealthController(BaseController):
ollama_error = str(e)
logger.warning(f"Ollama health check failed: {ollama_error}")
is_healthy = ollama_healthy
# Check 2: Database connection
database = get_database()
db_healthy = False
db_error = None
try:
db_healthy = await database.health_check()
except Exception as e:
db_error = str(e)
logger.warning(f"Database health check failed: {db_error}")
is_healthy = ollama_healthy and db_healthy
elapsed_ms = int((time.time() - start_time) * 1000)
status_code = 200 if is_healthy else 503
@@ -149,6 +158,10 @@ class HealthController(BaseController):
"available": False
},
"error": ollama_error
},
"database": {
"status": "✅ healthy" if db_healthy else "❌ unhealthy",
"error": db_error
}
}
}