Skip to content

Commit

Permalink
docs: update deployment guide
Browse files Browse the repository at this point in the history
  • Loading branch information
sykp241095 committed Aug 8, 2024
1 parent 1004346 commit 62de210
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions frontend/app/src/pages/docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

This document provides instructions for deploying the entire RAG using Docker Compose.

## Prerequisites
## Deploy

1. Set up a [TiDB Serverless cluster](https://docs.pingcap.com/tidbcloud/tidb-cloud-quickstart).
2. Install [Docker Compose](https://docs.docker.com/compose/install/).
3. Install [Python 3.11](https://www.python.org/downloads/release/python-3110/).
4. Install [Rye](https://rye.astral.sh/guide/installation/).

## Deployment Steps
> **Prerequisites:**
>
> 1. Set up a [TiDB Serverless cluster](https://docs.pingcap.com/tidbcloud/tidb-cloud-quickstart).
> 2. Install [Docker Compose](https://docs.docker.com/compose/install/).
> 3. Jina AI API key, get one from [Jina AI](https://jina.ai/reranker/).
1. Clone the repository:

Expand All @@ -18,26 +17,46 @@ This document provides instructions for deploying the entire RAG using Docker Co
cd tidb.ai
```

2. Copy and edit the `.env` file in the `backend` directory:
2. Copy and edit the `.env` file:

```bash
cp .env.example .env
vim .env # or use another text editor to edit this file
```

Replace the following placeholders with your own values:
- `SECRET_KEY`: you can generate a random secret key using `python3 -c "import secrets; print(secrets.token_urlsafe(32))"`
- `JINAAI_API_KEY`: get one from [Jina AI](https://jina.ai/reranker/)
- `TIDB_HOST`, `TIDB_USER`, `TIDB_PASSWORD` and `TIDB_DATABASE`: get them from your [TiDB Serverless cluster](https://tidbcloud.com/)

- Note: TiDB Serverless will provide a default database name called `test`, if you want to use another database name, you need to create a new database in the TiDB Serverless console.

3. Build docker images:

```bash
cp ./backend/.env.example ./backend/.env
vim ./backend/.env # or use another text editor to edit this file
docker compose build
```

3. Migrate the database schema:
4. Migrate the database schema:

```bash
cd backend
rye sync
make migrate
cd ..
docker compose run backend /bin/sh -c "alembic upgrade head"
```

4. Start the services using Docker Compose:
5. Bootstrap the database with initial data:

```bash
docker compose run backend /bin/sh -c "python bootstrap.py"
```

Running the bootstrap script creates an admin user. You can find the username and password in the output.

6. Start the services:

```bash
docker compose up
```

7. Open your browser and visit `http://localhost:3000` to access the web interface.

That's it! You can now use TiDB.AI locally. You can also go to https://tidb.ai to experience the live demo.

0 comments on commit 62de210

Please sign in to comment.