#!/usr/bin/env bash set -euo pipefail APP_DIR="${APP_DIR:-/opt/hm-qc-app}" REPO_URL="${REPO_URL:-git@bitbucket.org:zlalani/hm_ai_qc_report_tool.git}" echo "=== HM QC Report Tool — Deploy ===" # Clone or pull if [ -d "$APP_DIR/.git" ]; then echo "Pulling latest changes..." cd "$APP_DIR" git pull else echo "Cloning repository..." git clone "$REPO_URL" "$APP_DIR" cd "$APP_DIR" fi # Check for required files if [ ! -f "$APP_DIR/.env" ]; then echo "" echo "WARNING: .env file not found at $APP_DIR/.env" echo " Copy .env.example and fill in production values:" echo " cp .env.example .env" echo " # Generate AUTH_USERS with: python deploy/generate_password.py" echo "" fi if [ ! -f "$APP_DIR/config/box_config.json" ]; then echo "" echo "WARNING: Box config not found at $APP_DIR/config/box_config.json" echo " Place the Box API credentials file before starting." echo "" fi # Build and start echo "Building and starting containers..." docker compose build docker compose up -d echo "" echo "=== Deploy complete ===" echo "Container status:" docker compose ps echo "" echo "View logs: docker compose logs -f" echo "" echo "Next steps:" echo " 1. Add the location block from deploy/nginx-location.conf (or apache-location.conf)" echo " 2. Reload the web server (nginx -s reload or systemctl reload apache2)" echo " 3. Test: https://ai-sandbox.oliver.solutions/hm-ai-qc-report"