Skip to content

Commit

Permalink
chore: script
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwisecodes committed Sep 13, 2024
1 parent 0ce4f4b commit 0bc23b4
Showing 1 changed file with 13 additions and 44 deletions.
57 changes: 13 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Oak AI Lesson Assistant is a project focused on experimenting with AI models and
- [Open source acknowledgements](#open-source-acknowledgements)
- [License](#license)


## Introduction

Oak AI Lesson Assistant is a project designed to facilitate the development and testing of AI tools and models. The project is structured as a Turborepo monorepo, leveraging various open-source tools and libraries.
Expand Down Expand Up @@ -80,68 +79,38 @@ To run `psql`, ssh into the box using:
pnpm run docker-psql
```

To seed the database:
To seed your database you have two options,

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

From the repo root, then run:
Option 1:
This will import the schema from production and every table. This could take a long time as the database is over 20gb

```shell
pnpm run prompts
pnpm run db-restore-from:prd
```

To reset and start fresh:
Option 2:

```shell
pnpm run docker-reset
```

To import a snapshot of production or staging databases into your local instance:
Apply schema to db:

```shell
pnpm run docker-reset
pnpm run db-restore-from:prd
pnpm run db-push
```

where `:prd` can be either `:prd` or `:stg` (the Doppler environments).

### With Homebrew
Remove the snippets table from tables.txt

Install and start PostgreSQL:
Seed from stg/prd
where `:prd` can be either `:prd` or `:stg` (the Doppler environments).

```shell
brew install postgresql
brew services start postgresql
createdb oai
psql
```

In PSQL:

```sql
sudo -u postgres psql
CREATE USER oai WITH ENCRYPTED PASSWORD 'oai';
GRANT ALL PRIVILEGES ON DATABASE oai TO oai;
ALTER USER oai WITH SUPERUSER;
pnpm run db-seed-local-from:stg
```

**Note:** Running in superuser mode is not ideal; consider separate users for migrations and queries.

Exit PSQL using `\quit`.

Install PG Vector:
To reset and start fresh:

```shell
brew install pgvector
psql postgres
CREATE EXTENSION vector;
pnpm run docker-reset
```

Quit PSQL.

## Doppler

We use [Doppler](https://doppler.com) for secrets management. To run the application, you need to set up the Doppler CLI.
Expand Down

0 comments on commit 0bc23b4

Please sign in to comment.