feat(server,dashboard): 引入多工作流数据隔离、安全中间件与前端 ESM 模块化重构
- server: 实现按 workflow_name 的多工作流数据隔离与旧数据库平滑迁移机制 - server: 新增 API Key 认证(auth)、限流中间件(rate_limit)与运维备份接口(admin) - server: 统一 AppError 错误处理体系,重构调度器 scheduler 支持工作流级重置与抢占 - node: 节点 ID 缺失时自动生成随机 UUID,原生支持 `docker compose --scale node=N` 动态扩容 - dashboard: 前端模块化重构(state/api/components),升级 CSS 变量设计系统与 Toast 通知 - docker/docs: 更新 /healthz 健康检查、部署脚本 IP 配置及数据库设计文档
This commit is contained in:
@@ -54,9 +54,13 @@ pub async fn ensure_runtime(
|
||||
write_if_changed(&synspec_exe, SYNSPEC_BIN, true)?;
|
||||
}
|
||||
|
||||
|
||||
// 2. Fetch baseline equation of state partition function tables if missing locally
|
||||
let common_files = &["irwin_bc.dat", "irwin_orig.dat", "tsuji.molec_bc2", "tsuji.molec_orig"];
|
||||
let common_files = &[
|
||||
"irwin_bc.dat",
|
||||
"irwin_orig.dat",
|
||||
"tsuji.molec_bc2",
|
||||
"tsuji.molec_orig",
|
||||
];
|
||||
ensure_specific_data_files(&data_dir, server_url, client, common_files).await?;
|
||||
|
||||
// 3. Check gfVIS99.dat
|
||||
@@ -69,11 +73,15 @@ pub async fn ensure_runtime(
|
||||
fs::write(&linelist, &bytes)?;
|
||||
info!("成功下载并保存主谱线库 gfVIS99.dat");
|
||||
} else {
|
||||
anyhow::bail!("从服务端下载主谱线库 gfVIS99.dat 失败,HTTP 状态码: {}", resp.status());
|
||||
anyhow::bail!(
|
||||
"从服务端下载主谱线库 gfVIS99.dat 失败,HTTP 状态码: {}",
|
||||
resp.status()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let abs_runtime_dir = fs::canonicalize(runtime_dir).unwrap_or_else(|_| runtime_dir.to_path_buf());
|
||||
let abs_runtime_dir =
|
||||
fs::canonicalize(runtime_dir).unwrap_or_else(|_| runtime_dir.to_path_buf());
|
||||
let tlusty_exe = abs_runtime_dir.join("tlusty_static");
|
||||
let synspec_exe = abs_runtime_dir.join("synspec_static");
|
||||
let data_dir = abs_runtime_dir.join("data");
|
||||
@@ -103,17 +111,28 @@ pub async fn ensure_specific_data_files(
|
||||
let local_file = data_dir.join(filename);
|
||||
if !local_file.exists() {
|
||||
let file_url = format!("{}/api/data/file/{}", server_url, filename);
|
||||
info!("本地缺失数据文件 {},开始从服务端拉取: {}", filename, file_url);
|
||||
info!(
|
||||
"本地缺失数据文件 {},开始从服务端拉取: {}",
|
||||
filename, file_url
|
||||
);
|
||||
|
||||
let resp = client.get(&file_url).send().await?;
|
||||
if resp.status().is_success() {
|
||||
let bytes = resp.bytes().await?;
|
||||
let tmp_file = data_dir.join(format!("{}.{}.tmp", filename, uuid::Uuid::new_v4().simple()));
|
||||
let tmp_file = data_dir.join(format!(
|
||||
"{}.{}.tmp",
|
||||
filename,
|
||||
uuid::Uuid::new_v4().simple()
|
||||
));
|
||||
tokio::fs::write(&tmp_file, &bytes).await?;
|
||||
tokio::fs::rename(&tmp_file, &local_file).await?;
|
||||
info!("成功保存数据文件: {}", filename);
|
||||
} else {
|
||||
anyhow::bail!("服务端返回 HTTP {} 错误,数据文件: {}", resp.status(), filename);
|
||||
anyhow::bail!(
|
||||
"服务端返回 HTTP {} 错误,数据文件: {}",
|
||||
resp.status(),
|
||||
filename
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user