- Added package.json with dependencies and scripts for building and testing the API. - Implemented DIContainer for managing service instances (Cosmos DB, Key Vault). - Created createDonation function to handle donation creation and Stripe payment processing. - Implemented getDonations function for fetching donations with pagination and filtering. - Defined types for Donation, Volunteer, Program, and API responses. - Configured TypeScript with tsconfig.json for strict type checking and output settings. - Developed deployment scripts for production and simple deployments to Azure. - Created Bicep templates for infrastructure setup including Cosmos DB, Key Vault, and Function App. - Added parameters for deployment configuration in main.parameters.json. - Configured static web app settings in staticwebapp.config.json for routing and security.
62 lines
2.1 KiB
PowerShell
62 lines
2.1 KiB
PowerShell
# 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 |