Skip to content

Commit

Permalink
chore: update docs for local db port 8432
Browse files Browse the repository at this point in the history
  • Loading branch information
mantagen committed Nov 4, 2024
1 parent f8d9e1c commit 08a9de4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pnpm install turbo --global
## Postgres Setup

### Prerequisites

- This project set up following the Installation steps.
- Docker installed.
- Optional: A Postgres GUI tool (such as pgAdmin or Postico) to view the data.
Expand All @@ -71,35 +72,35 @@ pnpm install turbo --global
cd packages/db
```

2. Build and run the Docker container to create a database named `oai`, with the username and password both as `oai`, bound to port 5432. It will also install `pgvector` and `postgresql-contrib`.
2. Build and run the Docker container to create a database named `oai`, with the username and password both as `oai`, bound to port 8432. It will also install `pgvector` and `postgresql-contrib`.

```shell
pnpm run docker-bootstrap
```

3. Seed your database, to do this you have two options:

3a. Replicate Production/Staging (Slow)
3a. Replicate Production/Staging (Slow)

This will import the schema and tables from production. Note: due to the size of the production database this could take a significant amount of time.
This will import the schema and tables from production. Note: due to the size of the production database this could take a significant amount of time.

```shell
pnpm run db-restore-from:prd or pnpm run db-restore-from:stg
```
```shell
pnpm run db-restore-from:prd or pnpm run db-restore-from:stg
```

3b. Local Prisma with Essential Tables Seeded from a Live Environment (Fast)
3b. Local Prisma with Essential Tables Seeded from a Live Environment (Fast)

1. Apply the Prisma schema to your local database:
1. Apply the Prisma schema to your local database:

```shell
pnpm run db-push
```
```shell
pnpm run db-push
```

2. Seed from stg/prd (where `:prd` can be either `:prd` or `:stg`, matching the Doppler environments). This will only seed the apps table and lesson-related tables used for RAG.
2. Seed from stg/prd (where `:prd` can be either `:prd` or `:stg`, matching the Doppler environments). This will only seed the apps table and lesson-related tables used for RAG.

```shell
pnpm run db-seed-local-from:prd
```
```shell
pnpm run db-seed-local-from:prd
```

### Utility Commands

Expand Down
2 changes: 1 addition & 1 deletion packages/db/scripts/import-export/db_seed.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

get_local_database_admin_url() {
read -p "Please enter the local DATABASE_ADMIN_URL (e.g. postgresql://oai:oai@localhost:5432/oai): " local_url
read -p "Please enter the local DATABASE_ADMIN_URL (e.g. postgresql://oai:oai@localhost:8432/oai): " local_url
echo "$local_url"
}

Expand Down

0 comments on commit 08a9de4

Please sign in to comment.