Stelle den ersten nutzbaren Ablauf zum Organisieren und Nachverfolgen bereit.
Deploy Development / deploy (push) Successful in 23s
Deploy Development / deploy (push) Successful in 23s
Anmeldung, Datenraeume, Akten, Vorgaenge, gemeinsame Notizen, Dateien, manuelle Paperless-Referenzen, Aufgaben und unabhaengige Fristen laufen damit in der Entwicklungsumgebung. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
cfe17ff909
commit
2558239bfd
60 files changed
+8467
-71
No files matched your search
+3
-40
@@ -1,42 +1,5 @@
|
||||
"""Tsumugu — schmales Startgerüst, damit der Pi-Deploy einen Health-Check hat."""
|
||||
"""Uvicorn entry: `uvicorn main:app`."""
|
||||
|
||||
from __future__ import annotations
|
||||
from app.main import app
|
||||
|
||||
import os
|
||||
|
||||
import psycopg2
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
app = FastAPI(title="Tsumugu", docs_url=None, redoc_url=None)
|
||||
|
||||
|
||||
def _database_status() -> str:
|
||||
try:
|
||||
connection = psycopg2.connect(
|
||||
host=os.environ.get("DB_HOST", "postgres"),
|
||||
port=os.environ.get("DB_PORT", "5432"),
|
||||
dbname=os.environ.get("DB_NAME", "tsumugu"),
|
||||
user=os.environ.get("DB_USER", "tsumugu"),
|
||||
password=os.environ.get("DB_PASSWORD", ""),
|
||||
connect_timeout=3,
|
||||
)
|
||||
connection.close()
|
||||
except Exception:
|
||||
return "error"
|
||||
return "ok"
|
||||
|
||||
|
||||
@app.get("/api/health")
|
||||
def api_health():
|
||||
database = _database_status()
|
||||
status = "ok" if database == "ok" else "degraded"
|
||||
return JSONResponse(
|
||||
status_code=200 if database == "ok" else 503,
|
||||
content={
|
||||
"status": status,
|
||||
"app": "tsumugu",
|
||||
"env": os.environ.get("TSUMUGU_ENV", "development"),
|
||||
"db": database,
|
||||
},
|
||||
)
|
||||
__all__ = ["app"]
|
||||
Reference in new issue
Block a user