Deployment Guide
WebMCP Auto-UI deployment relies on a centralized script (scripts/deploy.sh) that manages all seven monorepo apps with their specific paths and configurations. This guide covers the complete procedure, from local build to production verification.
Golden Rule
Section titled “Golden Rule”Target Infrastructure
Section titled “Target Infrastructure”graph LR DEV[Local machine<br/>build + deploy.sh] -->|SSH + SCP| SERVER[demo.hyperskills.net]
subgraph SERVER["Production server"] NGINX[nginx<br/>:80/:443] -->|proxy| FLEX[flex :3007] NGINX -->|proxy| VIEWER[viewer :3008] NGINX -->|proxy| RECIPES[recipes :3009] NGINX -->|proxy| SHOWCASE[showcase :3010] NGINX -->|proxy| BOILER[boilerplate :3011] NGINX -->|static| HOME[home/] NGINX -->|static| TODO[todo/] end| Element | Value |
|---|---|
| Server | demo.hyperskills.net (via SSH alias ssh bot) |
| Base path | /opt/webmcp-demos/ |
| Node.js apps | flex (:3007), viewer, recipes, showcase, boilerplate |
| Static apps | home, todo (served by nginx) |
| Reverse proxy | nginx on ports 80/443 |
Applications and Deployment Paths
Section titled “Applications and Deployment Paths”Each app has a specific deployment path. The deploy.sh script knows these paths and handles them automatically.
| App | Type | Build dir (local) | Deploy dest (server) | ExecStart | Notes |
|---|---|---|---|---|---|
| flex | Node.js (SvelteKit) | apps/flex/build/ | /opt/webmcp-demos/flex/ | node index.js | Main composer |
| viewer | Node.js (SvelteKit) | apps/viewer/build/ | /opt/webmcp-demos/viewer/ | node index.js | HyperSkills viewer |
| showcase | Node.js (SvelteKit) | apps/showcase/build/ | /opt/webmcp-demos/showcase/ | node index.js | Widget gallery |
| recipes | Node.js (SvelteKit) | apps/recipes/build/ | /opt/webmcp-demos/recipes/ | node index.js | Recipe explorer |
| boilerplate | Node.js (SvelteKit) | apps/boilerplate/build/ | /opt/webmcp-demos/boilerplate/ | node index.js | Starter template |
| home | Static (SvelteKit) | apps/home/build/ | /opt/webmcp-demos/home/ | N/A (nginx) | Homepage |
| todo | Static (SvelteKit) | apps/todo/build/ | /opt/webmcp-demos/todo/ | N/A (nginx) | Todo demo |
Deployment Procedure
Section titled “Deployment Procedure”Step 1: Deploy via the Script
Section titled “Step 1: Deploy via the Script”The script handles everything: package builds, app builds, cleanup, transfer, integrity verification, and service restart.
# Deploy all apps./scripts/deploy.sh
# Deploy a specific app./scripts/deploy.sh flex
# Deploy multiple apps./scripts/deploy.sh flex viewer home
# Preview what would be deployed without making changes./scripts/deploy.sh --dry-run
# Deploy with documentation update./scripts/deploy.sh --with-docsStep 2: Verify on Server
Section titled “Step 2: Verify on Server”ssh bot
# Check Node.js servicessystemctl status webmcp-flexsystemctl status webmcp-viewer
# Check static appscurl -s -o /dev/null -w "%{http_code}" http://localhost/home/
# Check nginxsudo systemctl status nginxWhat the Script Does
Section titled “What the Script Does”The deploy.sh script executes these steps in order:
flowchart TD A[Sync versions<br/>across all workspaces] --> B[Build packages<br/>core → sdk → ui → agent] B --> C{Apps to deploy?} C -->|Each app| D[Back up app<br/>on server] D --> E[Build app<br/>npm run build] E --> F[Clean old files<br/>on server] F --> G[Copy build<br/>via SCP] G --> H{SHA-256<br/>check?} H -->|Mismatch| I[Automatic rollback<br/>from backup] H -->|OK| J[Restart service<br/>systemd] J --> K[Final verification<br/>systemctl is-active]Integrity Verification (SHA-256)
Section titled “Integrity Verification (SHA-256)”After each transfer, the script compares the SHA-256 hash of the local file with the deployed file:
expected=$(sha256sum apps/flex/build/index.js | cut -d' ' -f1)actual=$(ssh bot "sha256sum /opt/webmcp-demos/flex/index.js | cut -d' ' -f1")
if [ "$expected" != "$actual" ]; then echo "INTEGRITY ERROR — sha256 mismatch, rolling back" rollback_app "flex"fiThis check catches incomplete transfers, read-only files, and stale builds.
Backup and Rollback
Section titled “Backup and Rollback”Before each deployment, a full copy of the existing app is stored in /opt/webmcp-demos/.backups/. On failure, the script automatically restores the previous version.
# Manual rollback if neededssh botcp -a /opt/webmcp-demos/.backups/flex.prev /opt/webmcp-demos/flexsystemctl restart webmcp-flexEnvironment Variables
Section titled “Environment Variables”On the Server (Production)
Section titled “On the Server (Production)”.env files must exist before the first deployment. They are created manually once and never deployed by the script.
Build-Time Variables (home)
Section titled “Build-Time Variables (home)”The home app requires PUBLIC_BASE_URL at build time, not runtime:
# deploy.sh handles this automatically for static apps (home, todo)PUBLIC_BASE_URL=https://demos.hyperskills.net npm run buildIf you build manually (outside the script), remember this variable, otherwise internal links will point to localhost.
nginx Configuration
Section titled “nginx Configuration”nginx serves as reverse proxy for Node.js apps and static file server for the rest:
# Node.js apps → proxy to local portlocation /flex/ { proxy_pass http://localhost:3007/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade';}
# Static apps → serve from disklocation /home/ { alias /opt/webmcp-demos/home/; try_files $uri $uri/index.html =404;}
# Default page = homelocation / { alias /opt/webmcp-demos/home/; try_files $uri $uri/index.html =404;}Production Monitoring
Section titled “Production Monitoring”ssh bot
# Follow logs in real timejournalctl -u webmcp-flex -f
# View the last 50 log entriesjournalctl -u webmcp-flex -n 50 --no-pagerHealth Checks
Section titled “Health Checks”# Test all appsfor app in home flex viewer showcase recipes; do code=$(curl -s -o /dev/null -w "%{http_code}" "https://demos.hyperskills.net/$app/") echo "$app: HTTP $code"doneSystem Resources
Section titled “System Resources”ssh botdf -h # Disk spacefree -h # MemoryTroubleshooting
Section titled “Troubleshooting”App Shows Stale Code After Deploy
Section titled “App Shows Stale Code After Deploy”Likely cause: orphaned JavaScript chunks. If you deployed manually (without the script), old .js files remain and the browser serves them from cache.
Solution:
ssh bot# Clean old filesrm -rf /opt/webmcp-demos/flex/client /opt/webmcp-demos/flex/server# Redeploy properly./scripts/deploy.sh flex.env Missing After Deploy
Section titled “.env Missing After Deploy”Cause: .env files are not part of the deploy and must never be.
Solution: recreate the file manually on the server, then restart the service.
nginx Returns 404
Section titled “nginx Returns 404”Diagnosis:
ssh bot
# Verify files existls -la /opt/webmcp-demos/home/index.html
# Test nginx configsudo nginx -t
# Check paths in configgrep -A 5 "location /home/" /etc/nginx/sites-available/default
# Reload after fixsudo systemctl reload nginxAPI Rate-Limited (LLM Provider)
Section titled “API Rate-Limited (LLM Provider)”Symptom: 429 errors in flex logs.
Solutions:
- Wait (the client handles exponential backoff automatically)
- Reduce
maxIterationsin agent configuration - Verify the API key is not shared across multiple deployments
Service Does Not Start
Section titled “Service Does Not Start”ssh bot
# View detailed errorjournalctl -u webmcp-flex -n 30 --no-pager
# Common causes:# - Port already in use → lsof -i :3007# - Missing .env → ls -la /opt/webmcp-demos/flex/.env# - Missing npm deps → cd /opt/webmcp-demos/flex && npm install --productionRoutine Maintenance
Section titled “Routine Maintenance”Restart All Services
Section titled “Restart All Services”ssh botsudo systemctl restart webmcp-flex webmcp-viewer webmcp-recipes webmcp-showcase nginxClean Old Logs
Section titled “Clean Old Logs”ssh botjournalctl --vacuum-time=7d # Keep 7 daysUpdate Dependencies
Section titled “Update Dependencies”# Locallynpm updatenpm run build./scripts/deploy.shDeployment Checklist
Section titled “Deployment Checklist”Before each deployment, verify:
- Local build succeeds (
npm run buildwithout errors) - Tests pass (
npm run test) - Code is committed and pushed
- Using
./scripts/deploy.sh(neverscporrsync) - After deploy: check logs (
journalctl -u webmcp-flex -n 20) - After deploy: test in browser
- If deploying
home: verifyPUBLIC_BASE_URLis correct
Emergency Rollback
Section titled “Emergency Rollback”If a deployment breaks something and the automatic rollback did not work:
# Option 1: Restore from backupssh botcp -a /opt/webmcp-demos/.backups/flex.prev /opt/webmcp-demos/flexsystemctl restart webmcp-flex
# Option 2: Redeploy an earlier versiongit checkout <previous_commit>./scripts/deploy.sh flex