install as service

This commit is contained in:
2026-08-30 12:41:40 +02:00
parent 3224f27f39
commit 2cab3f6c45
8 changed files with 111 additions and 3 deletions
+43
View File
@@ -55,6 +55,13 @@ Run the service; host, port, and URL prefix all come from `config.yaml`:
.venv/bin/python wsgi.py
```
For production, use the Waitress entry point. It reads host, port, thread count,
and all application settings from `config.yaml`:
```sh
.venv/bin/python serve.py
```
With the example settings, open <http://localhost:30225/w/>. Keep one application worker because the polling
scheduler runs inside the service process. Alternatively set
`collector.enabled: false` in web workers and invoke this from a system timer:
@@ -78,6 +85,42 @@ The service account must have write permission on the log directory. Console
logging remains enabled by default so `python wsgi.py` displays its listening
address; set `logging.console: false` to use only the logfile.
## systemd installation
The included `deploy/netatmo.service` runs Waitress from `/srv/service_netatmo`
under a dedicated, non-login `netatmo` account. As root, create the account and
writable data directory:
```sh
useradd --system --home-dir /srv/service_netatmo --shell /usr/sbin/nologin netatmo
install -d -o netatmo -g netatmo -m 0750 /var/lib/rrd
chown netatmo:netatmo /srv/service_netatmo/config.yaml
chmod 0600 /srv/service_netatmo/config.yaml
```
Create the virtual environment and install dependencies as that account:
```sh
sudo -u netatmo python3 -m venv /srv/service_netatmo/.venv
sudo -u netatmo /srv/service_netatmo/.venv/bin/pip install -r /srv/service_netatmo/requirements.txt
```
Install and start the unit:
```sh
install -o root -g root -m 0644 /srv/service_netatmo/deploy/netatmo.service /etc/systemd/system/netatmo.service
systemctl daemon-reload
systemctl enable --now netatmo.service
systemctl status netatmo.service
```
Follow service output and the rotating application log with:
```sh
journalctl -u netatmo.service -f
tail -f /var/lib/rrd/netatmo_service.log
```
## HTTP API
```text