[Unit] Description=Thailand Water Level Monitor Documentation=https://git.b4l.co.th/B4L/Northern-Thailand-Ping-River-Monitor After=network.target Wants=network-online.target [Service] Type=simple User=water-monitor Group=water-monitor WorkingDirectory=/opt/thailand-water-monitor # The uv-managed env (uv sync -> .venv). Same interpreter for water-monitor-retrain.service. ExecStart=/opt/thailand-water-monitor/.venv/bin/python run.py --web-api ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=60 TimeoutStopSec=30 # DB_TYPE / POSTGRES_CONNECTION_STRING / MATRIX_* come from the .env file. EnvironmentFile=/opt/thailand-water-monitor/.env Environment=PYTHONPATH=/opt/thailand-water-monitor # Serving path is latency-bound; single-threaded BLAS is 2.6x faster per call # (docs/FLOOD_FORECASTING.md section 6). Training sets its own value. Environment=OMP_NUM_THREADS=1 Environment=PYTHONUNBUFFERED=1 # Security settings NoNewPrivileges=true PrivateTmp=true ProtectSystem=strict ProtectHome=true ReadWritePaths=/opt/thailand-water-monitor CapabilityBoundingSet= # Logging StandardOutput=journal StandardError=journal SyslogIdentifier=water-monitor [Install] WantedBy=multi-user.target