Add patient management, deployment scripts, and Docker fixes

This commit is contained in:
2026-01-30 01:51:33 -08:00
parent 745f9f827f
commit d28d2f20c6
33 changed files with 7496 additions and 284 deletions

View File

@@ -0,0 +1,68 @@
# ============================================
# BraceIQMed - Deploy to EC2 Server (Windows)
# Pushes to Gitea and updates server
# ============================================
param(
[string]$Message = "Update deployment"
)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " BraceIQMed - Deploy to Server" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Configuration
$EC2_IP = "3.142.142.30"
$SSH_KEY = "C:\Users\msagh\OneDrive\Documents\GitHub\brace-final-key-2026.pem"
$REMOTE_DIR = "/home/ubuntu/DEPLOYMENTS/DEPLOYMENT_1"
# Change to project directory
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$projectDir = Split-Path -Parent $scriptDir
Set-Location $projectDir
Write-Host "[1/4] Checking for changes..." -ForegroundColor Yellow
$status = git status --porcelain
if ($status) {
Write-Host " Found uncommitted changes" -ForegroundColor Yellow
Write-Host ""
Write-Host "[2/4] Committing changes..." -ForegroundColor Yellow
git add .
git commit -m "$Message"
} else {
Write-Host " No local changes to commit" -ForegroundColor Green
}
Write-Host ""
Write-Host "[3/4] Pushing to Gitea..." -ForegroundColor Yellow
git push gitea main 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host " Note: Push to Gitea failed or not configured" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "[4/4] Updating server..." -ForegroundColor Yellow
# SSH commands to update server
$sshCommands = @"
cd $REMOTE_DIR
echo 'Pulling latest changes...'
git pull origin main 2>/dev/null || echo 'Git pull skipped'
echo 'Rebuilding containers...'
docker compose build
echo 'Restarting containers...'
docker compose up -d
echo 'Checking status...'
sleep 5
docker compose ps
"@
ssh -i $SSH_KEY -o StrictHostKeyChecking=no ubuntu@$EC2_IP $sshCommands
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host " Deployment complete!" -ForegroundColor Green
Write-Host " Server: https://braceiqmed.com" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green

View File

@@ -0,0 +1,62 @@
#!/bin/bash
# ============================================
# BraceIQMed - Deploy to EC2 Server (Linux/Mac)
# Pushes to Gitea and updates server
# ============================================
set -e
# Configuration
EC2_IP="3.142.142.30"
SSH_KEY="$HOME/.ssh/brace-final-key-2026.pem"
REMOTE_DIR="/home/ubuntu/DEPLOYMENTS/DEPLOYMENT_1"
MESSAGE="${1:-Update deployment}"
echo "========================================"
echo " BraceIQMed - Deploy to Server"
echo "========================================"
echo ""
# Change to project directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
echo "[1/4] Checking for changes..."
if [[ -n $(git status --porcelain) ]]; then
echo " Found uncommitted changes"
echo ""
echo "[2/4] Committing changes..."
git add .
git commit -m "$MESSAGE"
else
echo " No local changes to commit"
fi
echo ""
echo "[3/4] Pushing to Gitea..."
git push gitea main 2>&1 || echo " Note: Push to Gitea failed or not configured"
echo ""
echo "[4/4] Updating server..."
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no ubuntu@$EC2_IP << 'EOF'
cd /home/ubuntu/DEPLOYMENTS/DEPLOYMENT_1
echo 'Pulling latest changes...'
git pull origin main 2>/dev/null || echo 'Git pull skipped'
echo 'Rebuilding containers...'
docker compose build
echo 'Restarting containers...'
docker compose up -d
echo 'Checking status...'
sleep 5
docker compose ps
EOF
echo ""
echo "========================================"
echo " Deployment complete!"
echo " Server: https://braceiqmed.com"
echo "========================================"

60
scripts/update-local.ps1 Normal file
View File

@@ -0,0 +1,60 @@
# ============================================
# BraceIQMed - Local Update Script (Windows)
# Rebuilds and restarts Docker containers
# ============================================
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " BraceIQMed - Local Update" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Change to project directory
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$projectDir = Split-Path -Parent $scriptDir
Set-Location $projectDir
Write-Host "[1/3] Building Docker images..." -ForegroundColor Yellow
docker compose build
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "[2/3] Restarting containers..." -ForegroundColor Yellow
docker compose up -d
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to start containers!" -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "[3/3] Waiting for health checks..." -ForegroundColor Yellow
Start-Sleep -Seconds 5
# Check health
$health = docker compose ps --format json | ConvertFrom-Json
$allHealthy = $true
foreach ($container in $health) {
$status = $container.Health
$name = $container.Name
if ($status -eq "healthy") {
Write-Host "$name - healthy" -ForegroundColor Green
} elseif ($status -eq "starting") {
Write-Host "$name - starting..." -ForegroundColor Yellow
} else {
Write-Host "$name - $status" -ForegroundColor Red
$allHealthy = $false
}
}
Write-Host ""
if ($allHealthy) {
Write-Host "========================================" -ForegroundColor Green
Write-Host " Update complete!" -ForegroundColor Green
Write-Host " App running at: http://localhost" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
} else {
Write-Host "Some containers may still be starting..." -ForegroundColor Yellow
Write-Host "Check status with: docker compose ps" -ForegroundColor Yellow
}

38
scripts/update-local.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# ============================================
# BraceIQMed - Local Update Script (Linux/Mac)
# Rebuilds and restarts Docker containers
# ============================================
set -e
echo "========================================"
echo " BraceIQMed - Local Update"
echo "========================================"
echo ""
# Change to project directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
echo "[1/3] Building Docker images..."
docker compose build
echo ""
echo "[2/3] Restarting containers..."
docker compose up -d
echo ""
echo "[3/3] Waiting for health checks..."
sleep 5
# Check health
echo ""
docker compose ps
echo ""
echo "========================================"
echo " Update complete!"
echo " App running at: http://localhost"
echo "========================================"