Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update docs for local db port 8432 #334

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading