#!/bin/bash set -e HOST="aissa@10.4.7.18" PASS='Foodlinkk#2026' BASE="/tmp/foodlinkk-deploy" REMOTE="~/foodlinkk-command-center" echo "=== Deploying 360 upgrade to VM 106 ===" # Tools API sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/tools-api/app/retail_360.py" \ "$BASE/tools-api/app/retail_360_routes.py" \ "$BASE/tools-api/app/wholesaler_scrapers.py" \ "$BASE/tools-api/app/connectors/rss_feeds.py" \ "$HOST:$REMOTE/tools-api/app/" sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/tools-api/app/connectors/rss_feeds.py" \ "$HOST:$REMOTE/tools-api/app/connectors/" # Migration sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/migrations/011_retail_360.sql" \ "$HOST:$REMOTE/migrations/" # Cockpit sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/cockpit/templates/retail.html" \ "$BASE/cockpit/templates/marketing.html" \ "$HOST:$REMOTE/cockpit/templates/" sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/cockpit/static/retail.css" \ "$HOST:$REMOTE/cockpit/static/" sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/cockpit/static/css/pulse-theme.css" \ "$HOST:$REMOTE/cockpit/static/css/" sshpass -p "$PASS" scp -o StrictHostKeyChecking=no \ "$BASE/cockpit/app/routes/retail.py" \ "$HOST:$REMOTE/cockpit/app/routes/" echo "=== Patching main.py and base.html ===" sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no "$HOST" bash <<'REMOTE' set -e cd ~/foodlinkk-command-center # Add retail_360 router to tools-api main.py if ! grep -q retail_360_routes ~/foodlinkk-command-center/tools-api/app/main.py; then sed -i '/from app.retail import router as retail_router/a from app.retail_360_routes import router as retail_360_router' tools-api/app/main.py sed -i '/app.include_router(retail_router)/a app.include_router(retail_360_router)' tools-api/app/main.py fi # Add pulse-theme.css to base.html if ! grep -q pulse-theme.css ~/foodlinkk-command-center/cockpit/templates/base.html; then sed -i 's|palantir-theme.css|palantir-theme.css" />\n /tmp/wholesale-import.log 2>&1 & echo "Started wholesaler import in background" echo "=== City demographics sync ===" curl -sf -X POST "http://localhost:8700/retail/cities/sync?limit=30" | head -c 200 echo "" echo "=== DONE ===" REMOTE echo "=== Notify team ===" sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no aissa@10.4.7.19 \ 'python3 ~/foodlinkk-ai/hermes/notify.py --team "Retail 360 upgrade live: pulse UI, notes/media/milestones/ownership, RSS feeds, groothandels, stad demografie, marketing hub uitgebreid. Bekijk http://10.4.7.18:8600/retail"'