[Unit] Description=Frigate Counter Dashboard Documentation=https://github.com/your-repo/frigate-counter After=network-online.target frigate-counter.service Wants=network-online.target [Service] Type=simple User=frigate-counter Group=frigate-counter WorkingDirectory=/opt/frigate-counter Environment="PATH=/opt/frigate-counter/venv/bin:/usr/local/bin:/usr/bin:/bin" Environment="DB_PATH=/opt/frigate-counter/frigate_counter.db" Environment="DASHBOARD_HOST=0.0.0.0" Environment="DASHBOARD_PORT=5000" Environment="FLASK_DEBUG=false" # Use Gunicorn for production ExecStart=/opt/frigate-counter/venv/bin/gunicorn \ -w 2 \ -b 0.0.0.0:5000 \ --access-logfile - \ --error-logfile - \ --capture-output \ --enable-stdio-inheritance \ dashboard:app ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=30 KillSignal=SIGTERM Restart=on-failure RestartSec=5 StartLimitInterval=60s StartLimitBurst=3 # Security hardening NoNewPrivileges=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/opt/frigate-counter PrivateTmp=true [Install] WantedBy=multi-user.target