|
|
@@ -16,7 +16,9 @@ version: '3.4' # For compatibility with older Docker versions
|
|
|
|
|
|
services:
|
|
|
new-api:
|
|
|
- image: calciumion/new-api:latest
|
|
|
+ build:
|
|
|
+ context: .
|
|
|
+ dockerfile: Dockerfile
|
|
|
container_name: new-api
|
|
|
restart: always
|
|
|
command: --log-dir /app/logs
|
|
|
@@ -26,23 +28,31 @@ services:
|
|
|
- ./data:/data
|
|
|
- ./logs:/app/logs
|
|
|
environment:
|
|
|
- - SQL_DSN=postgresql://root:123456@postgres:5432/new-api # ⚠️ IMPORTANT: Change the password in production!
|
|
|
-# - SQL_DSN=root:123456@tcp(mysql:3306)/new-api # Point to the mysql service, uncomment if using MySQL
|
|
|
- - REDIS_CONN_STRING=redis://:123456@redis:6379 # ⚠️ IMPORTANT: Change the password in production!
|
|
|
+ # 阿里云 MySQL 连接配置 (Aliyun MySQL Connection)
|
|
|
+ # 格式: username:password@tcp(host:port)/database
|
|
|
+ # 示例: - SQL_DSN=root:your_password@tcp(rm-xxxxx.mysql.rds.aliyuncs.com:3306)/new-api
|
|
|
+ - SQL_DSN=ai_rw:ws8oRahcYm5GwkQy@tcp(mr-y9gker44xqhwnrnv59.rwlb.singapore.rds.aliyuncs.com:3306)/new-api # ⚠️ 请替换为您的阿里云 MySQL 连接信息
|
|
|
+
|
|
|
+ # 阿里云 Redis 连接配置 (Aliyun Redis Connection)
|
|
|
+ # 格式: redis://:password@host:port/db
|
|
|
+ # 示例: - REDIS_CONN_STRING=redis://:your_password@r-xxxxx.redis.rds.aliyuncs.com:6379/0
|
|
|
+ - REDIS_CONN_STRING=redis://:RPDUyra6szoS0LA1@r-t4n74k8muxmjo181qd.redis.singapore.rds.aliyuncs.com:6379/0 # ⚠️ 请替换为您的阿里云 Redis 连接信息
|
|
|
- TZ=Asia/Shanghai
|
|
|
- ERROR_LOG_ENABLED=true # 是否启用错误日志记录 (Whether to enable error log recording)
|
|
|
- BATCH_UPDATE_ENABLED=true # 是否启用批量更新 (Whether to enable batch update)
|
|
|
- NODE_NAME=new-api-node-1 # 节点名称,用于审计日志中标识节点身份;多节点/容器部署时建议设置 (Node name used in audit logs; recommended when running multiple instances or in containers)
|
|
|
-# - STREAMING_TIMEOUT=300 # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值 (Streaming timeout in seconds, default is 120s. Increase if experiencing empty completions)
|
|
|
+ - MAX_REQUEST_BODY_MB=500 # 请求体最大大小(MB),用于支持大文件上传 (Max request body size in MB for large file uploads)
|
|
|
+ - STREAMING_TIMEOUT=300 # 流模式无响应超时时间,单位秒,默认120秒,如果出现空补全可以尝试改为更大值 (Streaming timeout in seconds, default is 120s. Increase if experiencing empty completions)
|
|
|
# - SESSION_SECRET=random_string # 多机部署时设置,必须修改这个随机字符串!! (multi-node deployment, set this to a random string!!!!!!!)
|
|
|
# - SYNC_FREQUENCY=60 # Uncomment if regular database syncing is needed
|
|
|
# - GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX # Google Analytics 的测量 ID (Google Analytics Measurement ID)
|
|
|
# - UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # Umami 网站 ID (Umami Website ID)
|
|
|
# - UMAMI_SCRIPT_URL=https://analytics.umami.is/script.js # Umami 脚本 URL,默认为官方地址 (Umami Script URL, defaults to official URL)
|
|
|
|
|
|
- depends_on:
|
|
|
- - redis
|
|
|
- - postgres
|
|
|
+ # 使用外部阿里云服务时,不需要依赖本地容器 (No local container dependencies when using external Aliyun services)
|
|
|
+# depends_on:
|
|
|
+# - redis
|
|
|
+# - postgres
|
|
|
# - mysql # Uncomment if using MySQL
|
|
|
networks:
|
|
|
- new-api-network
|
|
|
@@ -52,26 +62,31 @@ services:
|
|
|
timeout: 10s
|
|
|
retries: 3
|
|
|
|
|
|
- redis:
|
|
|
- image: redis:latest
|
|
|
- container_name: redis
|
|
|
- restart: always
|
|
|
- command: ["redis-server", "--requirepass", "123456"] # ⚠️ IMPORTANT: Change this password in production!
|
|
|
- networks:
|
|
|
- - new-api-network
|
|
|
+# ============================================================
|
|
|
+# 以下本地服务已禁用,因为使用外部阿里云服务
|
|
|
+# Local services disabled - using external Aliyun services
|
|
|
+# ============================================================
|
|
|
|
|
|
- postgres:
|
|
|
- image: postgres:15
|
|
|
- container_name: postgres
|
|
|
- restart: always
|
|
|
- environment:
|
|
|
- POSTGRES_USER: root
|
|
|
- POSTGRES_PASSWORD: 123456 # ⚠️ IMPORTANT: Change this password in production!
|
|
|
- POSTGRES_DB: new-api
|
|
|
- volumes:
|
|
|
- - pg_data:/var/lib/postgresql/data
|
|
|
- networks:
|
|
|
- - new-api-network
|
|
|
+# redis:
|
|
|
+# image: redis:latest
|
|
|
+# container_name: redis
|
|
|
+# restart: always
|
|
|
+# command: ["redis-server", "--requirepass", "123456"] # ⚠️ IMPORTANT: Change this password in production!
|
|
|
+# networks:
|
|
|
+# - new-api-network
|
|
|
+
|
|
|
+# postgres:
|
|
|
+# image: postgres:15
|
|
|
+# container_name: postgres
|
|
|
+# restart: always
|
|
|
+# environment:
|
|
|
+# POSTGRES_USER: root
|
|
|
+# POSTGRES_PASSWORD: 123456 # ⚠️ IMPORTANT: Change this password in production!
|
|
|
+# POSTGRES_DB: new-api
|
|
|
+# volumes:
|
|
|
+# - pg_data:/var/lib/postgresql/data
|
|
|
+# networks:
|
|
|
+# - new-api-network
|
|
|
# ports:
|
|
|
# - "5432:5432" # Uncomment if you need to access PostgreSQL from outside Docker
|
|
|
|
|
|
@@ -89,8 +104,9 @@ services:
|
|
|
# ports:
|
|
|
# - "3306:3306" # Uncomment if you need to access MySQL from outside Docker
|
|
|
|
|
|
-volumes:
|
|
|
- pg_data:
|
|
|
+# 使用外部阿里云服务时不需要本地数据卷 (No local volumes needed when using external Aliyun services)
|
|
|
+#volumes:
|
|
|
+# pg_data:
|
|
|
# mysql_data:
|
|
|
|
|
|
networks:
|