#!/bin/bash set -e echo "==========================================" echo "LANDVEX / QUIXZOOM — COMPLETE DEPLOYMENT" echo "==========================================" # 1. Deploy PostgreSQL echo "" echo "[1/5] Deploying PostgreSQL..." if command -v psql &> /dev/null; then echo "PostgreSQL already installed" else ./scripts/deploy_postgres.sh fi # 2. Generate SSL echo "" echo "[2/5] Generating SSL certificates..." if [ ! -f "ssl/server.crt" ]; then ./scripts/generate_ssl.sh fi # 3. Fix API endpoints echo "" echo "[3/5] Fixing API endpoints..." ./scripts/fix_apis.sh # 4. Start services echo "" echo "[4/5] Starting services..." # Start API echo "Starting IOM API..." cd /home/bernt/.openclaw/workspace/iom python3 -m uvicorn api.main:app --host 0.0.0.0 --port 8000 --ssl-keyfile ssl/server.key --ssl-certfile ssl/server.crt & API_PID=$! echo "API started (PID: $API_PID)" # Start nginx echo "Starting nginx..." sudo -n systemctl start nginx # 5. Health checks echo "" echo "[5/5] Running health checks..." sleep 5 echo "Checking API..." if curl -s -k https://localhost:8000/health | grep -q "healthy"; then echo "✓ API is healthy" else echo "✗ API health check failed" fi echo "Checking nginx..." if curl -s -k https://localhost/health | grep -q "healthy"; then echo "✓ Nginx is healthy" else echo "✗ Nginx health check failed" fi echo "" echo "==========================================" echo "DEPLOYMENT COMPLETE" echo "==========================================" echo "" echo "API: https://api.quixzoom.com" echo "API: https://api.landvex.com" echo "Health: https://localhost:8000/health" echo "" echo "Services:" echo " - PostgreSQL: localhost:5432" echo " - Redis: localhost:6379" echo " - API: localhost:8000" echo " - Nginx: localhost:443" echo "" echo "SSL: Self-signed (valid 365 days)" echo "For production: Use Let's Encrypt" echo "" echo "Next steps:" echo "1. Test API endpoints" echo "2. Deploy staging environment" echo "3. Start collecting real data" echo "4. Train AI models"