From 334f73432b03bf5609be65906cb26bc8d91d02b7 Mon Sep 17 00:00:00 2001 From: jonny <32085184+jonnyjohnson1@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:48:45 -0500 Subject: [PATCH] update: postgres setup in flake --- README.md | 7 +++++++ flake.nix | 2 +- justfile | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c4c7a6..e6a1412 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,13 @@ topos run nix develop .#poetry ``` +## Install Tips + +### POSTGRES +- If postgres is already running, running the bin fails, shut it down first. +- Nix will manage postgres' start/stop function itself when you use it, but if you have started the database elsewhere, it won't be able to manage it, and will fail to start up. + + ## Install Instructions requires `brew install just` requires `brew install poetry` diff --git a/flake.nix b/flake.nix index 4983ceb..f4f5268 100644 --- a/flake.nix +++ b/flake.nix @@ -68,7 +68,7 @@ configFile = pkgs.copyPathToStore ./config.yaml; yq = pkgs.yq-go; - + kafkaPreStartup = '' echo "Kafka is ready. Creating topic..." ${pkgs.apacheKafka}/bin/kafka-topics.sh --create --topic chat_topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1 --if-not-exists diff --git a/justfile b/justfile index effe003..0ab43b8 100644 --- a/justfile +++ b/justfile @@ -22,3 +22,8 @@ python: dmg: create-dmg topos.app --volicon "topos/assets/topos_blk_rounded.png" --icon "topos/assets/topos_blk_rounded.png" + +stoppg: + export PGDATA=$(pwd)/pgdata + echo "Stopping any existing PostgreSQL server..." + pg_ctl -D "$PGDATA" stop || echo "No existing server to stop."