pimco-charts/deploy.sh
Vadym Samoilenko af2a020696 Add Azure AD SSO (MSAL/PKCE) and Docker deployment
- Azure AD authentication via MSAL PublicClientApplication with PKCE flow
- Session middleware, auth middleware, login/callback/logout routes
- Dockerfile, docker-compose.yml for port 8569, output volume
- Idempotent deploy.sh with static file copy and health wait
- User nav bar in base template with Sign Out link

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 14:56:07 +00:00

45 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
WEB_STATIC="/var/www/html/Pimco-charts/static"
cd "$REPO_DIR"
# 1. Pull latest code
git pull origin main
# 2. Build Docker image (uses cache)
docker compose build
# 3. Start/restart container
docker compose up -d --remove-orphans
# 4. Prune dangling images
docker image prune -f
# 5. Copy static files to web directory
mkdir -p "$WEB_STATIC"
rm -rf "$WEB_STATIC"/*
cp -r "$REPO_DIR/app/static/." "$WEB_STATIC/"
# 6. Wait for health
echo "Waiting for container to become healthy..."
for i in $(seq 1 12); do
STATUS=$(docker inspect --format='{{.State.Health.Status}}' pimco-charts 2>/dev/null || echo "starting")
[ "$STATUS" = "healthy" ] && echo "Healthy." && break
echo " [$i/12] status=$STATUS, waiting 5s..."
sleep 5
done
echo "=== Deploy complete. App running on 127.0.0.1:8569 ==="
echo "Configure Apache to proxy /Pimco-charts/ -> http://127.0.0.1:8569/"
echo "Static files served from: $WEB_STATIC"
echo ""
echo "Apache config snippet:"
echo " ProxyPass /Pimco-charts/static/ !"
echo " ProxyPass /Pimco-charts/ http://127.0.0.1:8569/"
echo " ProxyPassReverse /Pimco-charts/ http://127.0.0.1:8569/"
echo " Alias /Pimco-charts/static/ $WEB_STATIC/"
echo " <Directory $WEB_STATIC/>"
echo " Require all granted"
echo " </Directory>"