Add instructions for PostgreSQL setup.

This commit is contained in:
Pieter Hollander 2024-02-23 12:11:34 +01:00
parent 01adb82cf2
commit 054a933def
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

View file

@ -2,7 +2,23 @@
OpenDTU logger connects to the OpenDTU livedata websocket and captures metrics.
These metrics are inserted into a PostgreSQL database.
Optionally, TimescaleDB can be used for better performance.
Optionally, TimescaleDB can be used.
## PostgreSQL setup
```sql
CREATE DATABASE opendtu_logger;
CREATE USER opendtu_logger WITH password 'SECRET';
GRANT ALL privileges ON DATABASE opendtu_logger TO opendtu_logger;
GRANT ALL ON SCHEMA public TO opendtu_logger;
```
Optional: enable TimescaleDB extension
```sql
\c opendtu_logger
CREATE EXTENSION OF NOT EXISTS timescaledb;
```
## Environment variables