{"id":29395186,"url":"https://github.com/ashu10dubey/automated-web-hosting-solution","last_synced_at":"2025-07-10T11:17:01.381Z","repository":{"id":303807958,"uuid":"1016770073","full_name":"ashu10dubey/automated-web-hosting-solution","owner":"ashu10dubey","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-09T14:00:05.000Z","size":753,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-09T14:53:09.457Z","etag":null,"topics":["azure-devops","terraform"],"latest_commit_sha":null,"homepage":"https://github.com/ashu10dubey/automated-web-hosting-solution","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashu10dubey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-09T13:52:04.000Z","updated_at":"2025-07-09T14:03:34.000Z","dependencies_parsed_at":"2025-07-09T14:53:12.779Z","dependency_job_id":"06c44ee6-b5fd-48c2-8ded-650045f2eea6","html_url":"https://github.com/ashu10dubey/automated-web-hosting-solution","commit_stats":null,"previous_names":["ashu10dubey/automated-web-hosting-solution"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashu10dubey/automated-web-hosting-solution","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashu10dubey%2Fautomated-web-hosting-solution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashu10dubey%2Fautomated-web-hosting-solution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashu10dubey%2Fautomated-web-hosting-solution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashu10dubey%2Fautomated-web-hosting-solution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashu10dubey","download_url":"https://codeload.github.com/ashu10dubey/automated-web-hosting-solution/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashu10dubey%2Fautomated-web-hosting-solution/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264569605,"owners_count":23629622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-devops","terraform"],"created_at":"2025-07-10T11:16:57.506Z","updated_at":"2025-07-10T11:17:01.376Z","avatar_url":"https://github.com/ashu10dubey.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automated Web Hosting Solution with Multi-Environment Deployment\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Terraform](https://img.shields.io/badge/Terraform-v1.0+-purple.svg)](https://www.terraform.io/)\n[![Azure](https://img.shields.io/badge/Azure-Cloud-blue.svg)](https://azure.microsoft.com/)\n\n## Project Overview\n\nThis project provides an **Infrastructure as Code (IAC)** solution for deploying a robust, scalable web hosting environment on Microsoft Azure. The solution uses Terraform to automate the deployment of virtual machine-based web servers with load balancing capabilities across multiple environments (Development, UAT, and Production).\n\n### Key Features\n\n- **Multi-Environment Support**: Single-click deployment to Dev, UAT, and Production environments\n- **Load Balancing**: Azure Load Balancer with backend pool configuration\n- **Infrastructure as Code**: Complete Terraform-based infrastructure automation\n- **CI/CD Integration**: Azure DevOps pipelines for automated deployment\n- **Security**: Network Security Groups, Key Vault integration, and secure access patterns\n- **Scalability**: Parameterized deployments with environment-specific configurations\n- **Monitoring**: Built-in health checks and monitoring capabilities\n\n## Architecture\n![alt text](image.png)\nThe solution deploys the following Azure resources:\n\n- **Virtual Network**: Isolated network environment with subnets\n- **Virtual Machines**: Two web server instances for high availability\n- **Load Balancer**: Azure Load Balancer with frontend IP and backend pool\n- **Network Security Groups**: Firewall rules for secure access\n- **Storage Account**: Terraform state management\n- **Key Vault**: Secure secrets management\n- **Public IP**: External access point for the load balancer\n\n## Prerequisites\n\nBefore you begin, ensure you have the following:\n\n### Software Requirements\n\n- [Terraform](https://www.terraform.io/downloads) \u003e= 1.0\n- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) \u003e= 2.0\n- [Git](https://git-scm.com/downloads)\n- [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell) or Bash\n\n### Azure Requirements\n\n- Azure subscription with appropriate permissions\n- Azure DevOps organization (for CI/CD)\n- Service Principal with Contributor access\n- Resource Group creation permissions\n\n### Environment Setup\n\n1. **Clone the repository**:\n   ```bash\n   git clone https://github.com/your-org/automated-web-hosting-solution.git\n   cd automated-web-hosting-solution\n   ```\n\n2. **Configure Azure CLI**:\n   ```bash\n   az login\n   az account set --subscription \"your-subscription-id\"\n   ```\n\n3. **Create Service Principal**:\n   ```bash\n   az ad sp create-for-rbac --name \"terraform-sp\" --role=\"Contributor\" --scopes=\"/subscriptions/your-subscription-id\"\n   ```\n\n## Project Structure\n\n```\nautomated-web-hosting-solution/\n├── README.md                           # This file\n├── architecture/                       # Architecture diagrams\n│   ├── azure_architecture_diagram.png\n│   └── cicd_flow_diagram.png\n├── terraform/                          # Terraform configurations\n│   ├── main.tf                        # Main Terraform configuration\n│   ├── variables.tf                   # Variable definitions\n│   ├── outputs.tf                     # Output definitions\n│   ├── versions.tf                    # Provider versions\n│   └── modules/                       # Reusable Terraform modules\n│       ├── network/                   # Network module\n│       ├── compute/                   # VM module\n│       ├── load-balancer/             # Load balancer module\n│       └── security/                  # Security module\n├── environments/                       # Environment-specific configurations\n│   ├── dev.tfvars                     # Development environment\n│   ├── uat.tfvars                     # UAT environment\n│   └── prod.tfvars                    # Production environment\n├── scripts/                           # Deployment and utility scripts\n│   ├── deploy.ps1                     # PowerShell deployment script\n│   ├── deploy.sh                      # Bash deployment script\n│   ├── setup-backend.ps1              # Backend setup script\n│   └── web-server-setup.sh            # Web server configuration\n├── pipelines/                         # Azure DevOps pipelines\n│   ├── azure-pipelines.yml           # Main CI/CD pipeline\n│   ├── deploy-pipeline.yml           # Deployment pipeline\n│   └── destroy-pipeline.yml          # Cleanup pipeline\n├── docs/                              # Additional documentation\n│   ├── DEPLOYMENT.md                  # Deployment guide\n│   ├── CONFIGURATION.md               # Configuration guide\n│   └── TROUBLESHOOTING.md             # Troubleshooting guide\n└── .gitignore                         # Git ignore file\n```\n\n## Quick Start\n\n### 1. Manual Deployment\n\nFor manual deployment to a single environment:\n\n```bash\n# Navigate to terraform directory\ncd terraform\n\n# Initialize Terraform\nterraform init\n\n# Plan deployment for development environment\nterraform plan -var-file=\"../environments/dev.tfvars\"\n\n# Apply configuration\nterraform apply -var-file=\"../environments/dev.tfvars\"\n```\n\n### 2. Automated Deployment with Scripts\n\nUse the provided PowerShell script for Windows:\n\n```powershell\n# Deploy to development environment\n.\\scripts\\deploy.ps1 -Environment dev -SubscriptionId \"your-subscription-id\"\n\n# Deploy to UAT environment\n.\\scripts\\deploy.ps1 -Environment uat -SubscriptionId \"your-subscription-id\"\n\n# Deploy to production environment\n.\\scripts\\deploy.ps1 -Environment prod -SubscriptionId \"your-subscription-id\"\n```\n\nUse the Bash script for Linux/macOS:\n\n```bash\n# Deploy to development environment\n./scripts/deploy.sh dev your-subscription-id\n\n# Deploy to UAT environment\n./scripts/deploy.sh uat your-subscription-id\n\n# Deploy to production environment\n./scripts/deploy.sh prod your-subscription-id\n```\n\n### 3. CI/CD Pipeline Deployment\n\n1. **Setup Azure DevOps**:\n   - Create a new project in Azure DevOps\n   - Import this repository\n   - Configure service connections\n\n2. **Configure Pipeline Variables**:\n   - `ARM_CLIENT_ID`: Service Principal Client ID\n   - `ARM_CLIENT_SECRET`: Service Principal Client Secret\n   - `ARM_SUBSCRIPTION_ID`: Azure Subscription ID\n   - `ARM_TENANT_ID`: Azure Tenant ID\n\n3. **Run Pipeline**:\n   - Navigate to Pipelines in Azure DevOps\n   - Select the imported pipeline\n   - Run the pipeline for desired environment\n\n## Configuration\n\n### Environment Variables\n\nThe solution supports the following environment-specific variables:\n\n| Variable | Description | Dev | UAT | Prod |\n|----------|-------------|-----|-----|------|\n| `location` | Azure region | East US | East US 2 | West US 2 |\n| `vm_count` | Number of VMs | 2 | 2 | 3 |\n| `vm_size` | VM size | Standard_B2s | Standard_B2ms | Standard_D2s_v3 |\n| `environment` | Environment name | dev | uat | prod |\n\n### Terraform Variables\n\nKey Terraform variables in `variables.tf`:\n\n```hcl\nvariable \"environment\" {\n  description = \"Environment name (dev, uat, prod)\"\n  type        = string\n  default     = \"dev\"\n}\n\nvariable \"location\" {\n  description = \"Azure region\"\n  type        = string\n  default     = \"East US\"\n}\n\nvariable \"vm_count\" {\n  description = \"Number of web server VMs\"\n  type        = number\n  default     = 2\n}\n\nvariable \"vm_size\" {\n  description = \"Size of the VMs\"\n  type        = string\n  default     = \"Standard_B2s\"\n}\n```\n\n## Deployment Environments\n\n### Development Environment\n\n- **Purpose**: Development and testing\n- **VM Count**: 2\n- **VM Size**: Standard_B2s\n- **Load Balancer**: Basic SKU\n- **Auto-scaling**: Disabled\n\n### UAT Environment\n\n- **Purpose**: User acceptance testing\n- **VM Count**: 2\n- **VM Size**: Standard_B2ms\n- **Load Balancer**: Standard SKU\n- **Auto-scaling**: Enabled\n\n### Production Environment\n\n- **Purpose**: Production workloads\n- **VM Count**: 3\n- **VM Size**: Standard_D2s_v3\n- **Load Balancer**: Standard SKU\n- **Auto-scaling**: Enabled\n- **High Availability**: Multiple availability zones\n\n## Security\n\n### Network Security\n\n- **Network Security Groups**: Configured with minimal required rules\n- **Private Subnets**: VMs deployed in private subnets\n- **Load Balancer**: Frontend access only through load balancer\n- **SSH Access**: Restricted to bastion host or VPN\n\n### Identity and Access\n\n- **Service Principal**: Least privilege access\n- **Key Vault**: Centralized secret management\n- **RBAC**: Role-based access control\n- **Managed Identity**: Azure AD integration\n\n## Monitoring and Logging\n\n- **Azure Monitor**: VM and application monitoring\n- **Log Analytics**: Centralized logging\n- **Application Insights**: Application performance monitoring\n- **Health Checks**: Load balancer health probes\n\n## Maintenance and Updates\n\n### Terraform State Management\n\n- **Remote State**: Stored in Azure Storage Account\n- **State Locking**: Prevented concurrent modifications\n- **State Encryption**: Encrypted at rest\n\n### Updates and Patches\n\n- **VM Updates**: Automated patching enabled\n- **Application Updates**: Blue-green deployment strategy\n- **Infrastructure Updates**: Version-controlled Terraform changes\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Authentication Errors**:\n   - Verify service principal credentials\n   - Check Azure CLI authentication\n   - Validate subscription access\n\n2. **Resource Creation Failures**:\n   - Check resource naming conventions\n   - Verify subscription quotas\n   - Review Azure policy restrictions\n\n3. **Network Connectivity Issues**:\n   - Validate NSG rules\n   - Check subnet configurations\n   - Verify load balancer health probes\n\n### Debugging Commands\n\n```bash\n# Check Terraform state\nterraform state list\n\n# Validate configuration\nterraform validate\n\n# Check resource status\naz resource list --resource-group rg-web-hosting-dev\n\n# Test connectivity\ncurl -I http://your-load-balancer-ip\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly\n5. Submit a pull request\n\n### Development Guidelines\n\n- Follow Terraform best practices\n- Use meaningful variable names\n- Document all modules\n- Test in dev environment first\n- Update documentation\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Issues**: Report issues via GitHub Issues\n- **Documentation**: Check the `docs/` directory\n- **Community**: Join our discussions in GitHub Discussions\n\n## Acknowledgments\n\n- Microsoft Azure documentation\n- Terraform documentation\n- Azure DevOps documentation\n- Community contributions\n\n---\n\n**Note**: This solution is provided as-is and should be thoroughly tested in your environment before production use. Always follow your organization's security and compliance requirements.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashu10dubey%2Fautomated-web-hosting-solution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashu10dubey%2Fautomated-web-hosting-solution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashu10dubey%2Fautomated-web-hosting-solution/lists"}