# systemd unit for Polleo Demand FastAPI backend (nabava.polleosport.com). # Install at /etc/systemd/system/nabava-api.service then: # systemctl daemon-reload # systemctl enable --now nabava-api # Tail logs: journalctl -u nabava-api -f [Unit] Description=Polleo Demand FastAPI backend (nabava.polleosport.com) After=network.target postgresql.service Wants=postgresql.service [Service] Type=simple User=polleo Group=polleo WorkingDirectory=/var/www/html/nabava.polleosport.com # Read .env file for env vars (DATABASE_URL, JWT_SECRET, CORS_ORIGINS, …) EnvironmentFile=/var/www/html/nabava.polleosport.com/.env # Use the project's pinned Python (3.12). Adjust path to your venv. ExecStart=/var/www/html/nabava.polleosport.com/.venv/bin/uvicorn backend.main:app \ --host 127.0.0.1 --port 8000 \ --proxy-headers --forwarded-allow-ips 127.0.0.1 \ --workers 2 --log-level info # Restart on crash, brief cool-down between attempts Restart=on-failure RestartSec=5 StartLimitIntervalSec=60 StartLimitBurst=5 # Sandbox NoNewPrivileges=true PrivateTmp=true ProtectSystem=full ProtectHome=true ReadWritePaths=/var/www/html/nabava.polleosport.com/data /var/www/html/nabava.polleosport.com/logs # Logging StandardOutput=journal StandardError=journal SyslogIdentifier=nabava-api [Install] WantedBy=multi-user.target