Files
breakpilot-compliance/scripts/apply_vvt_migration.sh
Sharang Parnerkar 8ec8af4c2d
Some checks failed
Build + Deploy / build-admin-compliance (push) Failing after 45s
Build + Deploy / build-backend-compliance (push) Successful in 13s
Build + Deploy / build-ai-sdk (push) Successful in 40s
Build + Deploy / build-developer-portal (push) Successful in 12s
Build + Deploy / build-tts (push) Successful in 11s
Build + Deploy / build-document-crawler (push) Successful in 14s
Build + Deploy / build-dsms-gateway (push) Successful in 12s
Build + Deploy / trigger-orca (push) Has been skipped
CI/CD / loc-budget (push) Successful in 21s
CI/CD / guardrail-integrity (push) Has been skipped
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 48s
CI/CD / test-python-backend-compliance (push) Failing after 38s
CI/CD / test-python-document-crawler (push) Successful in 31s
CI/CD / test-python-dsms-gateway (push) Successful in 27s
CI/CD / sbom-scan (push) Has been skipped
CI/CD / validate-canonical-controls (push) Successful in 19s
chore: remove all gitea remote references; single origin push only
There is only one remote (origin). Removed all occurrences of:
  - git push gitea / git push origin main && git push gitea main
  - "Pushing to gitea (external)" in deploy.sh
  - # gitea: git@gitea.meghsakha.com:... remote comment in docs-src/index.md
  - "Push auf gitea triggert" → "Push auf origin triggert" in docs
  - Clone URL updated to ssh://git@coolify.meghsakha.com:22222/... in
    README.md and CONTRIBUTING.md

Web UI URLs (gitea.meghsakha.com/...) are unchanged — those are still valid.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 16:16:12 +02:00

56 lines
1.7 KiB
Bash

#!/bin/bash
# Apply VVT migration and rebuild backend-compliance on Mac Mini
# Usage: bash scripts/apply_vvt_migration.sh
set -e
DOCKER="/usr/local/bin/docker"
BACKEND_CONTAINER="bp-compliance-backend"
PROJECT_DIR="/Users/benjaminadmin/Projekte/breakpilot-compliance"
echo "==> Pushing code to Mac Mini..."
git push origin main
echo "==> Pulling code on Mac Mini..."
ssh macmini "cd ${PROJECT_DIR} && git pull --no-rebase origin main"
echo "==> Applying VVT migration (006_vvt.sql)..."
ssh macmini "cd ${PROJECT_DIR} && \
${DOCKER} exec ${BACKEND_CONTAINER} \
python3 -c \"
import psycopg2
import os
conn = psycopg2.connect(os.environ['DATABASE_URL'])
conn.autocommit = True
cur = conn.cursor()
with open('/app/migrations/006_vvt.sql', 'r') as f:
sql = f.read()
cur.execute(sql)
cur.close()
conn.close()
print('VVT migration applied successfully')
\"" || echo "Note: Migration may use different DB connection method. Trying psql..."
ssh macmini "cd ${PROJECT_DIR} && \
${DOCKER} exec ${BACKEND_CONTAINER} \
psql \"\${DATABASE_URL}\" -f /app/migrations/006_vvt.sql \
&& echo 'VVT migration (psql) applied' \
|| echo 'Could not apply via psql, check manually'"
echo ""
echo "==> Rebuilding backend-compliance..."
ssh macmini "cd ${PROJECT_DIR} && \
${DOCKER} compose build --no-cache backend-compliance && \
${DOCKER} compose up -d backend-compliance"
echo ""
echo "==> Verifying VVT endpoint..."
sleep 5
curl -sf "https://macmini:8002/api/compliance/vvt/stats" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(f'VVT stats: total={d.get(\"total\",0)}')" \
|| echo "VVT endpoint check: needs backend restart"
echo ""
echo "Done. Check logs: ssh macmini '${DOCKER} logs -f ${BACKEND_CONTAINER}'"