Skip to content

Let's use AI to Earn!

docs: fix deployment docs to match actual project

Sakura7790a9ef134c
diff --git a/DOCKER_DEPLOYMENT_CN.md b/DOCKER_DEPLOYMENT_CN.md
index ffcdadc6..dacf6256 100644
--- a/DOCKER_DEPLOYMENT_CN.md
+++ b/DOCKER_DEPLOYMENT_CN.md
@@ -60,9 +60,9 @@ cd AiToEarn
### 2. 配置环境变量
-所有环境变量直接在 `docker-compose.yml` 文件中配置。
+所有环境变量直接在 `docker-compose.yml` 文件中配置。**所有配置项都已提供默认值,无需修改即可直接启动应用。**
-编辑 `docker-compose.yml`,**至少修改以下必填项**:
+生产环境部署时,建议修改以下安全相关配置:
```yaml
# 1. mongodb 服务 — 修改数据库密码
@@ -79,17 +79,13 @@ INTERNAL_TOKEN: your-random-internal-token
# 4. aitoearn-server 服务 — 修改以下变量(须与 aitoearn-ai 保持一致)
MONGODB_PASSWORD: your-secure-password
-STATISTICS_DB_PASSWORD: your-secure-password # 默认与 MongoDB 密码一致
REDIS_PASSWORD: your-secure-password
JWT_SECRET: your-random-jwt-secret # 须与 aitoearn-ai 一致
INTERNAL_TOKEN: your-random-internal-token # 须与 aitoearn-ai 一致
APP_DOMAIN: your-domain.com # 生产环境改为你的域名
-
-# 5. aitoearn-web 服务 — 非 localhost 部署时修改
-NEXT_PUBLIC_API_URL: https://your-domain.com/api
```
-> **重要**: 修改密码时,必须同步更新所有引用该密码的服务。例如 MongoDB 密码出现在 `mongodb`、`aitoearn-ai`、`aitoearn-server` 三个服务中。
+> **注意**: 修改密码时,必须同步更新所有引用该密码的服务。例如 MongoDB 密码出现在 `mongodb`、`aitoearn-ai`、`aitoearn-server` 三个服务中。
>
> 可以使用 `openssl rand -hex 32` 生成随机字符串。
@@ -135,7 +131,9 @@ docker compose ps
以下变量均在 `docker-compose.yml` 各服务的 `environment` 部分配置。
-### 必填配置
+### 核心配置
+
+以下变量均已提供可用的默认值,应用可直接启动。生产环境建议修改密码和密钥。
| 变量 | 所属服务 | 说明 | 默认值 |
|------|----------|------|--------|
@@ -146,7 +144,6 @@ docker compose ps
| `INTERNAL_TOKEN` | aitoearn-ai, aitoearn-server | 内部服务通信 token | `change-this-secret-token` |
| `APP_DOMAIN` | aitoearn-server | 应用域名(用于 OAuth 回调地址) | `localhost` |
| `ASSETS_CONFIG` | aitoearn-ai, aitoearn-server | 资源存储配置(JSON 格式,见上文) | 内置 RustFS 配置 |
-| `NEXT_PUBLIC_API_URL` | aitoearn-web | 前端 API 地址(浏览器端访问) | `http://localhost:8080/api` |
### 内部服务通信
@@ -157,17 +154,6 @@ docker compose ps
| `SERVER_URL` | aitoearn-ai | AI 服务访问后端的地址 | `http://aitoearn-server:3002` |
| `AI_URL` | aitoearn-server | 后端访问 AI 服务的地址 | `http://aitoearn-ai:3010` |
-### 统计数据库
-
-默认与主 MongoDB 使用同一实例,生产环境可分离。
-
-| 变量 | 所属服务 | 说明 | 默认值 |
-|------|----------|------|--------|
-| `STATISTICS_DB_HOST` | aitoearn-server | 统计数据库主机 | `mongodb` |
-| `STATISTICS_DB_PORT` | aitoearn-server | 统计数据库端口 | `27017` |
-| `STATISTICS_DB_USERNAME` | aitoearn-server | 统计数据库用户名 | `admin` |
-| `STATISTICS_DB_PASSWORD` | aitoearn-server | 统计数据库密码 | `password` |
-
### 资源存储配置(RustFS)
Docker Compose 内置了 [RustFS](https://github.com/rustfs/rustfs) 作为 S3 兼容对象存储,**开箱即用,无需额外配置**。
@@ -187,7 +173,7 @@ Docker Compose 内置了 [RustFS](https://github.com/rustfs/rustfs) 作为 S3
**`ASSETS_CONFIG` 环境变量**(JSON 格式)用于配置资源存储,在 `aitoearn-ai` 和 `aitoearn-server` 两个服务中都需要设置:
```yaml
-ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://localhost:9000","cdnEndpoint":"http://localhost:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
+ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://127.0.0.1:9000","cdnEndpoint":"http://127.0.0.1:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
```
**生产环境**如使用 AWS S3 或阿里云 OSS,更新 `ASSETS_CONFIG` 或两个 config.js 文件中的 `assets` 配置:
@@ -255,7 +241,7 @@ AI 模型的具体定义(可用模型列表、定价等)在 `project/aitoear
| Bilibili | `BILIBILI_CLIENT_ID/SECRET` | https://open.bilibili.com |
| Google | `GOOGLE_CLIENT_ID/SECRET` | https://console.cloud.google.com/apis/credentials |
| 快手 | `KWAI_CLIENT_ID/SECRET` | https://open.kuaishou.com |
-| Pinterest | `PINTEREST_CLIENT_ID/SECRET`, `PINTEREST_TEST_AUTHORIZATION` | https://developers.pinterest.com |
+| Pinterest | `PINTEREST_CLIENT_ID/SECRET` | https://developers.pinterest.com |
| TikTok | `TIKTOK_CLIENT_ID/SECRET` | https://developers.tiktok.com |
| Twitter/X | `TWITTER_CLIENT_ID/SECRET` | https://developer.x.com/en/portal |
| Facebook | `FACEBOOK_CLIENT_ID/SECRET`, `FACEBOOK_CONFIG_ID` | https://developers.facebook.com |
@@ -276,19 +262,10 @@ AI 模型的具体定义(可用模型列表、定价等)在 `project/aitoear
|------|----------|------|----------|
| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | 邮件服务(AWS SES SMTP) | AWS Console → SES → SMTP |
| `ALI_SMS_ACCESS_KEY_ID` 等 4 项 | aitoearn-server | 阿里云短信 | https://dysms.console.aliyun.com |
-| `ALI_GREEN_ACCESS_KEY_ID/SECRET` | aitoearn-server | 阿里云内容安全 | https://yundun.console.aliyun.com |
-
-### 自动登录配置(可选)
-
-如需在 aitoearn-server 启动时自动初始化管理员 token,可通过 docker-compose 的 `command` 读取 token 文件并设置为 `AUTO_LOGIN_TOKEN` 环境变量:
-```yaml
-aitoearn-server:
- command: >
- sh -c 'export AUTO_LOGIN_TOKEN=$$(cat /run/secrets/auto-login-token 2>/dev/null || echo ""); exec node main.js'
-```
+### 自动登录
-> 注意:之前的 `AUTO_LOGIN_TOKEN_PATH` 环境变量已被移除,改为在启动命令中直接读取文件内容。
+自动登录默认已启用。首次启动时,`aitoearn-init` 服务会生成管理员 token 并保存到共享卷中。`aitoearn-web` 服务会自动读取该 token,无需手动登录。
### 镜像拉取策略
@@ -297,13 +274,13 @@ Docker Compose 中所有应用服务镜像使用 `pull_policy: always`,确保
```yaml
services:
aitoearn-web:
- image: aitoearn/web:latest
+ image: aitoearn/aitoearn-web:latest
pull_policy: always
aitoearn-server:
- image: aitoearn/server:latest
+ image: aitoearn/aitoearn-server:latest
pull_policy: always
aitoearn-ai:
- image: aitoearn/ai:latest
+ image: aitoearn/aitoearn-ai:latest
pull_policy: always
```
@@ -693,9 +670,8 @@ lsof -i :6379
### Q: 前端页面加载但 API 请求失败?
-1. 确认 `docker-compose.yml` 中 `aitoearn-web` 服务的 `NEXT_PUBLIC_API_URL` 配置正确
-2. 检查 Nginx 是否正常运行:`docker compose logs nginx`
-3. 检查后端服务是否健康:`docker compose ps`
+1. 检查 Nginx 是否正常运行:`docker compose logs nginx`
+2. 检查后端服务是否健康:`docker compose ps`
### Q: OAuth 登录回调失败?
diff --git a/DOCKER_DEPLOYMENT_EN.md b/DOCKER_DEPLOYMENT_EN.md
index 1e47800e..ec20813e 100644
--- a/DOCKER_DEPLOYMENT_EN.md
+++ b/DOCKER_DEPLOYMENT_EN.md
@@ -60,9 +60,9 @@ cd AiToEarn
### 2. Configure Environment Variables
-All environment variables are configured directly in `docker-compose.yml`.
+All environment variables are configured directly in `docker-compose.yml`. **Default values are already provided for all settings, so you can start the application immediately without any changes.**
-Edit `docker-compose.yml`. **At minimum, modify these required fields**:
+For production deployments, it is recommended to modify the following security-related fields:
```yaml
# 1. mongodb service — change database password
@@ -79,17 +79,13 @@ INTERNAL_TOKEN: your-random-internal-token
# 4. aitoearn-server service — change these variables (must match aitoearn-ai)
MONGODB_PASSWORD: your-secure-password
-STATISTICS_DB_PASSWORD: your-secure-password # defaults to same as MongoDB password
REDIS_PASSWORD: your-secure-password
JWT_SECRET: your-random-jwt-secret # must match aitoearn-ai
INTERNAL_TOKEN: your-random-internal-token # must match aitoearn-ai
APP_DOMAIN: your-domain.com # change for production
-
-# 5. aitoearn-web service — change for non-localhost deployments
-NEXT_PUBLIC_API_URL: https://your-domain.com/api
```
-> **Important**: When changing passwords, you must update ALL services that reference them. For example, the MongoDB password appears in the `mongodb`, `aitoearn-ai`, and `aitoearn-server` services.
+> **Note**: When changing passwords, you must update ALL services that reference them. For example, the MongoDB password appears in the `mongodb`, `aitoearn-ai`, and `aitoearn-server` services.
>
> Generate random strings with: `openssl rand -hex 32`
@@ -135,7 +131,9 @@ All services should show `healthy` or `running` status.
All variables below are configured in the `environment` section of each service in `docker-compose.yml`.
-### Required
+### Core Settings
+
+All variables below have working defaults — the application starts out of the box. For production, change passwords and secrets.
| Variable | Service(s) | Description | Default |
|----------|------------|-------------|---------|
@@ -146,7 +144,6 @@ All variables below are configured in the `environment` section of each service
| `INTERNAL_TOKEN` | aitoearn-ai, aitoearn-server | Inter-service auth token | `change-this-secret-token` |
| `APP_DOMAIN` | aitoearn-server | Application domain (for OAuth callbacks) | `localhost` |
| `ASSETS_CONFIG` | aitoearn-ai, aitoearn-server | Asset storage config (JSON format, see above) | Built-in RustFS config |
-| `NEXT_PUBLIC_API_URL` | aitoearn-web | Frontend API URL (browser-facing) | `http://localhost:8080/api` |
### Internal Service Communication
@@ -157,17 +154,6 @@ These variables handle inter-service communication via Docker internal networkin
| `SERVER_URL` | aitoearn-ai | URL to reach aitoearn-server | `http://aitoearn-server:3002` |
| `AI_URL` | aitoearn-server | URL to reach aitoearn-ai | `http://aitoearn-ai:3010` |
-### Statistics Database
-
-Defaults to the same MongoDB instance. Can be separated for production.
-
-| Variable | Service | Description | Default |
-|----------|---------|-------------|---------|
-| `STATISTICS_DB_HOST` | aitoearn-server | Statistics DB host | `mongodb` |
-| `STATISTICS_DB_PORT` | aitoearn-server | Statistics DB port | `27017` |
-| `STATISTICS_DB_USERNAME` | aitoearn-server | Statistics DB username | `admin` |
-| `STATISTICS_DB_PASSWORD` | aitoearn-server | Statistics DB password | `password` |
-
### Assets Storage (RustFS)
Docker Compose includes [RustFS](https://github.com/rustfs/rustfs) as a built-in S3-compatible object storage. **It works out of the box with no extra configuration**.
@@ -187,7 +173,7 @@ To change RustFS credentials, update these locations:
**`ASSETS_CONFIG` environment variable** (JSON format) configures asset storage. Required in both `aitoearn-ai` and `aitoearn-server` services:
```yaml
-ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://localhost:9000","cdnEndpoint":"http://localhost:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
+ASSETS_CONFIG: '{"provider":"s3","region":"us-east-1","bucketName":"aitoearn","endpoint":"http://rustfs.local:9000","publicEndpoint":"http://127.0.0.1:9000","cdnEndpoint":"http://127.0.0.1:8080/oss","accessKeyId":"rustfsadmin","secretAccessKey":"rustfsadmin","forcePathStyle":true}'
```
**For production** with AWS S3 or other providers, update `ASSETS_CONFIG` or the `assets` config in both config.js files:
@@ -255,7 +241,7 @@ Configure social media OAuth credentials as needed in the `aitoearn-server` serv
| Bilibili | `BILIBILI_CLIENT_ID/SECRET` | https://open.bilibili.com |
| Google | `GOOGLE_CLIENT_ID/SECRET` | https://console.cloud.google.com/apis/credentials |
| Kwai | `KWAI_CLIENT_ID/SECRET` | https://open.kuaishou.com |
-| Pinterest | `PINTEREST_CLIENT_ID/SECRET`, `PINTEREST_TEST_AUTHORIZATION` | https://developers.pinterest.com |
+| Pinterest | `PINTEREST_CLIENT_ID/SECRET` | https://developers.pinterest.com |
| TikTok | `TIKTOK_CLIENT_ID/SECRET` | https://developers.tiktok.com |
| Twitter/X | `TWITTER_CLIENT_ID/SECRET` | https://developer.x.com/en/portal |
| Facebook | `FACEBOOK_CLIENT_ID/SECRET`, `FACEBOOK_CONFIG_ID` | https://developers.facebook.com |
@@ -276,19 +262,10 @@ Configure social media OAuth credentials as needed in the `aitoearn-server` serv
|----------|---------|-------------|-----------|
| `MAIL_USER` / `MAIL_PASS` | aitoearn-server | Email (AWS SES SMTP) | AWS Console → SES → SMTP |
| `ALI_SMS_*` (4 vars) | aitoearn-server | Aliyun SMS | https://dysms.console.aliyun.com |
-| `ALI_GREEN_ACCESS_KEY_ID/SECRET` | aitoearn-server | Aliyun Content Safety | https://yundun.console.aliyun.com |
-
-### Auto-Login Configuration (Optional)
-
-To automatically initialize an admin token when aitoearn-server starts, use the docker-compose `command` to read a token file and set it as the `AUTO_LOGIN_TOKEN` environment variable:
-```yaml
-aitoearn-server:
- command: >
- sh -c 'export AUTO_LOGIN_TOKEN=$$(cat /run/secrets/auto-login-token 2>/dev/null || echo ""); exec node main.js'
-```
+### Auto-Login
-> Note: The previous `AUTO_LOGIN_TOKEN_PATH` environment variable has been removed. The file contents are now read directly in the startup command.
+Auto-login is enabled by default. On first startup, the `aitoearn-init` service generates an admin token and saves it to a shared volume. The `aitoearn-web` service reads this token automatically and uses it to log in without manual authentication.
### Image Pull Policy
@@ -297,13 +274,13 @@ All application service images in Docker Compose use `pull_policy: always` to en
```yaml
services:
aitoearn-web:
- image: aitoearn/web:latest
+ image: aitoearn/aitoearn-web:latest
pull_policy: always
aitoearn-server:
- image: aitoearn/server:latest
+ image: aitoearn/aitoearn-server:latest
pull_policy: always
aitoearn-ai:
- image: aitoearn/ai:latest
+ image: aitoearn/aitoearn-ai:latest
pull_policy: always
```
@@ -693,9 +670,8 @@ lsof -i :6379
### Q: Frontend loads but API requests fail?
-1. Verify `NEXT_PUBLIC_API_URL` in the `aitoearn-web` service of `docker-compose.yml` is correct
-2. Check Nginx logs: `docker compose logs nginx`
-3. Check backend health: `docker compose ps`
+1. Check Nginx logs: `docker compose logs nginx`
+2. Check backend health: `docker compose ps`
### Q: OAuth login callback fails?