From e9e9d54417aaff61d839436e283d61a28766ca03 Mon Sep 17 00:00:00 2001 From: "raoha.rh" Date: Mon, 16 Dec 2024 18:29:39 +0800 Subject: [PATCH] feat: update doc --- docs/guides/self_hosted_local.md | 26 ++++++++++++++------------ docs/guides/self_hosted_local_cn.md | 29 ++++++++++++++++------------- package.json | 3 +-- server/.env.local.example | 6 +++--- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/docs/guides/self_hosted_local.md b/docs/guides/self_hosted_local.md index c61de0df..345b7495 100644 --- a/docs/guides/self_hosted_local.md +++ b/docs/guides/self_hosted_local.md @@ -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): @@ -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 diff --git a/docs/guides/self_hosted_local_cn.md b/docs/guides/self_hosted_local_cn.md index bee321f0..322ef118 100644 --- a/docs/guides/self_hosted_local_cn.md +++ b/docs/guides/self_hosted_local_cn.md @@ -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 @@ -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 文件夹 @@ -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` 检查服务器是否正在运行。 ### 第七步:启动客户端 使用以下命令启动客户端: diff --git a/package.json b/package.json index 275f381b..d79236da 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/server/.env.local.example b/server/.env.local.example index b6dbf64f..54648bc6 100644 --- a/server/.env.local.example +++ b/server/.env.local.example @@ -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