Files
rustytorch/crates/production/rtx-serving-api/src/main.rs
T
osobhandClaude Opus 4.6 5fe8c67b04 Fix rtx-serving-api binary: create main.rs entry point
The binary path pointed to non-existent src/bin/server.rs.
Created proper src/main.rs with tokio async entry point that:
- Initializes tracing
- Loads config from RTX_HOST/RTX_PORT/RTX_TIMEOUT env vars
- Instantiates ServingServer and calls serve()

Fixed Cargo.toml: path = "src/bin/server.rs" → path = "src/main.rs"

Validated: binary builds, starts, health endpoint returns healthy,
inference endpoint returns mock completions.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-12 20:16:38 -07:00

44 lines
1.5 KiB
Rust

//! RustyTorch++ Serving API — entry point
//!
//! Starts the HTTP serving API with model inference, health checks,
//! and cache management endpoints.
//!
//! Usage:
//! cargo run -p rtx-serving-api
//! cargo run -p rtx-serving-api -- --port 8080 --host 0.0.0.0
use rtx_serving_api::{ServerConfig, ServingServer};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize tracing
tracing_subscriber::fmt().init();
// Load config from environment
let host = std::env::var("RTX_HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
let port: u16 = std::env::var("RTX_PORT")
.ok()
.and_then(|p| p.parse().ok())
.unwrap_or(8080);
let timeout: u64 = std::env::var("RTX_TIMEOUT")
.ok()
.and_then(|t| t.parse().ok())
.unwrap_or(30);
let config = ServerConfig {
host,
port,
timeout_seconds: timeout,
};
tracing::info!("╔════════════════════════════════════════════╗");
tracing::info!("║ RustyTorch++ Serving API ║");
tracing::info!("║ Port: {} ║", config.port);
tracing::info!("╚════════════════════════════════════════════╝");
let server = ServingServer::new(config);
server.serve().await.map_err(|e| anyhow::anyhow!("{}", e))?;
Ok(())
}