From 85b77d97e38226413b908ac2d003523d42587587 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Mon, 9 Jun 2025 16:20:50 -0400 Subject: [PATCH] Getting local postgres setup --- .gitignore | 3 +++ .local-profile.template | 5 +++++ README.md | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .local-profile.template diff --git a/.gitignore b/.gitignore index 6df8208..2157e0e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ tmp/ # Postgres .pg_data +# Profiles +.local-profile + diff --git a/.local-profile.template b/.local-profile.template new file mode 100644 index 0000000..7afaab4 --- /dev/null +++ b/.local-profile.template @@ -0,0 +1,5 @@ +export POSTGRES_USER=myuser +export POSTGRES_PASSWORD=mypassword +export POSTGRES_DB=mydatabase +export PG_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5433/mydatabase + diff --git a/README.md b/README.md index 7f33829..249281a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,43 @@ Experimenting with River Async task system for background jobs in golang. +## Starting Local Dev + +This project requires a running postgres database for River's task system. + +To start a postgres database use: +``` +make start-local +``` + +To stop it use: +``` +make stop-local +``` + +A simple `.local-profile.template` is available with environment variables that can be helpful when working in this project. + +``` +cp .local-profile.template .local-profile +``` + +Update the profile with any additional envvars you will need then: + +``` +source .local-profile +``` + +You can now connect to the local database using `psql $PG_URI` + +If you do not have `psql` installed: + +``` +brew install libpq +``` + ## Resources - [Go Background Jobs with River Queue](https://www.youtube.com/watch?v=TC9fwhvzoMM&t=362s) + +