Skip to content

Running DB outside of Docker

alismx edited this page Dec 22, 2022 · 7 revisions

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:

Setup

  1. 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
  1. 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, usually 5432.

    You can add it to the IntelliJ backend run configuration's "Environment variables:" section when editing the backend configuration:

    Screen Shot 2022-08-03 at 4 04 19 PM

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:
    1. psql
    2. DROP role "simple_report_no_phi"

Local development

Setup

How to

Development process and standards

Oncall

Technical resources

How-to guides

Environments/Azure

Misc

?

Clone this wiki locally