chore: scaffold backend venv, health check, systemd unit
This commit is contained in:
4
.env.example
Normal file
4
.env.example
Normal 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
7
.gitignore
vendored
@@ -1 +1,6 @@
|
||||
.worktrees/
|
||||
backend/venv/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
frontend/node_modules/
|
||||
frontend/dist/
|
||||
|
||||
0
backend/app/__init__.py
Normal file
0
backend/app/__init__.py
Normal file
8
backend/app/main.py
Normal file
8
backend/app/main.py
Normal 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
2
backend/pytest.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
asyncio_mode = auto
|
||||
10
backend/requirements.txt
Normal file
10
backend/requirements.txt
Normal 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
|
||||
10
backend/tests/test_health.py
Normal file
10
backend/tests/test_health.py
Normal 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"}
|
||||
14
deploy/quantumancy.service
Normal file
14
deploy/quantumancy.service
Normal 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
|
||||
Reference in New Issue
Block a user