Skip to content

Commit

Permalink
doc: Add sealos deployment method (anse-app#416)
Browse files Browse the repository at this point in the history
Co-authored-by: yzh990918 <[email protected]>
  • Loading branch information
nightwhite and yzh990918 committed Jun 16, 2023
1 parent 0302c4a commit 889c6e9
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 15 deletions.
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ More info on https://github.com/ddiu8081/chatgpt-demo/discussions/247.
## Running Locally

### Pre environment
1. **Node**: Check that both your development environment and deployment environment are using `Node v18` or later. You can use [nvm](https://github.com/nvm-sh/nvm) to manage multiple `node` versions locally
1. **Node**: Check that both your development environment and deployment environment are using `Node v18` or later. You can use [nvm](https://github.com/nvm-sh/nvm) to manage multiple `node` versions locally.
```bash
node -v
```
Expand Down Expand Up @@ -69,7 +69,7 @@ More info on https://github.com/ddiu8081/chatgpt-demo/discussions/247.

**Step-by-step deployment tutorial:**

1. [Fork](https://github.com/ddiu8081/chatgpt-demo/fork) this projectGo to [https://app.netlify.com/start](https://app.netlify.com/start) new Site, select the project you `forked` done, and connect it with your `GitHub` account.
1. [Fork](https://github.com/ddiu8081/chatgpt-demo/fork) this project, Go to [https://app.netlify.com/start](https://app.netlify.com/start) new Site, select the project you `forked` done, and connect it with your `GitHub` account.

![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230310/image.3nlt4hgzb16o.webp)

Expand All @@ -80,7 +80,7 @@ More info on https://github.com/ddiu8081/chatgpt-demo/discussions/247.

![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230311/image.gfs9lx8c854.webp)

3. Select the default build command and output directory, Click the `Deploy Site` button to start deploying the site
3. Select the default build command and output directory, Click the `Deploy Site` button to start deploying the site.

![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230311/image.4jky9e1wbojk.webp)

Expand Down Expand Up @@ -124,9 +124,43 @@ docker compose up -d
docker-compose down
```

### Deploy with Sealos

1.Register a Sealos account for free [sealos cloud](https://cloud.sealos.io)

2.Click `App Launchpad` button

![App Launchpad](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-1.34i8gi80j268.webp)

3.Click `Create Application` button

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-2.4t8q5px18eps.webp)

4.Just fill in according to the following figure, and click on it after filling out `Deploy Application` button

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-3.5x5exqk0o8lc.webp)

```shell
App Name: chatgpt-demo
Image Name: ddiu8081/chatgpt-demo:latest
CPU: 0.5Core
Memory: 1G
Container Ports: 3000
Accessible to the Public: On
Environment: OPENAI_API_KEY=YOUR_OPEN_API_KEY
```

5.Obtain the access link and click directly to access it. If you need to bind your own domain name, you can also fill in your own domain name in `Custom domain` and follow the prompts to configure the domain name CNAME

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-4.4esqkqu70z9c.webp)

6.Wait for one to two minutes and open this link

![Open Link](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-5.5cgfpee3zeyo.webp)

### Deploy on more servers

Please refer to the official deployment documentationhttps://docs.astro.build/en/guides/deploy
Please refer to the official deployment documentation: https://docs.astro.build/en/guides/deploy

## Environment Variables

Expand Down Expand Up @@ -157,7 +191,7 @@ A: Configure environment variables `HTTPS_PROXY`,reference: https://github.com

Q: throw new TypeError(${context} is not a ReadableStream.)

A: The Node version needs to be `v18` or laterreference: https://github.com/ddiu8081/chatgpt-demo/issues/65
A: The Node version needs to be `v18` or later, reference: https://github.com/ddiu8081/chatgpt-demo/issues/65

Q: Accelerate domestic access without the need for proxy deployment tutorial?

Expand Down
54 changes: 44 additions & 10 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

**🍿 在线预览**: https://chatgpt.ddiu.me

**🏖️ V2 版本(Beta)**: https://v2.chatgpt.ddiu.me
**🏖️ V2 版本 (Beta)**: https://v2.chatgpt.ddiu.me

> ⚠️ 注意: 我们的API密钥限制已用尽。所以演示站点现在不可用。
> ⚠️ 注意:我们的 API 密钥限制已用尽。所以演示站点现在不可用。
![chat-logo](https://cdn.staticaly.com/gh/yzh990918/static@master/chat-logo.webp)

Expand Down Expand Up @@ -70,7 +70,7 @@
![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230310/image.5fhfouap270g.webp)


2. 选择要部署的分支,选择 `main` 分支, 在项目设置中配置环境变量,环境变量配置参考下文。
2. 选择要部署的分支,选择 `main` 分支,在项目设置中配置环境变量,环境变量配置参考下文。

![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230310/image.6dvtfmoijb7k.webp)

Expand All @@ -79,7 +79,7 @@
![image](https://cdn.staticaly.com/gh/yzh990918/static@master/20230310/image.e0n7c0zaen4.webp)

### 部署在 Docker
部署之前请确认 `.env` 文件正常配置,环境变量参考下方文档, [Docker Hub address](https://hub.docker.com/r/ddiu8081/chatgpt-demo).
部署之前请确认 `.env` 文件正常配置,环境变量参考下方文档[Docker Hub address](https://hub.docker.com/r/ddiu8081/chatgpt-demo).

**一键运行**
```bash
Expand Down Expand Up @@ -115,6 +115,40 @@ docker compose up -d
docker-compose down
```

### Sealos 部署

1.注册 Sealos 免费账号 [sealos cloud](https://cloud.sealos.io)

2.点击 `App Launchpad` 按钮

![App Launchpad](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-1.34i8gi80j268.webp)

3.点击 `Create Application` 按钮

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-2.4t8q5px18eps.webp)

4.按照下图填写后,点击 `Deploy Application` 按钮

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-3.5x5exqk0o8lc.webp)

```shell
App Name: chatgpt-demo
Image Name: ddiu8081/chatgpt-demo:latest
CPU: 0.5Core
Memory: 1G
Container Ports: 3000
Accessible to the Public: On
Environment: OPENAI_API_KEY=YOUR_OPEN_API_KEY
```

5.获取访问链接。如果你需要自定义域名,可以点击 `Custom domain` 按钮后按照提示解析域名 CNAME

![Create Application](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-4.4esqkqu70z9c.webp)

6.等待 1-2 分钟后点击链接,即可进去页面

![Open Link](https://cdn.jsdelivr.net/gh/yzh990918/static@master/20230609/install-on-sealos-5.5cgfpee3zeyo.webp)

### 部署在更多的服务器

请参考官方部署文档:https://docs.astro.build/en/guides/deploy
Expand All @@ -126,32 +160,32 @@ docker-compose down
| 名称 | 描述 | 默认 |
| --- | --- | --- |
| `OPENAI_API_KEY` | 你的 OpenAI API Key | `null` |
| `HTTPS_PROXY` | 为 OpenAI API 提供代理. e.g. `http:https://127.0.0.1:7890` | `null` |
| `HTTPS_PROXY` | 为 OpenAI API 提供代理e.g. `http:https://127.0.0.1:7890` | `null` |
| `OPENAI_API_BASE_URL` | 请求 OpenAI API 的自定义 Base URL. | `https://api.openai.com` |
| `HEAD_SCRIPTS` | 在页面的 `</head>` 之前注入分析或其他脚本 | `null` |
| `PUBLIC_SECRET_KEY` | 项目的秘密字符串。用于生成 API 调用的签名 | `null` |
| `SITE_PASSWORD` | 为网站设置密码,支持使用英文逗号创建多个密码。如果未设置,则该网站将是公开的 | `null` |
| `OPENAI_API_MODEL` | 使用的 OpenAI 模型. [模型列表](https://platform.openai.com/docs/api-reference/models/list) | `gpt-3.5-turbo` |
| `OPENAI_API_MODEL` | 使用的 OpenAI 模型[模型列表](https://platform.openai.com/docs/api-reference/models/list) | `gpt-3.5-turbo` |

## 开启同步更新

Fork 项目后,您需要在 Fork 项目的操作页面上手动启用工作流和上游同步操作。启用后,每天都会执行自动更新:
Fork 项目后,您需要在 Fork 项目的操作页面上手动启用工作流和上游同步操作。启用后,每天都会执行自动更新

![](https://cdn.staticaly.com/gh/yzh990918/static@master/20230518/image.2hhnrsrd2t1c.webp)

## 常见问题

Q: TypeError: fetch failed (can't connect to OpenAI Api)

A: 配置环境变量 `HTTPS_PROXY`,参考: https://github.com/ddiu8081/chatgpt-demo/issues/34
A: 配置环境变量 `HTTPS_PROXY`,参考https://github.com/ddiu8081/chatgpt-demo/issues/34

Q: throw new TypeError(${context} is not a ReadableStream.)

A: Node 版本需要在 `v18` 或者更高,参考: https://github.com/ddiu8081/chatgpt-demo/issues/65
A: Node 版本需要在 `v18` 或者更高,参考https://github.com/ddiu8081/chatgpt-demo/issues/65

Q: Accelerate domestic access without the need for proxy deployment tutorial?

A: 你可以参考此教程: https://github.com/ddiu8081/chatgpt-demo/discussions/270
A: 你可以参考此教程https://github.com/ddiu8081/chatgpt-demo/discussions/270

Q: `PWA` 不工作?

Expand Down

0 comments on commit 889c6e9

Please sign in to comment.