# 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=, IT_CONNECT_PROXY_IPS= # 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