feat: add deployment artifacts and health endpoints

This commit is contained in:
a.tolmachev
2026-03-25 13:30:55 +03:00
parent e9f17841e4
commit 4d2b566de2
17 changed files with 815 additions and 8 deletions
+3 -1
View File
@@ -6,6 +6,8 @@ rust-version.workspace = true
version.workspace = true
[dependencies]
axum.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
+25
View File
@@ -0,0 +1,25 @@
FROM rust:1.85-bookworm AS builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY apps ./apps
COPY crates ./crates
RUN cargo build --release -p admin-api
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/admin-api /usr/local/bin/admin-api
ENV MCPAAS_ADMIN_BIND=0.0.0.0:3001
EXPOSE 3001
CMD ["admin-api"]
+34 -1
View File
@@ -1 +1,34 @@
fn main() {}
use std::{env, net::SocketAddr};
use axum::{Json, Router, routing::get};
use serde_json::json;
use tokio::net::TcpListener;
use tracing::info;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(
env::var("MCPAAS_LOG_LEVEL")
.unwrap_or_else(|_| "admin_api=info,tower_http=info".into()),
)
.init();
let bind_addr = env::var("MCPAAS_ADMIN_BIND").unwrap_or_else(|_| "0.0.0.0:3001".into());
let socket_addr: SocketAddr = bind_addr.parse()?;
let app = Router::new().route("/health", get(health));
let listener = TcpListener::bind(socket_addr).await?;
info!("admin-api listening on {}", socket_addr);
axum::serve(listener, app).await?;
Ok(())
}
async fn health() -> Json<serde_json::Value> {
Json(json!({
"service": "admin-api",
"status": "ok"
}))
}
+3 -1
View File
@@ -6,6 +6,8 @@ rust-version.workspace = true
version.workspace = true
[dependencies]
axum.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
+25
View File
@@ -0,0 +1,25 @@
FROM rust:1.85-bookworm AS builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY apps ./apps
COPY crates ./crates
RUN cargo build --release -p mcp-server
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/mcp-server /usr/local/bin/mcp-server
ENV MCPAAS_MCP_BIND=0.0.0.0:3002
EXPOSE 3002
CMD ["mcp-server"]
+34 -1
View File
@@ -1 +1,34 @@
fn main() {}
use std::{env, net::SocketAddr};
use axum::{Json, Router, routing::get};
use serde_json::json;
use tokio::net::TcpListener;
use tracing::info;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(
env::var("MCPAAS_LOG_LEVEL")
.unwrap_or_else(|_| "mcp_server=info,tower_http=info".into()),
)
.init();
let bind_addr = env::var("MCPAAS_MCP_BIND").unwrap_or_else(|_| "0.0.0.0:3002".into());
let socket_addr: SocketAddr = bind_addr.parse()?;
let app = Router::new().route("/health", get(health));
let listener = TcpListener::bind(socket_addr).await?;
info!("mcp-server listening on {}", socket_addr);
axum::serve(listener, app).await?;
Ok(())
}
async fn health() -> Json<serde_json::Value> {
Json(json!({
"service": "mcp-server",
"status": "ok"
}))
}
+6
View File
@@ -0,0 +1,6 @@
FROM nginx:1.27-alpine
COPY apps/ui/index.html /usr/share/nginx/html/index.html
COPY apps/ui/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
-3
View File
@@ -1,3 +0,0 @@
# UI
The UI app is planned as a separate TypeScript project and is intentionally kept outside the Cargo workspace.
+59
View File
@@ -0,0 +1,59 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RMCP UI</title>
<style>
:root {
color-scheme: light;
font-family: "Segoe UI", sans-serif;
background: #f7f7f2;
color: #1e1d1a;
}
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background:
radial-gradient(circle at top left, rgba(180, 196, 161, 0.45), transparent 32%),
radial-gradient(circle at bottom right, rgba(226, 196, 154, 0.45), transparent 38%),
#f7f7f2;
}
main {
width: min(720px, calc(100vw - 48px));
padding: 40px;
border-radius: 24px;
background: rgba(255, 255, 255, 0.84);
box-shadow: 0 24px 80px rgba(35, 34, 29, 0.14);
}
h1 {
margin: 0 0 12px;
font-size: clamp(2rem, 5vw, 3.4rem);
line-height: 1;
}
p {
margin: 0;
font-size: 1.05rem;
line-height: 1.6;
}
code {
padding: 0.2rem 0.4rem;
border-radius: 0.35rem;
background: rgba(31, 30, 27, 0.08);
}
</style>
</head>
<body>
<main>
<h1>RMCP UI</h1>
<p>Deployment placeholder for the administrative console. The production UI container is reachable through <code>/</code>.</p>
</main>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
server {
listen 3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}