feat: add backend CI/CD deployment

This commit is contained in:
hailt 2026-11-12 21:32:31 +07:00
parent 8d40cff227
commit 7c2e6ed571
21 changed files with 269 additions and 41 deletions

View file

@ -73,10 +73,10 @@ async def init_db():
await conn.run_sync(Base.metadata.create_all)
factory = get_session_factory()
async with factory() as s:
admin = (await s.execute(select(User).where(User.email == "admin@danable.local"))).scalar_one_or_none()
admin = (await s.execute(select(User).where(User.email == "admin@danagble.local"))).scalar_one_or_none()
if admin is None:
s.add(User(email="admin@danable.local", name="Admin", role="admin",
s.add(User(email="admin@danagble.local", name="Admin", role="admin",
status="active", password_hash=hash_password("Admin123!"),
assigned_project_ids=[]))
await s.commit()
return {"ok": True, "seeded_admin": "admin@danable.local"}
return {"ok": True, "seeded_admin": "admin@danagble.local"}

View file

@ -25,11 +25,11 @@ class Settings:
self.yaml = _load_yaml()
app = self.yaml.get("app", {})
storage = self.yaml.get("storage", {})
self.app_name: str = app.get("name", "danable")
self.app_name: str = app.get("name", "danagble")
self.api_prefix: str = app.get("api_prefix", "/api/v1")
self.database_url: str = os.getenv(
"DATABASE_URL", "postgresql+asyncpg://danable:danable@localhost:5432/danable"
"DATABASE_URL", "postgresql+asyncpg://danagble:danagble@localhost:5432/danagble"
)
self.redis_url: str = os.getenv("REDIS_URL", "redis://localhost:6379/0")
self.jwt_secret: str = os.getenv("JWT_SECRET", "change-me")

View file

@ -17,7 +17,7 @@ from src.core.config import get_settings
from src.core.security import get_current_user
s = get_settings()
log = get_logger("danable")
log = get_logger("danagble")
@asynccontextmanager

View file

@ -24,7 +24,7 @@ from shared.schemas import AnnotationShape, AnnotationUpsert, Flags
from shared.thumbnails import IMMUTABLE, resize_to_thumbnail
from src.core.db import get_session_factory
log = get_logger("danable.imports")
log = get_logger("danagble.imports")
IMAGE_EXTS = (".jpg", ".jpeg", ".png", ".webp", ".bmp")
PUT_CONCURRENCY = 24
@ -135,7 +135,7 @@ async def start_r2_zip(project_id: str, r2_key: str, db: AsyncSession) -> dict:
async def _run_r2_zip(job_id: str, project_id: str, r2_key: str) -> None:
import tempfile
tmp = tempfile.mktemp(prefix=f"danable-import-{job_id}-", suffix=".zip")
tmp = tempfile.mktemp(prefix=f"danagble-import-{job_id}-", suffix=".zip")
try:
await asyncio.to_thread(r2.download_to_file, r2_key, tmp)
await _run_zip_coco(job_id, project_id, tmp)