chore: organize project structure and cleanup root directory
- Move all deployment documentation to docs/deployment/ (16 files) - Move all phase documentation to docs/phases/ (9 files) - Move deployment scripts to scripts/ (3 PowerShell scripts) - Remove temporary deployment zip files (5 files) - Remove duplicate documentation files - Create documentation indexes for better navigation - Clean up root directory to essential files only - Update documentation references Root directory reduced from ~50+ files to 20 essential files. All documentation properly organized and indexed.
This commit is contained in:
202
scripts/deploy-production-full.ps1
Normal file
202
scripts/deploy-production-full.ps1
Normal file
@@ -0,0 +1,202 @@
|
||||
# Production Deployment Script for Miracles in Motion
|
||||
# This script deploys the application to Azure with production SKUs and custom domain support
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$ResourceGroupName = "rg-miraclesinmotion-prod",
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$Location = "East US",
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$CustomDomain = "mim4u.org",
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$StripePublicKey = "",
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[switch]$SkipBuild = $false
|
||||
)
|
||||
|
||||
Write-Host "🚀 Starting Production Deployment for Miracles in Motion" -ForegroundColor Green
|
||||
Write-Host "=================================================" -ForegroundColor Green
|
||||
|
||||
# Check if Azure CLI is installed
|
||||
if (!(Get-Command "az" -ErrorAction SilentlyContinue)) {
|
||||
Write-Error "Azure CLI is not installed. Please install it first: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if Static Web Apps CLI is installed
|
||||
if (!(Get-Command "swa" -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "📦 Installing Azure Static Web Apps CLI..." -ForegroundColor Yellow
|
||||
npm install -g @azure/static-web-apps-cli
|
||||
}
|
||||
|
||||
# Login to Azure if not already logged in
|
||||
$currentAccount = az account show --query "user.name" -o tsv 2>$null
|
||||
if (!$currentAccount) {
|
||||
Write-Host "🔐 Please log in to Azure..." -ForegroundColor Yellow
|
||||
az login
|
||||
}
|
||||
|
||||
Write-Host "✅ Logged in as: $currentAccount" -ForegroundColor Green
|
||||
|
||||
# Create resource group if it doesn't exist
|
||||
Write-Host "📁 Creating resource group: $ResourceGroupName" -ForegroundColor Yellow
|
||||
az group create --name $ResourceGroupName --location $Location
|
||||
|
||||
# Validate Stripe key
|
||||
if ([string]::IsNullOrEmpty($StripePublicKey)) {
|
||||
$StripePublicKey = Read-Host "Enter your Stripe Public Key (pk_live_...)"
|
||||
}
|
||||
|
||||
if (!$StripePublicKey.StartsWith("pk_live_")) {
|
||||
Write-Warning "Warning: Using non-production Stripe key. For production, use pk_live_..."
|
||||
}
|
||||
|
||||
# Build and test the application
|
||||
if (!$SkipBuild) {
|
||||
Write-Host "🔨 Building the application..." -ForegroundColor Yellow
|
||||
|
||||
# Install dependencies
|
||||
Write-Host "📦 Installing main project dependencies..." -ForegroundColor Cyan
|
||||
npm install --legacy-peer-deps
|
||||
|
||||
# Install API dependencies
|
||||
Write-Host "📦 Installing API dependencies..." -ForegroundColor Cyan
|
||||
Set-Location api
|
||||
npm install
|
||||
Set-Location ..
|
||||
|
||||
# Run tests
|
||||
Write-Host "🧪 Running tests..." -ForegroundColor Cyan
|
||||
npx vitest run --reporter=verbose
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Warning "Some tests failed, but continuing with deployment..."
|
||||
}
|
||||
|
||||
# Build the application
|
||||
Write-Host "🏗️ Building production bundle..." -ForegroundColor Cyan
|
||||
npm run build
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Build failed! Please fix the errors and try again."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Build completed successfully" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Deploy infrastructure
|
||||
Write-Host "🏗️ Deploying Azure infrastructure..." -ForegroundColor Yellow
|
||||
|
||||
$deploymentName = "mim-prod-deployment-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
|
||||
|
||||
$deploymentResult = az deployment group create `
|
||||
--resource-group $ResourceGroupName `
|
||||
--template-file "infrastructure/main-production.bicep" `
|
||||
--parameters "infrastructure/main-production.parameters.json" `
|
||||
--parameters stripePublicKey=$StripePublicKey `
|
||||
--parameters customDomainName=$CustomDomain `
|
||||
--parameters enableCustomDomain=$true `
|
||||
--name $deploymentName `
|
||||
--output json | ConvertFrom-Json
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Infrastructure deployment failed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Infrastructure deployed successfully" -ForegroundColor Green
|
||||
|
||||
# Get deployment outputs
|
||||
$staticWebAppName = $deploymentResult.properties.outputs.staticWebAppName.value
|
||||
$functionAppName = $deploymentResult.properties.outputs.functionAppName.value
|
||||
$staticWebAppUrl = $deploymentResult.properties.outputs.staticWebAppUrl.value
|
||||
|
||||
Write-Host "📋 Deployment Details:" -ForegroundColor Cyan
|
||||
Write-Host " Static Web App: $staticWebAppName" -ForegroundColor White
|
||||
Write-Host " Function App: $functionAppName" -ForegroundColor White
|
||||
Write-Host " Primary URL: $staticWebAppUrl" -ForegroundColor White
|
||||
if ($CustomDomain) {
|
||||
Write-Host " Custom Domain: https://$CustomDomain" -ForegroundColor White
|
||||
}
|
||||
|
||||
# Get deployment token for Static Web App
|
||||
Write-Host "🔑 Getting deployment token..." -ForegroundColor Yellow
|
||||
$deploymentToken = az staticwebapp secrets list --name $staticWebAppName --resource-group $ResourceGroupName --query "properties.apiKey" -o tsv
|
||||
|
||||
if ([string]::IsNullOrEmpty($deploymentToken)) {
|
||||
Write-Error "Failed to get deployment token!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Deploy to Static Web App
|
||||
Write-Host "🚀 Deploying to Static Web App..." -ForegroundColor Yellow
|
||||
|
||||
$env:SWA_CLI_DEPLOYMENT_TOKEN = $deploymentToken
|
||||
|
||||
# Deploy using SWA CLI
|
||||
swa deploy ./dist --api-location ./api --env production --deployment-token $deploymentToken
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Static Web App deployment failed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Application deployed successfully!" -ForegroundColor Green
|
||||
|
||||
# Deploy Function App
|
||||
Write-Host "🔧 Deploying Azure Functions..." -ForegroundColor Yellow
|
||||
|
||||
# Build API project
|
||||
Set-Location api
|
||||
npm run build 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Building API project..." -ForegroundColor Cyan
|
||||
npm run tsc 2>$null
|
||||
}
|
||||
Set-Location ..
|
||||
|
||||
# Deploy functions
|
||||
az functionapp deployment source config-zip --resource-group $ResourceGroupName --name $functionAppName --src "./api.zip" 2>$null
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "✅ Azure Functions deployed successfully" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Warning "Function deployment may have issues, but Static Web App is deployed"
|
||||
}
|
||||
|
||||
# Custom Domain Setup Instructions
|
||||
if ($CustomDomain) {
|
||||
Write-Host "🌐 Custom Domain Setup:" -ForegroundColor Magenta
|
||||
Write-Host "================================" -ForegroundColor Magenta
|
||||
Write-Host "1. Add a CNAME record in your DNS:" -ForegroundColor Yellow
|
||||
Write-Host " Name: www (or @)" -ForegroundColor White
|
||||
Write-Host " Value: $($staticWebAppUrl -replace 'https://', '')" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "2. Wait for DNS propagation (up to 48 hours)" -ForegroundColor Yellow
|
||||
Write-Host "3. The SSL certificate will be automatically provisioned" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# Final Summary
|
||||
Write-Host "🎉 DEPLOYMENT COMPLETE!" -ForegroundColor Green
|
||||
Write-Host "========================" -ForegroundColor Green
|
||||
Write-Host "🌐 Primary URL: $staticWebAppUrl" -ForegroundColor Cyan
|
||||
if ($CustomDomain) {
|
||||
Write-Host "🌐 Custom Domain: https://$CustomDomain (after DNS setup)" -ForegroundColor Cyan
|
||||
}
|
||||
Write-Host "🔗 Portal Access: $staticWebAppUrl#/portals" -ForegroundColor Cyan
|
||||
Write-Host "📊 Analytics: $staticWebAppUrl#/analytics" -ForegroundColor Cyan
|
||||
Write-Host "🤖 AI Portal: $staticWebAppUrl#/ai-portal" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "📚 Next Steps:" -ForegroundColor Yellow
|
||||
Write-Host "1. Set up DNS records for custom domain" -ForegroundColor White
|
||||
Write-Host "2. Configure authentication providers if needed" -ForegroundColor White
|
||||
Write-Host "3. Set up monitoring and alerts" -ForegroundColor White
|
||||
Write-Host "4. Update Stripe webhook endpoints" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "✨ Your Miracles in Motion application is now live in production!" -ForegroundColor Green
|
||||
62
scripts/deploy-production.ps1
Normal file
62
scripts/deploy-production.ps1
Normal file
@@ -0,0 +1,62 @@
|
||||
# Miracles in Motion - Production Deployment Script
|
||||
param(
|
||||
[string]$ResourceGroupName = "rg-miraclesinmotion-prod",
|
||||
[string]$Location = "East US 2",
|
||||
[string]$SubscriptionId = "6187c4d0-3c1a-4135-a8b5-c9782fcf0743"
|
||||
)
|
||||
|
||||
Write-Host "🚀 Starting Miracles in Motion Production Deployment" -ForegroundColor Green
|
||||
|
||||
# Set subscription
|
||||
Write-Host "Setting Azure subscription..." -ForegroundColor Yellow
|
||||
az account set --subscription $SubscriptionId
|
||||
|
||||
# Create resource group
|
||||
Write-Host "Creating resource group: $ResourceGroupName" -ForegroundColor Yellow
|
||||
az group create --name $ResourceGroupName --location $Location
|
||||
|
||||
# Deploy infrastructure using Bicep
|
||||
Write-Host "Deploying Azure infrastructure..." -ForegroundColor Yellow
|
||||
$deploymentResult = az deployment group create `
|
||||
--resource-group $ResourceGroupName `
|
||||
--template-file infrastructure/main.bicep `
|
||||
--parameters @infrastructure/main.parameters.json `
|
||||
--query 'properties.outputs' `
|
||||
--output json
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "Infrastructure deployment failed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Infrastructure deployed successfully!" -ForegroundColor Green
|
||||
|
||||
# Parse deployment outputs
|
||||
$outputs = $deploymentResult | ConvertFrom-Json
|
||||
|
||||
# Build and deploy Functions
|
||||
Write-Host "Building Azure Functions..." -ForegroundColor Yellow
|
||||
Set-Location api
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
# Deploy Functions
|
||||
Write-Host "Deploying Azure Functions..." -ForegroundColor Yellow
|
||||
func azure functionapp publish $outputs.functionAppName.value
|
||||
|
||||
# Build frontend
|
||||
Write-Host "Building frontend application..." -ForegroundColor Yellow
|
||||
Set-Location ..
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
# Deploy to Static Web Apps
|
||||
Write-Host "Deploying to Azure Static Web Apps..." -ForegroundColor Yellow
|
||||
az staticwebapp deploy `
|
||||
--name $outputs.staticWebAppName.value `
|
||||
--resource-group $ResourceGroupName `
|
||||
--source dist/
|
||||
|
||||
Write-Host "🎉 Deployment completed successfully!" -ForegroundColor Green
|
||||
Write-Host "🌐 Frontend URL: https://$($outputs.staticWebAppName.value).azurestaticapps.net" -ForegroundColor Cyan
|
||||
Write-Host "⚡ Functions URL: https://$($outputs.functionAppName.value).azurewebsites.net" -ForegroundColor Cyan
|
||||
53
scripts/deploy-simple.ps1
Normal file
53
scripts/deploy-simple.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Simple Azure deployment script
|
||||
|
||||
Write-Host "🚀 Deploying Miracles in Motion to Azure..." -ForegroundColor Green
|
||||
|
||||
# Deploy infrastructure
|
||||
Write-Host "Deploying infrastructure..." -ForegroundColor Yellow
|
||||
$deployment = az deployment group create `
|
||||
--resource-group rg-miraclesinmotion-prod `
|
||||
--template-file infrastructure/main.bicep `
|
||||
--parameters @infrastructure/main.parameters.json `
|
||||
--name "infra-deploy-$(Get-Date -Format 'yyyyMMdd-HHmmss')" `
|
||||
--output json | ConvertFrom-Json
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "❌ Infrastructure deployment failed!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "✅ Infrastructure deployed successfully!" -ForegroundColor Green
|
||||
|
||||
# Get deployment outputs
|
||||
$functionAppName = $deployment.properties.outputs.functionAppName.value
|
||||
$staticWebAppName = $deployment.properties.outputs.staticWebAppName.value
|
||||
|
||||
Write-Host "Function App: $functionAppName" -ForegroundColor Cyan
|
||||
Write-Host "Static Web App: $staticWebAppName" -ForegroundColor Cyan
|
||||
|
||||
# Install Azure Functions Core Tools if needed
|
||||
Write-Host "Checking Azure Functions Core Tools..." -ForegroundColor Yellow
|
||||
try {
|
||||
func --version
|
||||
} catch {
|
||||
Write-Host "Installing Azure Functions Core Tools..." -ForegroundColor Yellow
|
||||
npm install -g azure-functions-core-tools@4 --unsafe-perm true
|
||||
}
|
||||
|
||||
# Deploy Functions
|
||||
Write-Host "Deploying Azure Functions..." -ForegroundColor Yellow
|
||||
Set-Location api
|
||||
func azure functionapp publish $functionAppName --typescript
|
||||
Set-Location ..
|
||||
|
||||
# Deploy Static Web App
|
||||
Write-Host "Deploying Static Web App..." -ForegroundColor Yellow
|
||||
az staticwebapp deploy `
|
||||
--name $staticWebAppName `
|
||||
--resource-group rg-miraclesinmotion-prod `
|
||||
--source dist/
|
||||
|
||||
Write-Host "🎉 Deployment completed successfully!" -ForegroundColor Green
|
||||
Write-Host "🌐 Frontend URL: https://$staticWebAppName.azurestaticapps.net" -ForegroundColor Cyan
|
||||
Write-Host "⚡ Functions URL: https://$functionAppName.azurewebsites.net" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user