festifun/deploy/festifun-api.service
m3ultra 931cf81a6c Deploy-ready: path-prefix hosting (digalot.fyi/festifun) + deploy artifacts
Frontend: API_BASE env-driven (VITE_API_BASE, default localhost:8000 so dev is
unchanged); vite.config.js base from FESTIVAL4D_BASE. Prod build
'FESTIVAL4D_BASE=/festifun/ VITE_API_BASE=/festifun' serves same-origin under
the prefix. Validated end-to-end via a local proxy mirroring the nginx config:
app boots, media Range 206, 3D + overlays + timeline render under /festifun.

deploy/: nginx location blocks (prefix strip + Range), systemd unit
(uvicorn 127.0.0.1:8000, no keys on the public box), DEPLOY.md. Labels baked
into the shipped DB locally so detect can't spend credits from an anonymous
public endpoint. Backend suite 103 passed; default build unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 13:20:36 +10:00

29 lines
1.1 KiB
Desktop File

# Festival 4D backend — systemd unit (uvicorn on 127.0.0.1:8000, localhost-only)
#
# Install: sudo cp deploy/festifun-api.service /etc/systemd/system/
# sudo systemctl daemon-reload && sudo systemctl enable --now festifun-api
# Logs: journalctl -u festifun-api -f
#
# The service binds 127.0.0.1 only — nginx is the sole public entry point. Adjust User,
# paths, and the venv location to match the server.
[Unit]
Description=Festival 4D API (uvicorn)
After=network.target
[Service]
Type=simple
User=dealgod
WorkingDirectory=/var/www/festifun/backend
# The app reads FESTIVAL4D_DATA_DIR for the project (db + media + point cloud).
Environment=FESTIVAL4D_DATA_DIR=/var/www/festifun/data
# NOTE: no GEMINI_API_KEY / OPENROUTER creds here on purpose — see DEPLOY.md "AI classification".
# Moment labels are baked into the shipped DB by running `events` locally before deploy, so the
# public box needs no keys and POST /api/events/detect degrades to candidates-only (no spend).
ExecStart=/var/www/festifun/.venv/bin/python -m uvicorn festival4d.api:app --host 127.0.0.1 --port 8000
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target