Deployed version

This commit is contained in:
qingjie.du
2026-04-01 10:43:30 +09:00
parent ec5eb0a447
commit 388da1df29
14 changed files with 807 additions and 21 deletions

6
deploy/.env.example Normal file
View File

@@ -0,0 +1,6 @@
# MCPletA2A — Environment Variables
# Copy to .env and fill in values: cp .env.example .env
# LLM API Key (choose one)
# ANTHROPIC_API_KEY=sk-ant-...
OPENROUTER_API_KEY=sk-or-...

19
deploy/mcplet-a2a.service Normal file
View File

@@ -0,0 +1,19 @@
[Unit]
Description=MCPletA2A Platform Host
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/MCPletA2A
EnvironmentFile=/home/ubuntu/MCPletA2A/deploy/.env
Environment=REF_IMPL_DIST=/home/ubuntu/MCPletA2A/reference_impl/dist
Environment=MCPLET_CONFIG=/home/ubuntu/MCPletA2A/reference_impl/config/reference.yaml
Environment=MCPLET_AGENT_MODULE=file:///home/ubuntu/MCPletA2A/reference_impl/dist/agents/register.js
Environment=NODE_ENV=production
ExecStart=/bin/bash /home/ubuntu/MCPletA2A/deploy/start-vps.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,58 @@
# MCPletA2A — nginx reverse proxy for a2a-demo.mcplet.ai
# Install: sudo cp deploy/nginx-a2a-demo.conf /etc/nginx/sites-available/a2a-demo.conf
# sudo ln -s /etc/nginx/sites-available/a2a-demo.conf /etc/nginx/sites-enabled/
# sudo nginx -t && sudo systemctl reload nginx
server {
listen 80;
listen [::]:80;
server_name a2a-demo.mcplet.ai;
# Certbot will add HTTPS redirect here
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name a2a-demo.mcplet.ai;
# Certbot will fill these in
# ssl_certificate /etc/letsencrypt/live/a2a-demo.mcplet.ai/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/a2a-demo.mcplet.ai/privkey.pem;
# A2A External Endpoint
location /a2a/ {
proxy_pass http://127.0.0.1:4001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Passkey REST API (proxied, strip prefix)
location /passkey-api/ {
rewrite ^/passkey-api(/.*)$ $1 break;
proxy_pass http://127.0.0.1:8443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Dashboard (default)
location / {
proxy_pass http://127.0.0.1:4000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Security headers
add_header X-Frame-Options DENY always;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
}

36
deploy/start-vps.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# MCPletA2A — VPS startup script (used by systemd)
set -euo pipefail
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
REF_DIR="$BASE_DIR/reference_impl"
PLATFORM_DIR="$BASE_DIR/platform_impl"
export REF_IMPL_DIST="$REF_DIR/dist"
export MCPLET_CONFIG="$REF_DIR/config/reference.yaml"
export MCPLET_AGENT_MODULE="file://$REF_DIR/dist/agents/register.js"
# Start Mock Service in background
node "$REF_DIR/dist/mock-services/server.js" &
MOCK_PID=$!
# Wait until mock service is ready (max 10s)
for i in $(seq 1 20); do
if node -e "
const net = require('net');
const s = net.createConnection(5100, '127.0.0.1');
s.on('connect', () => { s.destroy(); process.exit(0); });
s.on('error', () => { s.destroy(); process.exit(1); });
" 2>/dev/null; then
echo "[vps] Mock Service ready (pid $MOCK_PID)"
break
fi
sleep 0.5
if [ "$i" -eq 20 ]; then
echo "[vps] ERROR: Mock Service did not start" >&2
exit 1
fi
done
# Start Platform Host (foreground — systemd monitors this)
exec node "$PLATFORM_DIR/dist/index.js"