From 75438a6e292fdea19d6392bf547622bc92b1f6e3 Mon Sep 17 00:00:00 2001 From: Sophie Waldman <62553142+sjwmoveon@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:43:45 -0400 Subject: [PATCH 1/2] Add instructions for local postgres Add additional documentation on how to set up Postgres if using a local installation and not Docker. --- docs/HOWTO_USE_POSTGRESQL.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/HOWTO_USE_POSTGRESQL.md b/docs/HOWTO_USE_POSTGRESQL.md index cff2f0787..95b46bddc 100644 --- a/docs/HOWTO_USE_POSTGRESQL.md +++ b/docs/HOWTO_USE_POSTGRESQL.md @@ -3,9 +3,19 @@ To use Postgresql, follow these steps: 1. Either install docker (recommended) or postgresql on your machine: - * If you installed docker run the database using: `docker compose up` - * If you installed postgres locally, create the spoke dev database: `psql -c "create database spokedev;"` - * Then create a spoke user to connect to the database with `createuser -P spoke` with password "spoke" (to match the credentials in the .env.example file) + * If you installed docker run the database using: `docker-compose up` + * If you installed postgres locally (or if you already have a local installation of postgres), create the spoke dev database: `psql -c "create database spokedev;"` + * Then create a spoke user to connect to the database with `psql -d spokedev -c "create user spoke with password 'spoke';"` (to match the credentials in the .env.example file) + * Grant permissions to the new Spoke user: + * `psql -d spokedev -c "GRANT ALL PRIVILEGES ON DATABASE spokedev TO spoke;"` + * `psql -d spokedev -c "GRANT ALL PRIVILEGES ON schema public TO spoke;"` + * Also run the commands from `./dev-tools/create-test-database`: + ``` + psql -d spokedev + CREATE DATABASE spoke_test; + CREATE USER spoke_test WITH PASSWORD 'spoke_test'; + GRANT ALL PRIVILEGES ON DATABASE spoke_test TO spoke_test; + ``` 1. In `.env` set `DB_TYPE=pg`. (Otherwise, you will use sqlite.) 2. Set `DB_PORT=5432`, which is the default port for Postgres. From 6c261a40a5fd4c5eee2bccb9927e2dc625c5389a Mon Sep 17 00:00:00 2001 From: Sophie Waldman <62553142+sjwmoveon@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:14:44 -0400 Subject: [PATCH 2/2] Clarify test database commands We don't actually want to run the script, which is built for Docker environments - we just want to run the SQL commands from that script. --- docs/HOWTO_USE_POSTGRESQL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/HOWTO_USE_POSTGRESQL.md b/docs/HOWTO_USE_POSTGRESQL.md index 95b46bddc..2c817b8d3 100644 --- a/docs/HOWTO_USE_POSTGRESQL.md +++ b/docs/HOWTO_USE_POSTGRESQL.md @@ -9,7 +9,7 @@ To use Postgresql, follow these steps: * Grant permissions to the new Spoke user: * `psql -d spokedev -c "GRANT ALL PRIVILEGES ON DATABASE spokedev TO spoke;"` * `psql -d spokedev -c "GRANT ALL PRIVILEGES ON schema public TO spoke;"` - * Also run the commands from `./dev-tools/create-test-database`: + * Create a test database by running the following commands: ``` psql -d spokedev CREATE DATABASE spoke_test;