chore: scaffold backend venv, health check, systemd unit

This commit is contained in:
Indiana
2026-07-20 14:52:53 +00:00
parent 7ab8adce83
commit 1736dd021b
8 changed files with 54 additions and 1 deletions

4
.env.example Normal file
View File

@@ -0,0 +1,4 @@
DATABASE_URL=postgresql+asyncpg://quantumancy:quantumancy@localhost:5432/quantumancy
OLLAMA_BASE_URL=http://10.30.20.107:11434
SESSION_SECRET=change-me-to-a-random-64-char-string
PORT=7777

7
.gitignore vendored
View File

@@ -1 +1,6 @@
.worktrees/
backend/venv/
__pycache__/
*.pyc
.env
frontend/node_modules/
frontend/dist/

0
backend/app/__init__.py Normal file
View File

8
backend/app/main.py Normal file
View File

@@ -0,0 +1,8 @@
from fastapi import FastAPI
app = FastAPI(title="Quantumancy")
@app.get("/healthz")
async def healthz():
return {"status": "ok"}

2
backend/pytest.ini Normal file
View File

@@ -0,0 +1,2 @@
[pytest]
asyncio_mode = auto

10
backend/requirements.txt Normal file
View File

@@ -0,0 +1,10 @@
fastapi==0.115.0
uvicorn[standard]==0.32.0
sqlalchemy[asyncio]==2.0.36
asyncpg==0.30.0
pydantic-settings==2.6.1
argon2-cffi==23.1.0
httpx==0.27.2
numpy==2.1.3
pytest==8.3.3
pytest-asyncio==0.24.0

View File

@@ -0,0 +1,10 @@
from fastapi.testclient import TestClient
from app.main import app
def test_healthz_returns_ok():
client = TestClient(app)
response = client.get("/healthz")
assert response.status_code == 200
assert response.json() == {"status": "ok"}

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Quantumancy web app
After=network.target postgresql.service
[Service]
Type=simple
WorkingDirectory=/root/quantumancy/backend
EnvironmentFile=/root/quantumancy/.env
ExecStart=/root/quantumancy/backend/venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 7777
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target