feat: MySQL SSL 支持 + 任务编辑回显 + InfluxDB 备份
MySQL:
- 新增 use_ssl 选项;MariaDB 11.x 默认强制 SSL 且默认 verify cert,
故启用 SSL 时同时加 --skip-ssl-verify-server-cert 以兼容自签名证书。
任务编辑回显:
- 后端 JobOut 新增 source_config_safe 字段,解密后敏感字段(password/token/
secret_key/access_key)脱敏为 "***"。
- 更新端点接收 source_config;若密码字段为 "***" 则保留原值不变,
支持"不改密码只改其它字段"的常见场景。
- 前端 JobForm 完整回显所有数据源字段,type='edit' 时去掉 disabled。
InfluxDB 备份(新增类型):
- 后端 core/backup/influxdb.py:
- v2.x:调用 influx CLI(influxdb2-client-2.7.5 二进制直接安装)执行 influx backup
生成目录后 tar.gz 流式打包上传。
- v1.x:通过 HTTP API 调用 /query?db=...&q=SELECT * FROM /.*/ 拉取全量数据
导出为 CSV + META.txt。
- Dockerfile:直接下载 influx CLI 二进制(绕开 apt 签名问题)。
- 前端 JobForm:根据 version 动态显示 v1/v2 表单字段。
- schemas/job.py:新增 InfluxDBSourceConfigV1 / V2。
- 类型字面量扩展:'mysql' | 'directory' | 'influxdb'。
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ class MySQLSourceConfig(BaseModel):
|
||||
user: str = Field(..., min_length=1)
|
||||
password: str = Field("", description="可空(trust auth)")
|
||||
database: str = Field(..., min_length=1, description="要备份的库名")
|
||||
use_ssl: bool = Field(False, description="True 启用 SSL/TLS;如服务器是自签名证书建议关闭")
|
||||
extra_args: str = Field("", description="额外 mysqldump 参数,如 '--skip-lock-tables'")
|
||||
|
||||
|
||||
@@ -22,9 +23,27 @@ class DirectorySourceConfig(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class InfluxDBSourceConfigV1(BaseModel):
|
||||
version: Literal["1"]
|
||||
host: str = Field(..., min_length=1)
|
||||
port: int = Field(8086, ge=1, le=65535)
|
||||
database: str = Field(..., min_length=1)
|
||||
username: str = Field("", description="留空表示无认证")
|
||||
password: str = Field("")
|
||||
|
||||
|
||||
class InfluxDBSourceConfigV2(BaseModel):
|
||||
version: Literal["2"]
|
||||
host: str = Field(..., min_length=1)
|
||||
port: int = Field(8086, ge=1, le=65535)
|
||||
org: str = Field(..., min_length=1)
|
||||
bucket: str = Field(..., min_length=1)
|
||||
token: str = Field(..., min_length=1)
|
||||
|
||||
|
||||
class JobBase(BaseModel):
|
||||
name: str = Field(..., min_length=1, max_length=64)
|
||||
type: Literal["mysql", "directory"]
|
||||
type: Literal["mysql", "directory", "influxdb"]
|
||||
source_config: dict
|
||||
storage_id: int
|
||||
cron_expression: Optional[str] = Field(None, description="标准 5 段 cron 表达式,空表示手动")
|
||||
@@ -73,6 +92,11 @@ class JobOut(BaseModel):
|
||||
storage: StorageOut
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
# 解密后的数据源配置;敏感字段已脱敏为 "***"
|
||||
source_config_safe: dict = Field(
|
||||
default_factory=dict,
|
||||
description="解密后的 source_config,敏感字段(password/token/secret_key)已脱敏",
|
||||
)
|
||||
|
||||
|
||||
class RunSummary(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user