- 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.
53 lines
1.9 KiB
PowerShell
53 lines
1.9 KiB
PowerShell
#!/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 |