mirror of
https://github.com/arch3rPro/1Panel-Appstore.git
synced 2026-04-15 00:17:12 +08:00
refactor(sub2api): 重构配置管理和版本结构
移除硬编码的配置文件,改为使用环境变量 添加 0.1.106 稳定版本目录结构 更新 README 文档说明自动生成密码功能
This commit is contained in:
35
apps/sub2api/0.1.106/data.yml
Normal file
35
apps/sub2api/0.1.106/data.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
additionalProperties:
|
||||||
|
formFields:
|
||||||
|
- default: 8080
|
||||||
|
edit: true
|
||||||
|
envKey: PANEL_APP_PORT_HTTP
|
||||||
|
labelEn: Web Port
|
||||||
|
labelZh: Web 端口
|
||||||
|
required: true
|
||||||
|
rule: paramPort
|
||||||
|
type: number
|
||||||
|
- default: Asia/Shanghai
|
||||||
|
edit: true
|
||||||
|
envKey: TZ
|
||||||
|
labelEn: Time Zone
|
||||||
|
labelZh: 时区
|
||||||
|
required: true
|
||||||
|
type: text
|
||||||
|
- default: sub2api-jwt-secret-change-in-production
|
||||||
|
edit: true
|
||||||
|
envKey: JWT_SECRET
|
||||||
|
labelEn: JWT Secret
|
||||||
|
labelZh: JWT 密钥
|
||||||
|
random: true
|
||||||
|
required: true
|
||||||
|
rule: paramComplexity
|
||||||
|
type: password
|
||||||
|
- default: sub2api_db_pass
|
||||||
|
edit: true
|
||||||
|
envKey: POSTGRES_PASSWORD
|
||||||
|
labelEn: PostgreSQL Password
|
||||||
|
labelZh: PostgreSQL 密码
|
||||||
|
random: true
|
||||||
|
required: true
|
||||||
|
rule: paramComplexity
|
||||||
|
type: password
|
||||||
0
apps/sub2api/0.1.106/data/.gitkeep
Normal file
0
apps/sub2api/0.1.106/data/.gitkeep
Normal file
56
apps/sub2api/0.1.106/docker-compose.yml
Normal file
56
apps/sub2api/0.1.106/docker-compose.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
services:
|
||||||
|
sub2api:
|
||||||
|
image: weishaw/sub2api:0.1.106
|
||||||
|
container_name: ${CONTAINER_NAME}
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- 1panel-network
|
||||||
|
ports:
|
||||||
|
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||||
|
volumes:
|
||||||
|
- ./data:/app/data
|
||||||
|
environment:
|
||||||
|
- TZ=${TZ}
|
||||||
|
- POSTGRES_CONN_STRING=postgres://sub2api:${POSTGRES_PASSWORD}@postgres:5432/sub2api?sslmode=disable
|
||||||
|
- REDIS_CONN_STRING=redis://redis:6379/0
|
||||||
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
|
labels:
|
||||||
|
createdBy: "Apps"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15-alpine
|
||||||
|
container_name: ${CONTAINER_NAME}-postgres
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- 1panel-network
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=sub2api
|
||||||
|
- POSTGRES_USER=sub2api
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
labels:
|
||||||
|
createdBy: "Apps"
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: ${CONTAINER_NAME}-redis
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- 1panel-network
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
command: redis-server --appendonly yes
|
||||||
|
labels:
|
||||||
|
createdBy: "Apps"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
1panel-network:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
redis_data:
|
||||||
@@ -26,11 +26,11 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。
|
|||||||
**数据库连接设置:**
|
**数据库连接设置:**
|
||||||
- PostgreSQL 主机: `postgres`(Docker 网络内使用服务名,不是 localhost)
|
- PostgreSQL 主机: `postgres`(Docker 网络内使用服务名,不是 localhost)
|
||||||
- Redis 主机: `redis`(Docker 网络内使用服务名,不是 localhost)
|
- Redis 主机: `redis`(Docker 网络内使用服务名,不是 localhost)
|
||||||
- PostgreSQL 密码: 请使用强密码
|
- PostgreSQL 密码: 由系统自动生成(可在部署时自定义)
|
||||||
|
|
||||||
**JWT 密钥要求:**
|
**JWT 密钥要求:**
|
||||||
- 长度必须至少 32 字符
|
- 由系统自动生成随机强密码
|
||||||
- 生产环境请使用随机生成的强密码
|
- 长度至少 32 字符
|
||||||
|
|
||||||
### 数据目录
|
### 数据目录
|
||||||
|
|
||||||
@@ -39,6 +39,11 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。
|
|||||||
- `redis_data` - Redis 缓存数据
|
- `redis_data` - Redis 缓存数据
|
||||||
- `./data` - 应用配置和数据
|
- `./data` - 应用配置和数据
|
||||||
|
|
||||||
|
## 版本说明
|
||||||
|
|
||||||
|
- **latest**: 最新开发版本
|
||||||
|
- **0.1.106**: 最新稳定版本(推荐)
|
||||||
|
|
||||||
## 相关链接
|
## 相关链接
|
||||||
|
|
||||||
- 官方网站: https://sub2api.org
|
- 官方网站: https://sub2api.org
|
||||||
@@ -49,7 +54,7 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。
|
|||||||
|
|
||||||
1. **数据库连接**:在 Docker 部署中,PostgreSQL 和 Redis 使用服务名(`postgres`、`redis`)进行连接,请勿使用 `localhost`
|
1. **数据库连接**:在 Docker 部署中,PostgreSQL 和 Redis 使用服务名(`postgres`、`redis`)进行连接,请勿使用 `localhost`
|
||||||
|
|
||||||
2. **JWT 密钥**:必须至少 32 字符,建议使用随机字符串
|
2. **JWT 密钥和数据库密码**:系统会自动生成强密码,部署后会自动填入,无需手动设置
|
||||||
|
|
||||||
3. **首次部署**:如果遇到数据库连接错误,请确保:
|
3. **首次部署**:如果遇到数据库连接错误,请确保:
|
||||||
- PostgreSQL 容器已完全启动(等待约 10-30 秒)
|
- PostgreSQL 容器已完全启动(等待约 10-30 秒)
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ After deployment, access `http://YOUR_SERVER_IP:8080` to run the setup wizard.
|
|||||||
**Database Connection Settings:**
|
**Database Connection Settings:**
|
||||||
- PostgreSQL Host: `postgres` (use service name in Docker network, NOT localhost)
|
- PostgreSQL Host: `postgres` (use service name in Docker network, NOT localhost)
|
||||||
- Redis Host: `redis` (use service name in Docker network, NOT localhost)
|
- Redis Host: `redis` (use service name in Docker network, NOT localhost)
|
||||||
- PostgreSQL Password: Please use a strong password
|
- PostgreSQL Password: Automatically generated by the system (can be customized during deployment)
|
||||||
|
|
||||||
**JWT Secret Requirements:**
|
**JWT Secret Requirements:**
|
||||||
- Length must be at least 32 characters
|
- Automatically generated by the system with a strong random password
|
||||||
- Use a randomly generated strong password for production
|
- Length is at least 32 characters
|
||||||
|
|
||||||
### Data Directory
|
### Data Directory
|
||||||
|
|
||||||
@@ -39,6 +39,11 @@ Application data is stored in Docker named volumes:
|
|||||||
- `redis_data` - Redis cache data
|
- `redis_data` - Redis cache data
|
||||||
- `./data` - Application configuration and data
|
- `./data` - Application configuration and data
|
||||||
|
|
||||||
|
## Version Information
|
||||||
|
|
||||||
|
- **latest**: Latest development version
|
||||||
|
- **0.1.106**: Latest stable version (recommended)
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- Website: https://sub2api.org
|
- Website: https://sub2api.org
|
||||||
@@ -49,7 +54,7 @@ Application data is stored in Docker named volumes:
|
|||||||
|
|
||||||
1. **Database Connection**: In Docker deployment, PostgreSQL and Redis use service names (`postgres`, `redis`) for connection. Do NOT use `localhost`
|
1. **Database Connection**: In Docker deployment, PostgreSQL and Redis use service names (`postgres`, `redis`) for connection. Do NOT use `localhost`
|
||||||
|
|
||||||
2. **JWT Secret**: Must be at least 32 characters, use a random string recommended
|
2. **JWT Secret and Database Password**: System will automatically generate strong passwords, which will be auto-filled during deployment, no manual setup required
|
||||||
|
|
||||||
3. **First Deployment**: If you encounter database connection errors, ensure:
|
3. **First Deployment**: If you encounter database connection errors, ensure:
|
||||||
- PostgreSQL container has fully started (wait about 10-30 seconds)
|
- PostgreSQL container has fully started (wait about 10-30 seconds)
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
server:
|
|
||||||
host: "0.0.0.0"
|
|
||||||
port: 8080
|
|
||||||
mode: "release"
|
|
||||||
|
|
||||||
database:
|
|
||||||
host: "postgres"
|
|
||||||
port: 5432
|
|
||||||
user: "sub2api"
|
|
||||||
password: "${POSTGRES_PASSWORD}"
|
|
||||||
dbname: "sub2api"
|
|
||||||
|
|
||||||
redis:
|
|
||||||
host: "redis"
|
|
||||||
port: 6379
|
|
||||||
password: ""
|
|
||||||
|
|
||||||
jwt:
|
|
||||||
secret: "sub2api_jwt_secret_change_in_production_32chars"
|
|
||||||
expire_hour: 24
|
|
||||||
@@ -15,19 +15,21 @@ additionalProperties:
|
|||||||
labelZh: 时区
|
labelZh: 时区
|
||||||
required: true
|
required: true
|
||||||
type: text
|
type: text
|
||||||
- default: sub2api_secure_jwt_secret_change_in_production
|
- default: sub2api-jwt-secret-change-in-production
|
||||||
edit: true
|
edit: true
|
||||||
envKey: JWT_SECRET
|
envKey: JWT_SECRET
|
||||||
labelEn: JWT Secret
|
labelEn: JWT Secret
|
||||||
labelZh: JWT 密钥
|
labelZh: JWT 密钥
|
||||||
|
random: true
|
||||||
required: true
|
required: true
|
||||||
rule: paramCommon
|
rule: paramComplexity
|
||||||
type: password
|
type: password
|
||||||
- default: sub2api_secure_db_password_change_in_production
|
- default: sub2api_db_pass
|
||||||
edit: true
|
edit: true
|
||||||
envKey: POSTGRES_PASSWORD
|
envKey: POSTGRES_PASSWORD
|
||||||
labelEn: PostgreSQL Password
|
labelEn: PostgreSQL Password
|
||||||
labelZh: PostgreSQL 密码
|
labelZh: PostgreSQL 密码
|
||||||
|
random: true
|
||||||
required: true
|
required: true
|
||||||
rule: paramCommon
|
rule: paramComplexity
|
||||||
type: password
|
type: password
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
server:
|
|
||||||
host: "0.0.0.0"
|
|
||||||
port: 8080
|
|
||||||
mode: "release"
|
|
||||||
|
|
||||||
database:
|
|
||||||
host: "postgres"
|
|
||||||
port: 5432
|
|
||||||
user: "sub2api"
|
|
||||||
password: "${POSTGRES_PASSWORD}"
|
|
||||||
dbname: "sub2api"
|
|
||||||
|
|
||||||
redis:
|
|
||||||
host: "redis"
|
|
||||||
port: 6379
|
|
||||||
password: ""
|
|
||||||
|
|
||||||
jwt:
|
|
||||||
secret: "${JWT_SECRET}"
|
|
||||||
expire_hour: 24
|
|
||||||
|
|
||||||
default:
|
|
||||||
user_concurrency: 5
|
|
||||||
user_balance: 0
|
|
||||||
api_key_prefix: "sk-"
|
|
||||||
rate_multiplier: 1.0
|
|
||||||
@@ -9,7 +9,6 @@ services:
|
|||||||
- "${PANEL_APP_PORT_HTTP}:8080"
|
- "${PANEL_APP_PORT_HTTP}:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
- ./config.yaml:/app/config.yaml:ro
|
|
||||||
environment:
|
environment:
|
||||||
- TZ=${TZ}
|
- TZ=${TZ}
|
||||||
- POSTGRES_CONN_STRING=postgres://sub2api:${POSTGRES_PASSWORD}@postgres:5432/sub2api?sslmode=disable
|
- POSTGRES_CONN_STRING=postgres://sub2api:${POSTGRES_PASSWORD}@postgres:5432/sub2api?sslmode=disable
|
||||||
|
|||||||
Reference in New Issue
Block a user