fix: correct service paths, nohup removal, MongoDB graceful fallback, add MariaDB + Caddy to startup
- Fix Qdrant binary path (services/ -> momentry_resources/bin/) - Fix LLM binary/model paths (llama/ -> momentry_resources/llama/, models/ -> models/llm/) - Fix PostgreSQL data path (pgsql/data -> momentry/var/postgresql) - Remove nohup (fails in LaunchDaemon environment) - Add MongoDB graceful fallback with 5s timeout in server.rs - Add MariaDB + Caddy steps to startup script for WordPress - Revert all unrelated changes
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use axum::Router;
|
||||
use tokio::time::timeout;
|
||||
use tower_http::cors::{Any, CorsLayer};
|
||||
|
||||
use crate::core::cache::{MongoCache, RedisCache};
|
||||
@@ -30,7 +33,21 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
|
||||
health::init_server_state(host, port);
|
||||
|
||||
let embedder = std::sync::Arc::new(Embedder::new("nomic-embed-text-v2-moe:latest".to_string()));
|
||||
let mongo_cache = MongoCache::init().await?;
|
||||
|
||||
// MongoDB is ONLY a cache layer — if unavailable, the server continues
|
||||
// with Redis cache alone. This keeps both 3002 and 3003 bootable
|
||||
// without requiring MongoDB to be installed or running.
|
||||
let mongo_cache = match timeout(Duration::from_secs(5), MongoCache::init()).await {
|
||||
Ok(Ok(cache)) => cache,
|
||||
Ok(Err(e)) => {
|
||||
tracing::warn!("MongoDB cache unavailable (continuing without): {e}");
|
||||
MongoCache::disabled().await
|
||||
}
|
||||
Err(_) => {
|
||||
tracing::warn!("MongoDB init timed out (continuing without cache)");
|
||||
MongoCache::disabled().await
|
||||
}
|
||||
};
|
||||
let redis_cache = RedisCache::new()?;
|
||||
let db = PostgresDb::init().await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user