Skip to content

Commit

Permalink
feat: update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai committed Dec 16, 2024
1 parent cf441a9 commit e9e9d54
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
26 changes: 14 additions & 12 deletions docs/guides/self_hosted_local.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,7 @@ Install all necessary dependencies using Yarn:
yarn run bootstrap
```

### Step 3: Copy the `.env.example` Files
Copy the server environment configuration example file:

```bash
cp server/.env.local.example server/.env
```
Copy the client environment configuration example file:
```bash
cp client/.env.local.example client/.env
```

### Step 4: Start Supabase Locally
### Step 3: Start Supabase Locally

Refer to [Supabase Self-Hosting Guide](https://supabase.com/docs/guides/self-hosting/docker#installing-and-running-supabase):

Expand All @@ -49,6 +38,19 @@ docker compose pull
docker compose up -d
```

### Step 4: Copy the `.env.example` Files
Copy the client environment configuration example file:
```bash
cp client/.env.local.example client/.env
```

Copy the server environment configuration example file:
```bash
cp server/.env.local.example server/.env
```

Open the `server/.env` file and update the `SERVICE_ROLE_KEY` field to match the value of `SERVICE_ROLE_KEY` from the `docker/.env` file in Supabase.

### Step 5: Initialize Database Schema

#### Step 5.1: Navigate to the Migrations Folder
Expand Down
29 changes: 16 additions & 13 deletions docs/guides/self_hosted_local_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,7 @@ git clone https://github.com/petercat-ai/petercat.git
yarn run bootstrap
```

### 第三步:复制 `.env.example` 文件
复制服务器环境配置示例文件:

```bash
cp server/.env.local.example server/.env
```
复制客户端环境配置示例文件:
```bash
cp client/.env.local.example client/.env
```

### 第四步:在本地启动 supabase
### 第三步:在本地启动 supabase

参考 https://supabase.com/docs/guides/self-hosting/docker#installing-and-running-supabase

Expand All @@ -48,6 +37,20 @@ docker compose pull
docker compose up -d
```

### 第四步:复制 `.env.example` 文件
复制客户端环境配置示例文件:
```bash
cp client/.env.local.example client/.env
```

复制服务器环境配置示例文件:

```bash
cp server/.env.local.example server/.env
```

打开 `server/.env` 文件,把 `SERVICE_ROLE_KEY` 字段改成从 supabase 的 `docker/.env` 文件的 `SERVICE_ROLE_KEY` 的值

### 第五步:初始化数据库结构

#### 第五步 5.1:导航到 Migrations 文件夹
Expand Down Expand Up @@ -91,7 +94,7 @@ Finished supabase db push.
yarn run server:local
```

通过在浏览器中打开 `http://127.0.0.1:8000/api/health_checker` 检查服务器是否正在运行。
通过在浏览器中打开 `http://127.0.0.1:8001/api/health_checker` 检查服务器是否正在运行。

### 第七步:启动客户端
使用以下命令启动客户端:
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"build:docker": "docker build -t petercat .",
"build:pypi": "rm -rf dist && python3 -m build",
"publish:test": "python3 -m twine upload --repository petercat-utils dist/* ",
"publish:pypi": "python3 -m twine upload --repository pypi dist/* ",
"docker": "docker compose --env-file server/.env -f docker/docker-compose.yml up -d"
"publish:pypi": "python3 -m twine upload --repository pypi dist/* "
},
"engines": {
"node": "^18 || >=20"
Expand Down
6 changes: 3 additions & 3 deletions server/.env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ WEB_URL=http://localhost:3000
STATIC_URL=STATIC_URL

FASTAPI_SECRET_KEY=fastapi_secret_key
# `Project URL` field of https://supabase.com/dashboard/project/_/settings/database
SUPABASE_URL=${SUPABASE_PUBLIC_URL}
# `Project API keys`: `anon public` field of https://supabase.com/dashboard/project/_/settings/database
# `Project URL`:
SUPABASE_URL=http://localhost:8001
# `Project API keys`: SERVICE_ROLE_KEY from supabase .env file
SUPABASE_SERVICE_KEY=${SERVICE_ROLE_KEY}

SUPABASE_PASSWORD=aABCDEFG
Expand Down

0 comments on commit e9e9d54

Please sign in to comment.