From 054a933defa3e374bffe67bffad6367ca5695e05 Mon Sep 17 00:00:00 2001 From: Pieter Hollander Date: Fri, 23 Feb 2024 12:11:34 +0100 Subject: [PATCH] Add instructions for PostgreSQL setup. --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aee955c..0b855bd 100644 --- a/README.md +++ b/README.md @@ -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