Files
proxmox/scripts/mim4u-deploy-to-7810.sh
defiQUG 7ac74f432b chore: sync docs, config schemas, scripts, and meta task alignment
- Institutional / JVMTM / reserve-provenance / GRU transport + standards JSON
- Validation and verify scripts (Blockscout labels, x402, GRU preflight, P1 local path)
- Wormhole wiring in AGENTS, MCP_SETUP, MASTER_INDEX, 04-configuration README
- Meta docs, integration gaps, live verification log, architecture updates
- CI validate-config workflow updates

Operator/LAN items, submodule working trees, and public token-aggregation edge
routes remain follow-up (see TODOS_CONSOLIDATED P1).

Made-with: Cursor
2026-03-31 22:31:39 -07:00

60 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build MIM4U frontend and deploy to VMID 7810 /var/www/html.
# Run from project root. Requires: npm in miracles_in_motion, ssh to Proxmox node, rsync or scp.
#
# Usage: ./scripts/mim4u-deploy-to-7810.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
MIM_ROOT="${PROJECT_ROOT}/miracles_in_motion"
[[ -f "$PROJECT_ROOT/config/ip-addresses.conf" ]] && source "$PROJECT_ROOT/config/ip-addresses.conf" 2>/dev/null || true
VMID_MIM_WEB="${VMID_MIM_WEB:-7810}"
PROXMOX_HOST="${PROXMOX_HOST_R630_02:-192.168.11.12}"
MIM_WEB_IP="${IP_MIM_WEB:-192.168.11.37}"
DEST="/var/www/html"
MIM_API_UPSTREAM="${MIM_API_UPSTREAM:-http://192.168.11.36:3001}"
echo "Building MIM4U frontend..."
(cd "$MIM_ROOT" && npm run build)
echo "Deploying dist to root@$PROXMOX_HOST (pct exec $VMID_MIM_WEB) at $DEST ..."
# Copy into container: tar from host, extract in container
tar czf - -C "$MIM_ROOT/dist" . | ssh "root@$PROXMOX_HOST" "pct exec $VMID_MIM_WEB -- tar xzf - -C $DEST"
echo "Ensuring nginx proxies /api/ to $MIM_API_UPSTREAM ..."
ssh "root@$PROXMOX_HOST" "pct exec $VMID_MIM_WEB -- bash -lc 'cat > /etc/nginx/sites-available/mim4u <<\"EOF\"
server {
listen 80;
server_name mim4u.org www.mim4u.org secure.mim4u.org training.mim4u.org;
root /var/www/html;
index index.html index.htm;
location /api/ {
proxy_pass ${MIM_API_UPSTREAM}/api/;
proxy_http_version 1.1;
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;
}
location / {
try_files \$uri \$uri/ /index.html;
}
location /health {
access_log off;
return 200 \"healthy\\n\";
add_header Content-Type text/plain;
}
location ~* \\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control \"public, immutable\";
}
}
EOF
nginx -t && systemctl reload nginx'"
echo "Done. Verify: curl -I http://${MIM_WEB_IP}:80/"