Skip to content

Commit b47d847

Browse files
committed
docs: support vercel deploy
1 parent 64180c6 commit b47d847

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

docs/README.en.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ docker compose up -d
3939
>
4040
> For persistence, use MySQL / Redis / PostgreSQL, on Render set: SERVER_STORAGE_TYPE (mysql/redis/pgsql) and SERVER_STORAGE_URL.
4141
42+
#### Vercel Deployment
43+
44+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/chenyme/grok2api&env=LOG_LEVEL,LOG_FILE_ENABLED,DATA_DIR,SERVER_STORAGE_TYPE,SERVER_STORAGE_URL&envDefaults=%7B%22DATA_DIR%22%3A%22/tmp/data%22%2C%22LOG_FILE_ENABLED%22%3A%22false%22%2C%22LOG_LEVEL%22%3A%22INFO%22%2C%22SERVER_STORAGE_TYPE%22%3A%22local%22%2C%22SERVER_STORAGE_URL%22%3A%22%22%7D)
45+
46+
> Make sure to set DATA_DIR=/tmp/data and disable file logging (LOG_FILE_ENABLED=false).
47+
>
48+
> For persistence, use MySQL / Redis / PostgreSQL. On Vercel set: SERVER_STORAGE_TYPE (mysql/redis/pgsql) and SERVER_STORAGE_URL.
49+
50+
#### Render Deployment
51+
52+
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/chenyme/grok2api)
53+
54+
> Render free instances spin down after 15 minutes of inactivity; data is lost on resume/restart/redeploy.
55+
>
56+
> For persistence, use MySQL / Redis / PostgreSQL. On Render set: SERVER_STORAGE_TYPE (mysql/redis/pgsql) and SERVER_STORAGE_URL.
57+
4258
### Admin panel
4359

4460
URL: `http://<host>:8000/admin`

readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,25 @@ uv sync
2323
uv run main.py
2424
```
2525

26-
- 项目部署
26+
### 如何部署
2727

28+
29+
#### docker compose 部署
2830
```
2931
git clone https://github.com/chenyme/grok2api
3032
3133
docker compose up -d
3234
```
3335

34-
### 一键部署(Render)
36+
#### Vercel 部署
37+
38+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/chenyme/grok2api&env=LOG_LEVEL,LOG_FILE_ENABLED,DATA_DIR,SERVER_STORAGE_TYPE,SERVER_STORAGE_URL&envDefaults=%7B%22DATA_DIR%22%3A%22/tmp/data%22%2C%22LOG_FILE_ENABLED%22%3A%22false%22%2C%22LOG_LEVEL%22%3A%22INFO%22%2C%22SERVER_STORAGE_TYPE%22%3A%22local%22%2C%22SERVER_STORAGE_URL%22%3A%22%22%7D)
39+
40+
> 请务必设置 DATA_DIR=/tmp/data,并关闭文件日志 LOG_FILE_ENABLED=false。
41+
>
42+
> 持久化请使用 MySQL / Redis / PostgreSQL,在 Vercel 环境变量中设置:SERVER_STORAGE_TYPE(mysql/redis/pgsql)与 SERVER_STORAGE_URL。
43+
44+
#### Render 部署
3545

3646
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/chenyme/grok2api)
3747

vercel.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://openapi.vercel.sh/vercel.json",
3+
"version": 2,
4+
"builds": [
5+
{
6+
"src": "main.py",
7+
"use": "@vercel/python"
8+
}
9+
],
10+
"routes": [
11+
{
12+
"src": "/(.*)",
13+
"dest": "main.py"
14+
}
15+
],
16+
"functions": {
17+
"main.py": {
18+
"excludeFiles": "{tests/**,docs/**,data/**,logs/**,__pycache__/**,**/*.pyc,**/*.pyo}"
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)