From 611b5be6cb1d8fcad6570e5d8cbcef46b9169a5c Mon Sep 17 00:00:00 2001 From: Jon Roeber Date: Mon, 15 Jan 2024 02:59:10 +0000 Subject: [PATCH] Update Dev Notes --- Dev-Notes.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Dev-Notes.md b/Dev-Notes.md index 5d08b7b..5550e75 100644 --- a/Dev-Notes.md +++ b/Dev-Notes.md @@ -1 +1,37 @@ -Welcome to the Wiki. \ No newline at end of file +## 20240114 + +PostGIS setup, PostgreSQL commands, ChirpStack integration + +`apt install postgis` + +`sudo -u postgres psql` (just psql -U postgres won't work) + +`CREATE EXTENSION postgis;` + +To select from user table: + +`select * from public."user";` (select * from user doesn't work; shows the currently-logged in psql user instead?) + +`CREATE DATABASE chirpstack_integration;` + +`\c chirpstack_integration` + +`CREATE ROLE chirpstack_integration PASSWORD '6XlFKCb2ygWCt'; (need to add WITH LOGIN next time) + +`# GRANT ALL PRIVILEGES ON chirpstack_integration TO chirpstack_integration;` (doesn't work the way you think, see https://serverfault.com/a/198018) + +`ALTER DATABASE chirpstack_integration OWNER TO chirpstack_integration;` + +list roles: + +`SELECT * FROM pg_roles;` + +roles and users are different; roles cannot login by default and are not listed in pg_user (but all users are listed in pg_role) + +`ALTER ROLE chirpstack_integration WITH LOGIN;` (since I didn't do login in the first place...best to just make a user) + +schema for integration: https://github.com/chirpstack/chirpstack/blob/master/chirpstack/src/integration/postgresql/migrations/00000000000000_initial/up.sql + +q about payload decoding https://forum.chirpstack.io/t/payload-decoding-in-postgres-integration/16356 + +the two interesting tables are event_up and event_integration \ No newline at end of file