Deployment vorbereitet: systemd-Unit, Nginx-Vhost, Static unter /admin/static
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,8 @@ from flask import (
|
|||||||
|
|
||||||
from . import engine, storage
|
from . import engine, storage
|
||||||
|
|
||||||
app = Flask(__name__)
|
# Static unter /admin/static, damit Nginx nur eine /admin-Location braucht.
|
||||||
|
app = Flask(__name__, static_url_path="/admin/static")
|
||||||
# Secret nur fuer Flash-Messages; bei Neustart verfallende Session ist ok.
|
# Secret nur fuer Flash-Messages; bei Neustart verfallende Session ist ok.
|
||||||
app.secret_key = os.environ.get("QT_SECRET_KEY") or os.urandom(16)
|
app.secret_key = os.environ.get("QT_SECRET_KEY") or os.urandom(16)
|
||||||
|
|
||||||
|
|||||||
22
deploy/nginx-table.lehrstun.de.conf
Normal file
22
deploy/nginx-table.lehrstun.de.conf
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# /etc/nginx/sites-available/table.lehrstun.de
|
||||||
|
# Oeffentliche Tabellen: statisch aus /var/www/table (App-Ausfall egal).
|
||||||
|
# Admin-Panel: Proxy auf gunicorn, hinter Basic Auth.
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name table.lehrstun.de;
|
||||||
|
|
||||||
|
root /var/www/table;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location = / { return 302 /admin/; }
|
||||||
|
location = /admin { return 302 /admin/; }
|
||||||
|
|
||||||
|
location /admin/ {
|
||||||
|
auth_basic "QR-Tabellen Admin";
|
||||||
|
auth_basic_user_file /etc/nginx/htpasswd-table;
|
||||||
|
proxy_pass http://127.0.0.1:8010;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
client_max_body_size 10m;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
deploy/qr-tabellen.service
Normal file
15
deploy/qr-tabellen.service
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# /etc/systemd/system/qr-tabellen.service
|
||||||
|
[Unit]
|
||||||
|
Description=QR-Tabellen Admin-Panel (table.lehrstun.de)
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=herb
|
||||||
|
WorkingDirectory=/home/herb/qr-tabellen
|
||||||
|
Environment=QT_BASE_URL=https://table.lehrstun.de
|
||||||
|
Environment=QT_PUBLIC_DIR=/var/www/table
|
||||||
|
ExecStart=/home/herb/qr-tabellen/venv/bin/gunicorn -w 2 -b 127.0.0.1:8010 app.main:app
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user