-
Notifications
You must be signed in to change notification settings - Fork 125
feat(orion): add Dicfuse warmup, remove isolation-dir, fix event log tailing. #2017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,22 +8,22 @@ | |
| # ============================================================================== | ||
|
|
||
| # Mega 服务地址(本地 mono 服务) | ||
| base_url = "https://git.buck2hub.com" | ||
| lfs_url = "https://git.buck2hub.com" | ||
| base_url = "https://git.gitmega.com" | ||
| lfs_url = "https://git.gitmega.com" | ||
|
|
||
| # Dicfuse 数据存储 | ||
| store_path = "/tmp/megadir/store" | ||
|
|
||
| # Scorpio daemon 主挂载点(orion 不再启动 scorpio daemon,但 scorpiofs 仍需此配置) | ||
| workspace = "/tmp/megadir/mount" | ||
|
|
||
| config_file = "./config.toml" | ||
| # Git 提交信息 | ||
| git_author = "MEGA" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: The added |
||
| git_email = "admin@mega.org" | ||
|
|
||
| # Dicfuse 读取配置 | ||
| dicfuse_readable = "true" | ||
| load_dir_depth = "3" | ||
| load_dir_depth = "5" | ||
| fetch_file_thread = "10" | ||
| dicfuse_import_concurrency = "4" | ||
| dicfuse_dir_sync_ttl_secs = "5" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| //! This module provides a singleton wrapper around `scorpiofs::AntaresManager` | ||
| //! for managing overlay filesystem mounts used during build operations. | ||
|
|
||
| use std::{error::Error, io, path::PathBuf, sync::Arc}; | ||
| use std::{error::Error, io, path::PathBuf, sync::Arc, time::Duration}; | ||
|
|
||
| use scorpiofs::{AntaresConfig, AntaresManager, AntaresPaths}; | ||
| use tokio::sync::OnceCell; | ||
|
|
@@ -120,13 +120,54 @@ pub async fn mount_job(job_id: &str, cl: Option<&str>) -> Result<AntaresConfig, | |
| .map_err(Into::into) | ||
| } | ||
|
|
||
| /// Initialize Antares during Orion startup and eagerly trigger Dicfuse import. | ||
| /// | ||
| /// This keeps the first build request from paying the full Dicfuse cold-start | ||
| /// cost. Readiness waiting runs in the background so Orion can continue booting. | ||
| #[allow(dead_code)] // Called from the bin target (main.rs), not visible to lib check. | ||
| pub(crate) async fn warmup_dicfuse() -> Result<(), DynError> { | ||
| tracing::info!("Initializing Antares Dicfuse during Orion startup"); | ||
| let manager = get_manager().await?; | ||
| let dicfuse = manager.dicfuse(); | ||
|
|
||
| // Idempotent: safe even if the manager already started import internally. | ||
| dicfuse.start_import(); | ||
|
|
||
| tokio::spawn(async move { | ||
| let warmup_timeout_secs: u64 = std::env::var("ORION_DICFUSE_WARMUP_TIMEOUT_SECS") | ||
| .ok() | ||
| .and_then(|v| v.parse().ok()) | ||
| .unwrap_or(1200); | ||
| tracing::info!( | ||
| "Waiting for Antares Dicfuse warmup to finish (timeout: {}s)", | ||
| warmup_timeout_secs | ||
| ); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: 20-minute warmup timeout
Consider:
|
||
| match tokio::time::timeout( | ||
| Duration::from_secs(warmup_timeout_secs), | ||
| dicfuse.store.wait_for_ready(), | ||
| ) | ||
| .await | ||
| { | ||
| Ok(_) => tracing::info!("Antares Dicfuse warmup completed"), | ||
| Err(_) => tracing::warn!( | ||
| "Antares Dicfuse warmup timed out after {}s", | ||
| warmup_timeout_secs | ||
| ), | ||
| } | ||
| }); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| /// Unmount and cleanup a job overlay filesystem. | ||
| /// | ||
| /// # Arguments | ||
| /// * `job_id` - The job identifier to unmount | ||
| /// | ||
| /// # Returns | ||
| /// The `AntaresConfig` of the unmounted job if it existed. | ||
| #[allow(dead_code)] | ||
| pub async fn unmount_job(job_id: &str) -> Result<Option<AntaresConfig>, DynError> { | ||
| tracing::debug!("Unmounting Antares job: job_id={}", job_id); | ||
| get_manager() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security note:
setcap+NoNewPrivileges=falseGranting
CAP_DAC_READ_SEARCHvia file capabilities is a reasonable approach to avoid running as root. However, the systemd unit setsNoNewPrivileges=false, which means the process can gain additional capabilities/privileges post-exec. This is already noted in the service file as "relaxed for FUSE operations", but be aware thatCAP_DAC_READ_SEARCHallows the process to bypass DAC read permissions on any file on the system — not just FUSE mounts.Consider documenting the threat model: what files does orion need to read that it otherwise couldn't, and whether
CAP_DAC_OVERRIDE(already in CapabilityBoundingSet) is a superset that makes this redundant.