Skip to content

bandhand/ResiliencyDemo

 
 

Repository files navigation

E-commerce Resiliency Demo for Azure Local

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.

📋 Table of Contents

🎯 Overview

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

What Gets Deployed

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

📋 Prerequisites

Azure Requirements

  • 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

Local Development Tools

  • Azure CLI (latest version)
  • PowerShell 7.0 or later
  • Bicep CLI (or Azure CLI with Bicep support)

Network Requirements

  • 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

🚀 Quick Start

1. Clone the Repository

git clone https://github.com/carmencrincoli/ResiliencyDemo.git
cd ResiliencyDemo

2. Configure Parameters

Important: Create your own parameters file from the template:

# Copy the template
Copy-Item template.bicepparam main.bicepparam

# Edit main.bicepparam with your environment details

Edit 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: The main.bicepparam file is in .gitignore and will NOT be committed to your repository. This keeps your passwords and configuration private. Always use the template.bicepparam as your starting point.

💡 Tip: For enhanced security, consider using SSH key authentication instead of passwords. See the SSH Authentication Guide for details.

3. Prepare Deployment

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

4. Deploy Infrastructure

# 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.bicepparam

5. Access the Application

Once deployment completes (15-20 minutes):

http://192.168.x.111  (your load balancer IP)

📋 Documentation

Detailed documentation is organized into focused guides:

🤝 Contributing

Contributions are welcome! Please consider:

  • Testing on Azure Local environments
  • Improving resiliency features
  • Adding monitoring capabilities
  • Enhancing documentation

📝 License

This project is provided as a demonstration and reference architecture. Modify as needed for your use case.

🔗 Related Documentation


Built with ❤️ for Azure Local demonstrations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 54.5%
  • Bicep 19.4%
  • TypeScript 14.4%
  • PowerShell 7.1%
  • PLpgSQL 3.3%
  • JavaScript 0.9%
  • CSS 0.4%