- deploy/install.sh: Installation/Update in einem Schritt (--proxy-ip oder --caddy), ufw-Regel nur für die Proxy-IP, Funktionsprüfung am Ende - it-connect.service: Bind-Adresse, Port und vertrauenswürdige Proxy-IP aus .env, Start nach network-online.target - .env.example und SETUP.md 7.0 ergänzt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
1.6 KiB
Desktop File
55 lines
1.6 KiB
Desktop File
# systemd-Unit für it-connect
|
|
# Installation: siehe SETUP.md, Teil 7
|
|
# sudo cp deploy/it-connect.service /etc/systemd/system/
|
|
# sudo systemctl daemon-reload && sudo systemctl enable --now it-connect
|
|
|
|
[Unit]
|
|
Description=it-connect (FastAPI)
|
|
Wants=network-online.target
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=itconnect
|
|
Group=itconnect
|
|
WorkingDirectory=/opt/it-connect/backend
|
|
EnvironmentFile=/opt/it-connect/.env
|
|
# Adresse, Port und Proxy-IP kommen aus der .env:
|
|
# Caddy auf demselben Server: IT_CONNECT_BIND_HOST=127.0.0.1, IT_CONNECT_PROXY_IPS=127.0.0.1
|
|
# Externer Proxy (z. B. NPM): IT_CONNECT_BIND_HOST=<eigene LAN-IP>, IT_CONNECT_PROXY_IPS=<Proxy-IP>
|
|
# uvicorn übernimmt die Client-IP aus X-Forwarded-For nur von IT_CONNECT_PROXY_IPS.
|
|
ExecStart=/opt/it-connect/.venv/bin/uvicorn app.main:app \
|
|
--host ${IT_CONNECT_BIND_HOST} --port ${IT_CONNECT_PORT} \
|
|
--proxy-headers --forwarded-allow-ips ${IT_CONNECT_PROXY_IPS} \
|
|
--no-server-header
|
|
Restart=on-failure
|
|
RestartSec=3
|
|
|
|
# Datenbankverzeichnis /var/lib/it-connect (wird von systemd angelegt, gehört itconnect)
|
|
StateDirectory=it-connect
|
|
StateDirectoryMode=0750
|
|
UMask=0077
|
|
|
|
# Härtung
|
|
NoNewPrivileges=true
|
|
ProtectSystem=strict
|
|
ProtectHome=true
|
|
PrivateTmp=true
|
|
PrivateDevices=true
|
|
ProtectKernelTunables=true
|
|
ProtectKernelModules=true
|
|
ProtectKernelLogs=true
|
|
ProtectControlGroups=true
|
|
ProtectClock=true
|
|
ProtectHostname=true
|
|
RestrictNamespaces=true
|
|
RestrictRealtime=true
|
|
RestrictSUIDSGID=true
|
|
LockPersonality=true
|
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
CapabilityBoundingSet=
|
|
SystemCallArchitectures=native
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|