Standardize SurClaw ports away from defaults
- Change the API default listen port from 3000 to 3100 and include the Docker frontend origin in default CORS. - Point Vite's default API proxy, Docker API container port, and Nginx upstream to 3100. - Keep Docker host ports on 4002 for web, 3002 for API, and 5433 for PostgreSQL. - Update environment examples and documentation to remove stale localhost:3000 guidance.
This commit is contained in:
@@ -10,7 +10,7 @@ npm run dev
|
||||
```
|
||||
|
||||
开发服务监听 `0.0.0.0:3001`。
|
||||
开发模式下 Vite 会把 `/api` 代理到 `VITE_API_PROXY_TARGET`,默认 `http://localhost:3000`。
|
||||
开发模式下 Vite 会把 `/api` 代理到 `VITE_API_PROXY_TARGET`,默认 `http://localhost:3100`。
|
||||
|
||||
后端:
|
||||
|
||||
@@ -20,10 +20,10 @@ npm run prisma:generate
|
||||
npm run server:dev
|
||||
```
|
||||
|
||||
本地直接运行 API 默认监听 `0.0.0.0:3000`,健康检查为:
|
||||
本地直接运行 API 默认监听 `0.0.0.0:3100`,健康检查为:
|
||||
|
||||
```text
|
||||
http://localhost:3000/api/health
|
||||
http://localhost:3100/api/health
|
||||
```
|
||||
|
||||
如需连接真实 PostgreSQL:
|
||||
@@ -56,13 +56,13 @@ AI 和语音密钥由后端 Settings API 保存并由代理使用,前端不再
|
||||
|
||||
后端新增变量:
|
||||
|
||||
- `API_PORT`:API 监听端口。本地直接运行默认 `3000`;Docker Compose 暴露到宿主机的默认端口是 `3002`。
|
||||
- `API_PORT`:API 监听端口。本地直接运行默认 `3100`;Docker Compose 暴露到宿主机的默认端口是 `3002`。
|
||||
- `CORS_ORIGIN`:允许跨域携带 Cookie 的前端来源。
|
||||
- `DATABASE_URL`:PostgreSQL 连接串。Docker Compose 暴露到宿主机的默认端口是 `5433`,容器内部仍使用 `db:5432`。
|
||||
- `SESSION_SECRET`:Session Cookie 签名密钥。
|
||||
- `SESSION_COOKIE_SECURE`:是否只通过 HTTPS 发送 Session Cookie。本地 HTTP/Compose 默认 `false`,生产 HTTPS 应设为 `true`。
|
||||
- `FILE_STORAGE_DIR`:后端文件目录。Docker Compose 默认 `/app/uploads`,并挂载到 `uploads_data` volume。
|
||||
- `VITE_API_PROXY_TARGET`:前端开发服务器 `/api` 代理目标。直接运行后端用 `http://localhost:3000`;连接 Docker Compose API 用 `http://localhost:3002`。
|
||||
- `VITE_API_PROXY_TARGET`:前端开发服务器 `/api` 代理目标。直接运行后端用 `http://localhost:3100`;连接 Docker Compose API 用 `http://localhost:3002`。
|
||||
- `VITE_ENABLE_LOCAL_FALLBACK`:生产构建是否允许本地兼容回退。开发模式默认启用,生产默认关闭。
|
||||
|
||||
## Docker 部署
|
||||
|
||||
Reference in New Issue
Block a user