@@ -0,0 +1,21 @@
|
||||
# Apache >=2.4.47; Module: proxy proxy_http headers alias
|
||||
# HTTPS danach mit certbot --apache; keine Parallelbelegung mit Nginx.
|
||||
<VirtualHost *:80>
|
||||
ServerName dashboard.example.com
|
||||
ProxyRequests Off
|
||||
ProxyPreserveHost On
|
||||
ProxyTimeout 75
|
||||
# Funktioniert auch nach Certbot-Kopie in einen SSL-vHost.
|
||||
RequestHeader set X-Forwarded-Proto "expr=%{REQUEST_SCHEME}"
|
||||
ProxyPass /static/ !
|
||||
Alias /static/ /opt/dilib-dashboard/staticfiles/
|
||||
<Directory /opt/dilib-dashboard/staticfiles/>
|
||||
Require all granted
|
||||
</Directory>
|
||||
ProxyPass /api/ http://127.0.0.1:8000/api/
|
||||
ProxyPassReverse /api/ http://127.0.0.1:8000/api/
|
||||
ProxyPass /admin/ http://127.0.0.1:8000/admin/
|
||||
ProxyPassReverse /admin/ http://127.0.0.1:8000/admin/
|
||||
ProxyPass / http://127.0.0.1:8080/ upgrade=websocket timeout=3600
|
||||
ProxyPassReverse / http://127.0.0.1:8080/
|
||||
</VirtualHost>
|
||||
@@ -0,0 +1,3 @@
|
||||
FLOWER_BROKER_URL=redis://127.0.0.1:6379/0
|
||||
FLOWER_DB=/var/lib/dilib-flower/flower
|
||||
FLOWER_BASIC_AUTH=monitor:CHANGE_ME
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Use once per Celery cluster. This is Flower's local file, NOT PostgreSQL."""
|
||||
import os
|
||||
persistent=True
|
||||
db=os.getenv('FLOWER_DB','/var/lib/dilib-flower/flower')
|
||||
state_save_interval=10000
|
||||
address='127.0.0.1'
|
||||
port=5555
|
||||
read_only=True
|
||||
max_tasks=100000
|
||||
credential=os.environ.get('FLOWER_BASIC_AUTH','')
|
||||
if ':' not in credential or 'CHANGE_ME' in credential or not credential.split(':',1)[1]:
|
||||
raise RuntimeError('Set FLOWER_BASIC_AUTH to a real username:password before starting Flower')
|
||||
basic_auth=[credential]
|
||||
@@ -0,0 +1,24 @@
|
||||
# In http{} einbinden. HTTPS danach über certbot --nginx.
|
||||
server {
|
||||
listen 80;
|
||||
server_name dashboard.example.com;
|
||||
client_max_body_size 2m;
|
||||
location /static/ { alias /opt/dilib-dashboard/staticfiles/; }
|
||||
location ~ ^/(api|admin)/ {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 75s;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# Copy into /etc/nginx/sites-available/dilib-dashboard after replacing hostname and cert paths.
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
limit_req_zone $binary_remote_addr zone=dilib_login:10m rate=10r/m;
|
||||
server {
|
||||
listen 80;
|
||||
server_name dashboard.example.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name dashboard.example.com;
|
||||
ssl_certificate /etc/letsencrypt/live/dashboard.example.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/dashboard.example.com/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
client_max_body_size 2m;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
location /static/ { alias /opt/dilib-dashboard/staticfiles/; }
|
||||
location = /api/auth/login/ {
|
||||
limit_req zone=dilib_login burst=10 nodelay;
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
location ~ ^/(api|admin)/ {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_read_timeout 75s;
|
||||
}
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=dilib host agent and optional Celery collector
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
User=dilib-agent
|
||||
Group=dilib-agent
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-agent/agent.env
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
ExecStart=/opt/dilib-dashboard/.venv-agent/bin/python -m agent.main
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=90
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
ReadWritePaths=/var/lib/dilib-agent
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=dilib Operations api
|
||||
After=network-online.target postgresql.service redis-server.service
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dilib
|
||||
Group=dilib
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-dashboard/dashboard.env
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment=NICEGUI_STORAGE_PATH=/var/lib/dilib-dashboard/nicegui
|
||||
Environment=MPLCONFIGDIR=/var/lib/dilib-dashboard/matplotlib
|
||||
ExecStart=/opt/dilib-dashboard/.venv/bin/gunicorn config.wsgi:application --bind 127.0.0.1:8000 --workers 3 --timeout 90 --access-logfile -
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=60
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/dilib-dashboard
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=dilib PostgreSQL local backup
|
||||
After=postgresql.service
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=postgres
|
||||
Group=postgres
|
||||
ExecStart=/bin/bash /opt/dilib-dashboard/scripts/backup.sh /var/lib/postgresql/dilib-backups
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Daily dilib database backup
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 02:15:00
|
||||
RandomizedDelaySec=600
|
||||
Persistent=true
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=dilib Operations beat
|
||||
After=network-online.target postgresql.service redis-server.service
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dilib
|
||||
Group=dilib
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-dashboard/dashboard.env
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment=NICEGUI_STORAGE_PATH=/var/lib/dilib-dashboard/nicegui
|
||||
Environment=MPLCONFIGDIR=/var/lib/dilib-dashboard/matplotlib
|
||||
ExecStart=/opt/dilib-dashboard/.venv/bin/celery -A config beat --loglevel=INFO --schedule /var/lib/dilib-dashboard/celerybeat-schedule
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=60
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/dilib-dashboard
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,20 @@
|
||||
[Unit]
|
||||
Description=Flower with persistent local state
|
||||
After=network-online.target
|
||||
[Service]
|
||||
User=dilib-agent
|
||||
Group=dilib-agent
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-agent/flower.env
|
||||
ExecStart=/opt/dilib-dashboard/.venv-agent/bin/celery --broker=${FLOWER_BROKER_URL} flower --conf=/opt/dilib-dashboard/deploy/flowerconfig.py
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=60
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
ReadWritePaths=/var/lib/dilib-flower
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=dilib Operations ui
|
||||
After=network-online.target dilib-api.service
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dilib
|
||||
Group=dilib
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-dashboard/dashboard.env
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment=NICEGUI_STORAGE_PATH=/var/lib/dilib-dashboard/nicegui
|
||||
Environment=MPLCONFIGDIR=/var/lib/dilib-dashboard/matplotlib
|
||||
ExecStart=/opt/dilib-dashboard/.venv/bin/python -m frontend.main
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=60
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/dilib-dashboard
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=dilib Operations worker
|
||||
After=network-online.target postgresql.service redis-server.service
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=dilib
|
||||
Group=dilib
|
||||
WorkingDirectory=/opt/dilib-dashboard
|
||||
EnvironmentFile=/etc/dilib-dashboard/dashboard.env
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
Environment=NICEGUI_STORAGE_PATH=/var/lib/dilib-dashboard/nicegui
|
||||
Environment=MPLCONFIGDIR=/var/lib/dilib-dashboard/matplotlib
|
||||
ExecStart=/opt/dilib-dashboard/.venv/bin/celery -A config worker --loglevel=INFO --concurrency=2
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
TimeoutStopSec=60
|
||||
UMask=0077
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/dilib-dashboard
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user