fix: MCP proxy resilience — discovery cache, default liveness probes
Some checks failed
Some checks failed
Adds a per-server tools/list cache in McpRouter (positive + negative TTL) so a slow or dead upstream only stalls the first discovery call, not every subsequent client request. Invalidated on upstream add/remove. Health probes now apply a default liveness spec (tools/list via the real production path) to any RUNNING instance without an explicit healthCheck, so synthetic and real failures converge on the same signal. Includes supporting updates in mcpd-client, discovery, upstream/mcpd, seeder, and fulldeploy/release scripts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Full deployment: Docker image → Portainer stack → RPM build/publish/install
|
||||
# Full deployment: mcpd image → k8s rollout → RPM build/publish/install
|
||||
#
|
||||
# Production runtime is Kubernetes (context: worker0-k8s0, namespace: mcpctl).
|
||||
# The docker-compose stack under stack/ + deploy/ is kept for local/VM testing
|
||||
# only and is no longer invoked from here.
|
||||
#
|
||||
# Infra (Deployment shape, env, RBAC, NetworkPolicies) is managed by Pulumi
|
||||
# in ../kubernetes-deployment. This script runs `pulumi preview` before the
|
||||
# rollout; if there is infra drift it halts so you can `pulumi up` first.
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -10,19 +18,50 @@ if [ -f .env ]; then
|
||||
set -a; source .env; set +a
|
||||
fi
|
||||
|
||||
KUBE_CONTEXT="${KUBE_CONTEXT:-worker0-k8s0}"
|
||||
KUBE_NAMESPACE="${KUBE_NAMESPACE:-mcpctl}"
|
||||
KUBE_DEPLOYMENT="${KUBE_DEPLOYMENT:-mcpd}"
|
||||
PULUMI_DIR="${PULUMI_DIR:-$SCRIPT_DIR/../kubernetes-deployment}"
|
||||
PULUMI_STACK="${PULUMI_STACK:-homelab}"
|
||||
|
||||
echo "========================================"
|
||||
echo " mcpctl Full Deploy"
|
||||
echo "========================================"
|
||||
|
||||
# --- Pre-flight: Pulumi drift check ---
|
||||
echo ""
|
||||
echo ">>> Pre-flight: checking for Pulumi infra drift"
|
||||
echo ""
|
||||
if [ -d "$PULUMI_DIR" ]; then
|
||||
if [ -z "$PULUMI_CONFIG_PASSPHRASE" ]; then
|
||||
echo " WARNING: PULUMI_CONFIG_PASSPHRASE not set — skipping drift check."
|
||||
echo " Set it in .env or export it to enable."
|
||||
else
|
||||
preview_output=$(cd "$PULUMI_DIR" && pulumi preview --stack "$PULUMI_STACK" --non-interactive --diff 2>&1) || true
|
||||
if echo "$preview_output" | grep -qE '^\s+[-+~]'; then
|
||||
echo "$preview_output"
|
||||
echo ""
|
||||
echo "ERROR: Pulumi detected infra changes that have not been applied."
|
||||
echo " Run: cd $PULUMI_DIR && pulumi up -s $PULUMI_STACK"
|
||||
echo " Then re-run this script."
|
||||
exit 1
|
||||
fi
|
||||
echo " No drift — infra is in sync."
|
||||
fi # passphrase check
|
||||
else
|
||||
echo " WARNING: Pulumi repo not found at $PULUMI_DIR — skipping drift check."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo ">>> Step 1/3: Build & push mcpd Docker image"
|
||||
echo ""
|
||||
bash scripts/build-mcpd.sh "$@"
|
||||
|
||||
echo ""
|
||||
echo ">>> Step 2/3: Deploy stack to production"
|
||||
echo ">>> Step 2/3: Roll out mcpd on k8s ($KUBE_CONTEXT / $KUBE_NAMESPACE)"
|
||||
echo ""
|
||||
bash deploy.sh
|
||||
kubectl --context "$KUBE_CONTEXT" -n "$KUBE_NAMESPACE" rollout restart "deployment/$KUBE_DEPLOYMENT"
|
||||
kubectl --context "$KUBE_CONTEXT" -n "$KUBE_NAMESPACE" rollout status "deployment/$KUBE_DEPLOYMENT" --timeout=3m
|
||||
|
||||
echo ""
|
||||
echo ">>> Step 3/3: Build, publish & install RPM"
|
||||
|
||||
Reference in New Issue
Block a user