diff --git a/apps/sub2api/0.1.106/data.yml b/apps/sub2api/0.1.106/data.yml new file mode 100644 index 0000000..53a55eb --- /dev/null +++ b/apps/sub2api/0.1.106/data.yml @@ -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 diff --git a/apps/sub2api/0.1.106/data/.gitkeep b/apps/sub2api/0.1.106/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/apps/sub2api/0.1.106/docker-compose.yml b/apps/sub2api/0.1.106/docker-compose.yml new file mode 100644 index 0000000..a69f752 --- /dev/null +++ b/apps/sub2api/0.1.106/docker-compose.yml @@ -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: diff --git a/apps/sub2api/README.md b/apps/sub2api/README.md index 0b3afb8..a140896 100644 --- a/apps/sub2api/README.md +++ b/apps/sub2api/README.md @@ -26,11 +26,11 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。 **数据库连接设置:** - PostgreSQL 主机: `postgres`(Docker 网络内使用服务名,不是 localhost) - Redis 主机: `redis`(Docker 网络内使用服务名,不是 localhost) -- PostgreSQL 密码: 请使用强密码 +- PostgreSQL 密码: 由系统自动生成(可在部署时自定义) **JWT 密钥要求:** -- 长度必须至少 32 字符 -- 生产环境请使用随机生成的强密码 +- 由系统自动生成随机强密码 +- 长度至少 32 字符 ### 数据目录 @@ -39,6 +39,11 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。 - `redis_data` - Redis 缓存数据 - `./data` - 应用配置和数据 +## 版本说明 + +- **latest**: 最新开发版本 +- **0.1.106**: 最新稳定版本(推荐) + ## 相关链接 - 官方网站: https://sub2api.org @@ -49,7 +54,7 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。 1. **数据库连接**:在 Docker 部署中,PostgreSQL 和 Redis 使用服务名(`postgres`、`redis`)进行连接,请勿使用 `localhost` -2. **JWT 密钥**:必须至少 32 字符,建议使用随机字符串 +2. **JWT 密钥和数据库密码**:系统会自动生成强密码,部署后会自动填入,无需手动设置 3. **首次部署**:如果遇到数据库连接错误,请确保: - PostgreSQL 容器已完全启动(等待约 10-30 秒) @@ -58,4 +63,4 @@ AI API 网关平台,用于分发和管理 AI 产品订阅的 API 配额。 4. **安全提醒**: - 本项目仅供个人学习使用 - 使用者必须在遵循 Anthropic、OpenAI 等服务条款的情况下使用 - - 请勿用于非法用途 \ No newline at end of file + - 请勿用于非法用途 diff --git a/apps/sub2api/README_en.md b/apps/sub2api/README_en.md index 08df9af..bbd8830 100644 --- a/apps/sub2api/README_en.md +++ b/apps/sub2api/README_en.md @@ -26,11 +26,11 @@ After deployment, access `http://YOUR_SERVER_IP:8080` to run the setup wizard. **Database Connection Settings:** - PostgreSQL Host: `postgres` (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:** -- Length must be at least 32 characters -- Use a randomly generated strong password for production +- Automatically generated by the system with a strong random password +- Length is at least 32 characters ### Data Directory @@ -39,6 +39,11 @@ Application data is stored in Docker named volumes: - `redis_data` - Redis cache data - `./data` - Application configuration and data +## Version Information + +- **latest**: Latest development version +- **0.1.106**: Latest stable version (recommended) + ## Links - 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` -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: - PostgreSQL container has fully started (wait about 10-30 seconds) @@ -58,4 +63,4 @@ Application data is stored in Docker named volumes: 4. **Disclaimer**: - This project is for personal learning purposes only - Users must comply with the Terms of Service of Anthropic, OpenAI, etc. - - Do not use for illegal purposes \ No newline at end of file + - Do not use for illegal purposes diff --git a/apps/sub2api/latest/config.yaml b/apps/sub2api/latest/config.yaml deleted file mode 100644 index fbe1ad1..0000000 --- a/apps/sub2api/latest/config.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/apps/sub2api/latest/data.yml b/apps/sub2api/latest/data.yml index b49e605..53a55eb 100644 --- a/apps/sub2api/latest/data.yml +++ b/apps/sub2api/latest/data.yml @@ -15,19 +15,21 @@ additionalProperties: labelZh: 时区 required: true type: text - - default: sub2api_secure_jwt_secret_change_in_production + - default: sub2api-jwt-secret-change-in-production edit: true envKey: JWT_SECRET labelEn: JWT Secret labelZh: JWT 密钥 + random: true required: true - rule: paramCommon + rule: paramComplexity type: password - - default: sub2api_secure_db_password_change_in_production + - default: sub2api_db_pass edit: true envKey: POSTGRES_PASSWORD labelEn: PostgreSQL Password labelZh: PostgreSQL 密码 + random: true required: true - rule: paramCommon - type: password \ No newline at end of file + rule: paramComplexity + type: password diff --git a/apps/sub2api/latest/data/config.yml b/apps/sub2api/latest/data/config.yml deleted file mode 100644 index 6075092..0000000 --- a/apps/sub2api/latest/data/config.yml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/apps/sub2api/latest/docker-compose.yml b/apps/sub2api/latest/docker-compose.yml index 86ad0df..6d9a890 100644 --- a/apps/sub2api/latest/docker-compose.yml +++ b/apps/sub2api/latest/docker-compose.yml @@ -9,7 +9,6 @@ services: - "${PANEL_APP_PORT_HTTP}:8080" volumes: - ./data:/app/data - - ./config.yaml:/app/config.yaml:ro environment: - TZ=${TZ} - POSTGRES_CONN_STRING=postgres://sub2api:${POSTGRES_PASSWORD}@postgres:5432/sub2api?sslmode=disable @@ -54,4 +53,4 @@ networks: volumes: postgres_data: - redis_data: \ No newline at end of file + redis_data: