An open API service indexing awesome lists of open source software.

https://github.com/jonathan-vella/azure-postgresql-ha-workshop

Hands-on workshop for Azure PostgreSQL Flexible Server Zone-Redundant HA, failover testing, and database security
https://github.com/jonathan-vella/azure-postgresql-ha-workshop

azure bicep database failover high-availability infrastructure-as-code load-testing payment-gateway postgresql security-training workshop

Last synced: 3 months ago
JSON representation

Hands-on workshop for Azure PostgreSQL Flexible Server Zone-Redundant HA, failover testing, and database security

Awesome Lists containing this project

README

          

# Azure PostgreSQL High Availability Workshop

**Last Updated:** 2025-10-16

> **โš ๏ธ SECURITY NOTICE**: This repository contains intentional security vulnerabilities for training purposes. DO NOT use in production!

[![Documentation Version](https://img.shields.io/badge/docs-v1.1.0-blue.svg)](docs/)
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-16-blue.svg)](https://www.postgresql.org/)
[![Azure](https://img.shields.io/badge/Azure-Zone--Redundant%20HA-0089D6.svg)](https://azure.microsoft.com/en-us/products/postgresql/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

## ๐ŸŽฏ Purpose

Hands-on workshop for learning **Azure PostgreSQL Flexible Server Zone-Redundant High Availability**, failover testing, and database security concepts. Supports two workflows:

1. **SAIF Security Demo** - Vulnerable payment gateway application for security training
2. **High-Performance Load Testing** - 8000+ TPS PostgreSQL HA testing and validation

## ๐Ÿ“š What You'll Learn

- Deploy Zone-Redundant HA PostgreSQL Flexible Server
- Measure RTO (Recovery Time Objective) and RPO (Recovery Point Objective)
- **High-performance load testing** (8000+ TPS validated, 12,000+ TPS capable)
- Test failover scenarios under sustained load
- Identify and fix common security vulnerabilities
- Implement secure database patterns
- Performance monitoring with Azure Workbooks

## ๐Ÿ’ฐ Estimated Costs

**Default Configuration** (as deployed):

| Resource | Configuration | Estimated Cost/Hour | Monthly (730 hrs) |
|----------|--------------|---------------------|-------------------|
| PostgreSQL Flexible Server | Standard_D4ds_v5 (4 vCores, 16 GB RAM) | ~$0.28/hr | ~$205 |
| PostgreSQL Zone-Redundant HA | Standby replica (same SKU) | ~$0.28/hr | ~$205 |
| PostgreSQL Storage | 128 GB Premium SSD | ~$0.05/hr | ~$40 |
| App Service Plan | P1v3 (2 vCPU, 8 GB RAM, Linux) | ~$0.26/hr | ~$190 |
| Container Registry | Standard tier | ~$0.83/day | ~$25 |
| Key Vault | Secrets storage + operations | ~$0.03/day | ~$1 |
| Application Insights | Basic ingestion (Pay-as-you-go) | Variable | ~$10 |
| **Total** | **Zone-Redundant HA Setup** | **~$0.90/hr** | **~$675/month** |

๐Ÿ’ก **Workshop duration: 2-4 hours** = **~$3.60 total cost**

**High-Performance Configuration** (for 8K+ TPS testing):

| Resource | Configuration | Estimated Cost/Hour | Monthly (730 hrs) |
|----------|--------------|---------------------|-------------------|
| PostgreSQL Flexible Server | Standard_D16ds_v5 (16 vCores, 64 GB RAM) | ~$1.15/hr | ~$840 |
| PostgreSQL Zone-Redundant HA | Standby replica (same SKU) | ~$1.15/hr | ~$840 |
| PostgreSQL Storage | 8 TB (P60 - 16K IOPS, 500 MB/s) | ~$1.10/hr | ~$800 |
| App Service Plan | P1v3 (2 vCPU, 8 GB RAM, Linux) | ~$0.26/hr | ~$190 |
| Load Testing (ACI) | 16 vCPU, 32 GB RAM (transient) | ~$0.80/hr | **$0** (test only) |
| Supporting services | ACR, Key Vault, Insights | ~$0.04/hr | ~$35 |
| **Total** | **High-Performance Setup** | **~$3.70/hr** | **~$2,705/month** |

๐Ÿ’ก **8K TPS Load Test duration: 5-10 minutes** = **~$0.62 test cost**

> ๐Ÿ’ธ **Cost Optimization Tips**:
> - **Development/Testing**: Use `-disableHighAvailability` flag to reduce costs by ~50% (single-zone deployment)
> - **Stop/Start**: Stop PostgreSQL server when not in use (stops compute costs, only pay for storage)
> - **Reserved Capacity**: Save up to 60% with 3-year reserved pricing for production workloads
> - **Burstable Tier**: Use Standard_B2s (~$0.05/hr) for non-production workloads
> - **Load Testing**: ACI is pay-per-second, delete after test completion to avoid charges

## ๐Ÿ—๏ธ Architecture

This workshop uses **Azure Database for PostgreSQL Flexible Server** with **Zone-Redundant High Availability** to achieve:

- **RPO = 0** (Zero data loss)
- **RTO = 60-120 seconds** (Automatic failover)
- **SLA = 99.99%** (Zone-redundant deployment)

> ๐Ÿ“š **Documentation**: This README provides a quick overview. For comprehensive documentation, see the [docs/](docs/) directory.

## Architecture

```mermaid
graph TB
subgraph Azure["โ˜๏ธ Azure Cloud - Sweden Central"]
subgraph Zone1["๐Ÿ”ต Availability Zone 1"]
Web["๐ŸŒ Web App Service
(PHP/Apache)
Port 80
(Zonal)"]
API["โšก API App Service
(FastAPI)
Port 8000
(Zonal)"]
PrimaryDB["๐Ÿ—„๏ธ PostgreSQL Primary
Standard_D4ds_v5
Port 5432
128GB Premium SSD"]
Monitor["๐Ÿ“Š Application Insights
& Log Analytics"]
end

subgraph Zone2["๐Ÿ”ท Availability Zone 2"]
StandbyDB["๐Ÿ—„๏ธ PostgreSQL Standby
Hot Standby (Read Replica)
Synchronous Replication"]
end

subgraph Support["๐Ÿ› ๏ธ Supporting Services"]
KeyVault["๐Ÿ” Azure Key Vault
(Secrets & Creds)"]
ACR["๐Ÿ“ฆ Azure Container Registry
(Docker Images)"]
Backup["๐Ÿ’พ Azure Backup
(7-day retention)"]
end

LoadGen["๐Ÿ”„ Load Generator
(Optional - ACI)
12,600+ TPS Capacity"]
end

Users["๐Ÿ‘ฅ End Users
(Web Browsers)"]

Users -->|"HTTPS (443)"| Web
Web -->|"HTTP (8000)"| API
API -->|"PostgreSQL (5432)"| PrimaryDB
LoadGen -.->|"Load Testing"| API

PrimaryDB ==>|"Synchronous Replication
RPO = 0 (Zero Data Loss)"| StandbyDB
PrimaryDB -->|"Telemetry"| Monitor
API -->|"Telemetry"| Monitor
Web -->|"Telemetry"| Monitor

StandbyDB -.->|"Automatic Failover
RTO: 60-120s"| PrimaryDB

PrimaryDB -.->|"Get Secrets"| KeyVault
API -.->|"Get Secrets"| KeyVault
Web -.->|"Pull Images"| ACR
API -.->|"Pull Images"| ACR
PrimaryDB -.->|"Automated Backups"| Backup

classDef primary fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff
classDef standby fill:#87CEEB,stroke:#4A90E2,stroke-width:2px,color:#000
classDef app fill:#52C41A,stroke:#389E0D,stroke-width:2px,color:#fff
classDef support fill:#FFA940,stroke:#D46B08,stroke-width:2px,color:#fff
classDef monitor fill:#722ED1,stroke:#531DAB,stroke-width:2px,color:#fff
classDef users fill:#F5222D,stroke:#A8071A,stroke-width:2px,color:#fff
classDef loadgen fill:#FA8C16,stroke:#D46B08,stroke-width:2px,color:#fff

class PrimaryDB primary
class StandbyDB standby
class Web,API app
class KeyVault,ACR,Backup support
class Monitor monitor
class Users users
class LoadGen loadgen
```

**Architecture Highlights:**
- **App Service is Zonal**: Web/API App Service is deployed in a single zone (Zone 1) for lowest latency
- **Zone-Redundant HA for PostgreSQL**: Primary (Zone 1) and Standby (Zone 2) with synchronous replication
- **RPO = 0**: Zero data loss with synchronous commit
- **RTO = 60-120s**: Automatic failover between zones
- **SLA = 99.99%**: Zone-redundant deployment guarantee
- **Shared Services**: ACR, Key Vault, and monitoring are zone-redundant
- **Load Testing**: Optional ACI deployment for 8K-12K TPS validation

## Key Features

### Payment Gateway Components
- **Customers**: Customer account management
- **Merchants**: Merchant/vendor profiles
- **Payment Methods**: Credit cards, bank accounts, digital wallets
- **Transactions**: Payment processing records with full audit trail
- **Orders**: Order tracking and fulfillment

### High Availability Features
- **Zone-Redundant HA**: Primary and standby across availability zones
- **Synchronous Replication**: Zero data loss guarantee
- **Automatic Failover**: 60-120 second RTO
- **Continuous Write Testing**: Validates failover with zero data loss
- **Monitoring Dashboard**: Real-time HA status and metrics

### Educational Vulnerabilities (Intentional)
- โš ๏ธ SQL Injection in `/api/sqlversion` endpoint
- โš ๏ธ Command Injection in `/api/curl` endpoint
- โš ๏ธ Information Disclosure via `/api/printenv`
- โš ๏ธ Hardcoded API keys
- โš ๏ธ Permissive CORS policies
- โš ๏ธ Exposed database connection strings

## ๐Ÿš€ Quick Start

### Prerequisites
- Azure subscription ([free trial available](https://azure.microsoft.com/free/))
- Azure CLI installed and logged in
- PowerShell 7+ or Azure Cloud Shell
- Docker Desktop (optional, for local testing)

> ๐Ÿ“– For detailed prerequisites and setup instructions, see the [Deployment Guide](docs/deployment-guide.md).

### Deploy (5 minutes)

```powershell
# Clone repository
git clone https://github.com/jonathan-vella/azure-postgresql-ha-workshop.git
cd azure-postgresql-ha-workshop

# Deploy infrastructure
./scripts/Deploy-SAIF-PostgreSQL.ps1 -location swedencentral -autoApprove
```

[Full documentation โ†’](docs/deployment-guide.md)

### Deployment Options

#### Option 1: Quick Deploy (Recommended for Workshop)
```powershell
# Deploy infrastructure
cd infra
az deployment group create \
--resource-group rg-saif-pgsql-swc-01 \
--template-file main.bicep \
--parameters main.parameters.json

# Initialize database
cd ../scripts
.\Initialize-Database.ps1 `
-serverName "psql-saifpg-XXXXXXXX" `
-adminPassword "YourSecurePassword"

# Build and deploy containers
az acr build --registry --image saif/api:latest --file api/Dockerfile ./api
az acr build --registry --image saif/web:latest --file web/Dockerfile ./web

# Restart web apps to pull new images
az webapp restart --name app-saifpg-api-XXXXXXXX --resource-group rg-saif-pgsql-swc-01
az webapp restart --name app-saifpg-web-XXXXXXXX --resource-group rg-saif-pgsql-swc-01
```

#### Option 2: Local Development
```powershell
# Start local services
docker-compose up -d

# Initialize database
docker exec -it saif-postgres psql -U saifadmin -d saifdb -f /docker-entrypoint-initdb.d/init-db.sql

# Access application
# Web: http://localhost:8080
# API: http://localhost:8000
```

> ๐Ÿ“– For comprehensive deployment options and troubleshooting, see [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).

### Database Initialization

The database requires the **uuid-ossp** extension for transaction IDs. On Azure PostgreSQL Flexible Server, this must be explicitly enabled:

```powershell
# Enable uuid-ossp extension
az postgres flexible-server parameter set \
--resource-group rg-saif-pgsql-swc-01 \
--server-name psql-saifpg-XXXXXXXX \
--name azure.extensions \
--value "UUID-OSSP"

# Run initialization script
cd scripts
.\Initialize-Database.ps1 `
-serverName "psql-saifpg-XXXXXXXX.postgres.database.azure.com" `
-adminPassword "YourPassword"
```

> ๐Ÿ“– For detailed database initialization procedures, see [Container Initialization Guide](docs/guides/container-initialization-guide.md).

## Database Schema

### Payment Gateway Schema
```sql
-- Customers
CREATE TABLE customers (
customer_id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
first_name VARCHAR(100),
last_name VARCHAR(100),
phone VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Merchants
CREATE TABLE merchants (
merchant_id SERIAL PRIMARY KEY,
merchant_name VARCHAR(255) NOT NULL,
merchant_code VARCHAR(50) UNIQUE NOT NULL,
api_key VARCHAR(255),
status VARCHAR(20) DEFAULT 'active'
);

-- Transactions
CREATE TABLE transactions (
transaction_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
customer_id INTEGER REFERENCES customers(customer_id),
merchant_id INTEGER REFERENCES merchants(merchant_id),
amount DECIMAL(10,2) NOT NULL,
currency VARCHAR(3) DEFAULT 'USD',
status VARCHAR(20),
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
```

## API Endpoints

### Payment Gateway APIs
- `POST /api/payments/process` - Process payment transaction
- `GET /api/payments/{transaction_id}` - Get transaction status
- `GET /api/payments/customer/{customer_id}` - Get customer transactions
- `POST /api/customers/create` - Create customer account

### Diagnostic APIs (Vulnerable by Design)
- `GET /api/healthcheck` - Service health status
- `GET /api/ip` - Server IP information
- `GET /api/sqlversion` - Database version โš ๏ธ SQL Injection vulnerability
- `GET /api/curl?url=` - Fetch URL โš ๏ธ SSRF/Command injection
- `GET /api/printenv` - Environment variables โš ๏ธ Information disclosure

## ๐Ÿ“Š Performance Benchmarks

### App Service Load Testing (Current)
- **Validated TPS**: **1,000-2,000+ TPS per instance** (immediate App Insights logging)
- **Scaling**: Supports multiple App Service instances for higher throughput
- **Response Time**: Immediate telemetry (no Log Analytics delays)
- **Infrastructure**: P0v3 App Service Plan (standard) to P1v3 (upgrade for higher TPS)
- **Monitoring**: Real-time HTTP status endpoints + Application Insights dashboard

### Failover Testing Performance (RTO/RPO)
- **Measured RTO**: **16-25 seconds** (Zone-Redundant HA automatic failover)
- **Measured RPO**: **0 transactions** (zero data loss with synchronous replication)
- **Test Method**: App Service load test + manual failover trigger + Measure-Failover-RTO-RPO.ps1
- **Success Rate**: 100% data consistency (all transactions persisted before failover)
- **Monitoring**: Real-time probes (1-second intervals), detailed CSV reports

> ๐Ÿ“– **Quick Start**: See [Load Testing Guide](docs/load-testing-guide.md) for complete deployment and monitoring

### Legacy Benchmarks (ACI - Archived)
- **8000-12,600+ TPS** (Azure Container Instances, archived approach)
- **Succeeded**: October 10, 2025 test with D16ds_v5 + P60 storage
- **Reference**: [Archive benchmarks](archive/) for historical context

### Load Testing & Failover Testing

The workshop includes **two testing approaches**:

#### Option 1: App Service Load Testing โญ **RECOMMENDED - IMMEDIATE MONITORING**
```powershell
# Deploy load generator to App Service
cd scripts/loadtesting
.\Deploy-LoadGenerator-AppService.ps1 `
-Action "Deploy" `
-ResourceGroup "rg-pgv2-usc01" `
-AppServiceName "app-loadgen" `
-PostgreSQLServer "pg-cus.postgres.database.azure.com" `
-DatabaseName "saifdb" `
-AdminUsername "jonathan"

# Start load test via HTTP API
$url = "https://app-loadgen.azurewebsites.net/start"
curl -X POST $url | ConvertFrom-Json

# Monitor in real-time
.\Monitor-AppService-Logs.ps1 -ResourceGroup "rg-pgv2-usc01" -AppServiceName "app-loadgen"

# Check status
curl https://app-loadgen.azurewebsites.net/status | ConvertFrom-Json | Format-List
```

**Use Case**: Production-grade load testing with immediate Application Insights monitoring
**Throughput**: **1,000-2,000+ TPS** per App Service instance (scalable)
**Features**:
- HTTP API endpoints (`/start`, `/status`, `/health`, `/logs`)
- Real-time Application Insights telemetry (no delays)
- Container-based .NET 8.0 application
- Automatic database transaction logging
- Easy scaling via App Service plan upgrade

> ๐Ÿ“– **Complete Guide**: [Load Testing Guide](docs/load-testing-guide.md) - Comprehensive deployment & monitoring

#### Option 2: RTO/RPO Failover Testing โญ **MEASURE RECOVERY METRICS**
```powershell
# Start failover measurement with running load test
cd scripts/loadtesting
.\Measure-Failover-RTO-RPO.ps1 `
-AppServiceUrl "https://app-loadgen-6wuso.azurewebsites.net" `
-ResourceGroup "rg-pgv2-usc01" `
-ServerName "pg-cus" `
-DatabaseName "saifdb" `
-AdminUsername "jonathan" `
-MaxMonitoringSeconds 90

# Then trigger manual failover in Azure Portal:
# 1. PostgreSQL Flexible Server > High Availability blade
# 2. Click "Forced failover"
# 3. Confirm action
# Script will measure RTO and RPO
```

**Use Case**: Measure recovery time and data loss during failover
**RTO**: 16-25 seconds (measured in October 2025)
**RPO**: 0 transactions (zero data loss with synchronous replication)
**Features**:
- Real-time monitoring during failover
- Connection loss detection (1-second probes)
- Database transaction count verification
- TPS recovery tracking
- CSV report generation with detailed metrics

> ๐Ÿ“– **Complete Guide**: [Failover Testing Guide](docs/failover-testing-guide.md) - RTO/RPO measurement procedures
> ๐Ÿ“– **Cheat Sheet**: [Load Testing Cheat Sheet](docs/load-testing-cheat-sheet.md) - Quick commands reference

## Security Considerations

### Production Hardening (Not Included)
This is an **educational environment** with intentional vulnerabilities. For production:

1. **Remove SQL Injection**: Use parameterized queries everywhere
2. **Implement Input Validation**: Sanitize all user inputs
3. **Secure Environment Variables**: Use Key Vault exclusively
4. **Network Isolation**: Use VNet integration + Private Endpoints
5. **Authentication**: Implement Entra ID authentication
6. **Audit Logging**: Enable PostgreSQL audit extension

## Project Structure

```
azure-postgresql-ha-workshop/
โ”œโ”€โ”€ ๐Ÿ“ infra/ # Infrastructure as Code (Bicep templates)
โ”‚ โ”œโ”€โ”€ main.bicep # Main deployment template
โ”‚ โ”œโ”€โ”€ main.parameters.json # Deployment parameters
โ”‚ โ””โ”€โ”€ modules/
โ”‚ โ”œโ”€โ”€ database/
โ”‚ โ”‚ โ””โ”€โ”€ postgresql.bicep # PostgreSQL HA module
โ”‚ โ””โ”€โ”€ keyvault/
โ”‚ โ””โ”€โ”€ keyvault.bicep # Key Vault secrets management
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ database/ # Database initialization scripts
โ”‚ โ”œโ”€โ”€ init-db.sql # Schema creation (customers, merchants, transactions)
โ”‚ โ”œโ”€โ”€ enable-uuid.sql # UUID extension setup
โ”‚ โ”œโ”€โ”€ cleanup-db.sql # Database cleanup utilities
โ”‚ โ””โ”€โ”€ README.md # Database documentation
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ web/ # SAIF PHP Web Application (security demos)
โ”œโ”€โ”€ ๐Ÿ“ api/ # SAIF Python FastAPI (security demos)
โ”œโ”€โ”€ ๐Ÿ“„ docker-compose.yml # Local SAIF development environment
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ scripts/ # Operational scripts
โ”‚ โ”œโ”€โ”€ ๐Ÿš€ Deploy-SAIF-PostgreSQL.ps1 # Full infrastructure deployment
โ”‚ โ”œโ”€โ”€ ๐Ÿš€ Quick-Deploy-SAIF.ps1 # Simplified deployment wrapper
โ”‚ โ”œโ”€โ”€ ๐ŸŒ Rebuild-SAIF-Containers.ps1 # SAIF app container rebuild
โ”‚ โ”œโ”€โ”€ ๐ŸŒ Test-SAIFLocal.ps1 # Local SAIF testing
โ”‚ โ”œโ”€โ”€ ๐Ÿ’พ Initialize-Database.ps1 # Database initialization
โ”‚ โ”œโ”€โ”€ ๐Ÿ“– README.md # Scripts documentation
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ ๐Ÿ“ loadtesting/ # Load testing & failover testing scripts (current)
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿงช Program.cs # .NET 8.0 load generator web app
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿงช Dockerfile # Multi-stage container build
โ”‚ โ”‚ โ”œโ”€โ”€ ๏ฟฝ Deploy-LoadGenerator-AppService.ps1 # Deploy to App Service
โ”‚ โ”‚ โ”œโ”€โ”€ ๏ฟฝ Monitor-AppService-Logs.ps1 # Stream container logs
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ”„ Measure-Failover-RTO-RPO.ps1 # RTO/RPO measurement
โ”‚ โ”‚ โ”œโ”€โ”€ ๏ฟฝ LoadGenerator-Config.ps1 # Centralized configuration
โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“– README.md # Load testing documentation (v1.0.0)
โ”‚ โ”‚ โ””โ”€โ”€ archive/ # Archived testing approaches
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ utils/
โ”‚ โ”‚ โ””โ”€โ”€ Build-SAIF-Containers.ps1 # SAIF container build utility
โ”‚ โ””โ”€โ”€ archive/ # Archived scripts (historical)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ azure-workbooks/ # Azure Portal monitoring
โ”‚ โ”œโ”€โ”€ PostgreSQL-HA-Performance-Workbook.json # Pre-configured workbook (6 charts)
โ”‚ โ””โ”€โ”€ IMPORT-GUIDE.md # 30-second import guide
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ docs/ # Documentation (v1.1.0+)
โ”‚ โ”œโ”€โ”€ architecture.md # System architecture & design (v2.0.0)
โ”‚ โ”œโ”€โ”€ CHANGELOG.md # Documentation version history (v2.2.0)
โ”‚ โ”œโ”€โ”€ deployment-guide.md # Complete deployment guide (v2.1.0)
โ”‚ โ”œโ”€โ”€ failover-testing-guide.md # RTO/RPO measurement procedures (v1.0.0)
โ”‚ โ”œโ”€โ”€ load-testing-guide.md # App Service load testing guide (v1.1.0)
โ”‚ โ”œโ”€โ”€ load-testing-cheat-sheet.md # Quick reference commands (v1.0.0)
โ”‚ โ”œโ”€โ”€ README.md # Documentation index
โ”‚ โ”œโ”€โ”€ VERSIONING-UPDATE-PLAN.md # Semantic versioning migration plan
โ”‚ โ”œโ”€โ”€ VERSIONING-UPDATE-SUMMARY.md # Implementation summary
โ”‚ โ”‚
โ”‚ โ””โ”€โ”€ archive/ (v1.0.0 docs - deprecated)
โ”‚ โ”œโ”€โ”€ index.md, quick-reference.md, checklist.md
โ”‚ โ”œโ”€โ”€ guides/ (container, initialization procedures)
โ”‚ โ””โ”€โ”€ architecture/ (detailed implementations)
โ”‚
โ””โ”€โ”€ ๐Ÿ“ archive/ # Archived files (historical reference)
โ”œโ”€โ”€ deprecated-approaches/ # Old testing methods
โ”œโ”€โ”€ documentation/ # Development diaries
โ”œโ”€โ”€ duplicates/ # Removed duplicates
โ”œโ”€โ”€ generated-outputs/ # Test artifacts
โ””โ”€โ”€ README.md # Archive documentation
```

## ๐Ÿ“š Documentation

**[๐Ÿ“– Complete Documentation Index](docs/README.md)** - Start here for all documentation

### ๐Ÿš€ Quick Start Guides

- **[๐Ÿ“˜ Deployment Guide](docs/deployment-guide.md)** - Complete step-by-step deployment
- **[๐Ÿงช Testing Guide](docs/testing-guide.md)** - Load testing (8K TPS) + Failover testing
- **[๐Ÿ—๏ธ Architecture](docs/architecture.md)** - System design and components
- **[๐Ÿ”ฅ Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues & solutions

### ๐Ÿงช Testing & Monitoring

- **[๐Ÿงช Testing Guide](docs/testing-guide.md)** - Complete load testing (8K TPS) + failover testing
- **[๐Ÿ“Š Azure Workbook Import](azure-workbooks/IMPORT-GUIDE.md)** - 30-second performance dashboard setup
- **[๐Ÿ“– RTO Measurement](scripts/CONNECTION-RTO-GUIDE.md)** - Connection RTO testing guide
- **[๐Ÿ“– Failover Monitoring](scripts/MONITOR-FAILOVER-GUIDE.md)** - Monitor failover events

### ๐Ÿ—„๏ธ Database & SAIF Application

- **[๐Ÿ—„๏ธ Database Initialization](archive/docs-v1.0.0/guides/container-initialization-guide.md)** - Setup procedures (archived)
- **[๐Ÿณ Container Build Guide](archive/docs-v1.0.0/guides/BUILD-CONTAINERS-GUIDE.md)** - SAIF app container builds (archived)

### ๐Ÿ“ Architecture & Deep Dive

- **[๐Ÿ—๏ธ Architecture](docs/architecture.md)** - System design & components
- **[๐Ÿ’ป Implementation Details](archive/docs-v1.0.0/architecture/IMPLEMENTATION-COMPLETE.md)** - Technical deep dive (archived)
- **[๐Ÿ“ Changelog](docs/CHANGELOG.md)** - Version history

> ๐Ÿ’ก **Tip**: Having issues? Check [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) first!

## ๐Ÿค Contributing

Contributions welcome! Please read our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.

### How to Contribute:
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“„ License

MIT License - See [LICENSE](LICENSE) for details.

Copyright (c) 2025 Jonathan Vella

## โš ๏ธ Security Disclaimer

This project contains **intentional security vulnerabilities** for educational purposes. See [SECURITY.md](SECURITY.md) for details.

**DO NOT**:
- โŒ Deploy this in production environments
- โŒ Use these patterns in real applications
- โŒ Expose these applications to the public internet

## ๐Ÿ™ Acknowledgments

Built for Microsoft Azure training workshops and hackathons.

## ๐Ÿ“š References

- [Azure PostgreSQL Flexible Server HA](https://learn.microsoft.com/azure/reliability/reliability-postgresql-flexible-server)
- [Azure Well-Architected Framework](https://learn.microsoft.com/azure/architecture/framework/)
- [PostgreSQL Performance Tuning](https://www.postgresql.org/docs/current/performance-tips.html)
- [OWASP Top 10](https://owasp.org/www-project-top-ten/) - Security vulnerability reference

---

## ๐Ÿ“ฆ Repository Organization

This repository was reorganized on **October 10, 2025** (v2.0.0) to streamline workflows and improve maintainability:

- **Core operational files**: Infrastructure, deployment, load testing, monitoring (35 files)
- **Archived files**: Historical artifacts preserved in `/archive/` (44 files)
- **Two workflows supported**: SAIF security demos + High-performance load testing

See [REORGANIZATION-SUMMARY.md](REORGANIZATION-SUMMARY.md) for complete reorganization details.