2.2 KiB
2.2 KiB
Magisches Harry Potter Escape Quiz Portal
Interaktives Harry Potter Escape Quiz Portal (FastAPI & MariaDB).
Systemanforderungen
- Debian 12 / 13 (oder kompatibles Linux)
- Python 3.13+ mit
python3-venv - Nginx (Reverse Proxy mit SSL)
- MariaDB Server auf `db.waiswuaschd.de:3306` (Datenbank: `v2_db_quiz`)
1. Installation
# Repository klonen
cd /home/maxi/Projekt
git clone https://gitea.sp13l.de/kobold-ai/quiz.git quiz.waiswuaschd.de
cd quiz.waiswuaschd.de
# Python Virtualenv erstellen und Abh?ngigkeiten installieren
python3 -m venv venv
./venv/bin/pip install --upgrade pip
./venv/bin/pip install -r requirements.txt
2. Umgebungsvariablen (.env)
Erstelle im Projektverzeichnis eine .env Datei:
DB_HOST=db.waiswuaschd.de
DB_PORT=3306
DB_NAME=v2_db_quiz
DB_USER=v2_usr_quiz
DB_PASS=Quiz_Pass_2026_Secure!
SECRET_KEY=hogwarts_magic_super_secret_key_2026_dev_quiz
ADMIN_USER=admin
ADMIN_PASS=Alohomora2026!
PORT=8001
3. Systemd Service (/etc/systemd/system/quiz.service)
[Unit]
Description=Magisches Quiz Portal (FastAPI)
After=network.target
[Service]
User=maxi
Group=maxi
WorkingDirectory=/home/maxi/Projekt/quiz.waiswuaschd.de
ExecStart=/home/maxi/Projekt/quiz.waiswuaschd.de/venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8001 --workers 1
Restart=always
RestartSec=5
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
Aktivieren und starten:
sudo systemctl daemon-reload
sudo systemctl enable --now quiz
4. Nginx Reverse Proxy
server {
listen 80;
server_name quiz.dev.waiswuaschd.de;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name quiz.dev.waiswuaschd.de;
# SSL Zertifikate hier konfigurieren (z. B. via certbot)
location /static/ {
alias /home/maxi/Projekt/quiz.waiswuaschd.de/app/static/;
add_header Cache-Control "public, max-age=3600, must-revalidate";
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}