hm_ai_qc_report_tool/deploy/deploy.sh
nickviljoen f21e41afc3 v1.2.0: Add Docker deployment, simplify auth to local login, production config
- Add Dockerfile, docker-compose.yml, .dockerignore for containerised deployment
- Add deploy/ scripts (deploy.sh, nginx/apache configs, password generator)
- Replace MSAL/Azure AD auth with local username/password authentication
- Add login.html template
- Simplify app.py, middleware, and auth routes for production use
- Update gunicorn_config.py and wsgi.py for Docker/production
- Update templates to work with new auth and URL prefix handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:37:53 +02:00

52 lines
1.4 KiB
Bash
Executable file

#!/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"