Running DB outside of Docker - CDCgov/prime-simplereport GitHub Wiki
Intro
This page guides us through setting up your local database to run outside of Docker. This is entirely optional.
Prerequisites
Install PostgreSQL. There are several ways to do this:
- Homebrew
- Postgres.app (probably the simplest)
- enterprisedb
Setup
- In the project root, run the following to create the local database and Metabase, run:
POSTGRES_USER=$USER LIB_DIR="$(pwd)/backend/db-setup" POSTGRES_DB=postgres ./backend/db-setup/create-db.sh
POSTGRES_USER=$USER LIB_DIR="$(pwd)/backend/db-setup" POSTGRES_DB=postgres ./backend/db-setup/create-metabase-db.sh
-
When running the backend, you will need to run it with the following environment variable:
SR_DB_PORT=<port_number>
The
<port_number>
should be whichever port your local DB runs on, usually5432
.You can add it to the IntelliJ backend run configuration's "Environment variables:" section when editing the backend configuration:
Common Errors
- When starting the backend, if you get an error saying something like the role "simple_report_no_phi" already exists or is already created, you may need to run the following:
psql
DROP role "simple_report_no_phi"