A comprehensive, production-ready e-commerce application demonstrating high-availability architecture and infrastructure automation on Azure Local (formerly Azure Stack HCI). This project showcases best practices for building resilient applications with automated deployment using Azure Bicep templates.
This project deploys a fully functional e-commerce web application on Azure Local infrastructure, demonstrating:
- High Availability: Multiple web application servers behind an NGINX load balancer
- Database Replication: PostgreSQL primary-replica configuration for data redundancy
- Automated Deployment: Complete infrastructure provisioning via Bicep templates
- Production-Ready: Comprehensive logging, monitoring, and health checks
- Zero-Touch Onboarding: Azure Arc-enabled VMs for cloud-based management
The solution automatically provisions and configures:
- 5 Virtual Machines on Azure Local (2 web apps, 2 databases, 1 load balancer)
- Next.js 14 full-stack e-commerce application with TypeScript
- PostgreSQL 16 database with streaming replication
- NGINX load balancer with health checks and SSL/TLS
- Complete observability with structured logging and monitoring
- Azure Subscription with appropriate permissions
- Azure Local (Stack HCI) cluster deployed and configured
- Custom Location created for the Azure Local cluster
- Logical Network configured with available IP addresses
- VM Image: Ubuntu 24.04 LTS gallery image
- Azure CLI (latest version)
- PowerShell 7.0 or later
- Bicep CLI (or Azure CLI with Bicep support)
- 5 Static IP Addresses in the same subnet
- Virtual Network with sufficient address space for 5 VMs
- Supports any subnet size (e.g., /24, /25, /26, /27, or larger)
- All 5 IPs must be in the same subnet
- Outbound Internet Access for package downloads
- Azure Storage Access for deployment scripts
git clone https://github.com/carmencrincoli/ResiliencyDemo.git
cd ResiliencyDemoImportant: Create your own parameters file from the template:
# Copy the template
Copy-Item template.bicepparam main.bicepparam
# Edit main.bicepparam with your environment detailsEdit main.bicepparam with your specific values:
param customLocationName = 'your-custom-location'
param logicalNetworkName = 'your-logical-network'
param azureLocalResourceGroup = 'your-azure-local-rg'
param vmImageName = 'ubuntu2404-lts-image-name'
param staticIPs = {
loadBalancer: '192.168.x.20'
dbPrimary: '192.168.x.21'
dbReplica: '192.168.x.22'
webapp1: '192.168.x.23'
webapp2: '192.168.x.24'
}
param adminPassword = 'YourSecurePassword!'
param servicePassword = 'YourDatabasePassword!'
# OPTIONAL: Enable SSH key authentication (recommended for production)
# param sshPublicKey = loadTextContent('~/.ssh/id_rsa.pub')
⚠️ Security Note: Themain.bicepparamfile is in.gitignoreand will NOT be committed to your repository. This keeps your passwords and configuration private. Always use thetemplate.bicepparamas your starting point.
💡 Tip: For enhanced security, consider using SSH key authentication instead of passwords. See the SSH Authentication Guide for details.
Run the preparation script to upload assets to Azure Storage:
.\Prepare-Deployment.ps1 `
-ResourceGroupName "rg-ecommerce-demo" `
-Location "eastus"This script will:
- Create or use existing Azure Storage Account
- Upload deployment scripts and application archives
- Update the parameters file with storage account details
# Create resource group
az group create --name rg-ecommerce-demo --location eastus
# Deploy the Bicep template
az deployment group create `
--resource-group rg-ecommerce-demo `
--template-file ./infra/main.bicep `
--parameters ./main.bicepparamOnce deployment completes (15-20 minutes):
http://192.168.x.111 (your load balancer IP)
Detailed documentation is organized into focused guides:
- Architecture & Application Stack - System architecture, component details, application stack, infrastructure as code, application features, and resiliency features
- Deployment Guide & Configuration - Step-by-step deployment, parameter configuration, environment variables, and customization options
- SSH Authentication - Configure SSH key-based authentication for secure VM access (recommended for production)
- Monitoring & Troubleshooting - Health checks, log locations, PM2 management, database operations, and detailed troubleshooting guides
Contributions are welcome! Please consider:
- Testing on Azure Local environments
- Improving resiliency features
- Adding monitoring capabilities
- Enhancing documentation
This project is provided as a demonstration and reference architecture. Modify as needed for your use case.
- Azure Local Documentation
- Azure Bicep Documentation
- Next.js Documentation
- PostgreSQL Replication
- NGINX Load Balancing
Built with ❤️ for Azure Local demonstrations