This week marked a pivotal moment in my DevOps journey - diving deep into yet another Public Cloud Provider a.k.a. Microsoft Azure's cloud ecosystem and tackling complex infrastructure challenges that pushed my technical skills to new heights. From deploying React applications to architecting three-tier networks along-side managing full-stack applications with databases, Week 6 delivered hands-on experience bridging the gap between theoretical knowledge and real-world production environments that too using yet another Cloud Provider other than AWS.
๐ฏ Understanding Azure's Cloud Computing Foundation ๐๏ธ
What Makes Azure Special in the Cloud Landscape?
Microsoft Azure represents one of the world's leading cloud computing platforms, offering Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) solutions. Unlike traditional on-premises infrastructure, Azure provides on-demand computing resources that scales dynamically based on application requirements & needs.
๐งต Key Azure Advantages:
- ๐ Global Infrastructure: Over 60 regions worldwide with multiple availability zones
- ๐ฐ Pay-as-you-use model: Only pay for resources consumed
- ๐ Enterprise Security: Built-in compliance and security frameworks
- ๐ Rapid Scaling: Auto-scaling capabilities for varying workloads
๐งต Azure Compute Services Ecosystem
Azure offers diverse compute options, each serving specific use cases:
Virtual Machines (IaaS)
Virtual machines provide the maximum control and flexibility, allowing complete customization of the operating system and applications. They're ideal for:
- ๐ Legacy Application Migration: Lift-and-shift scenarios
- ๐ง Custom Configurations: Specific software requirements
- ๐พ Full OS Control: Complete administrative access
App Services (PaaS)
Platform-as-a-Service offerings that abstracts infrastructure management:
- ๐ฏ Focus on Code: No requiremetnt for infrastructure management
- ๐ Auto-scaling: Built-in scaling capabilities
- ๐ก๏ธ Security Updates: Automatic patching and updates
๐ Deploying React Applications on Azure VMs ๐ป
๐งต The React Deployment Challenge
React applications require a specific deployment strategy because they're Single Page Applications (SPAs) that need proper web server configuration for client-side routing. This section demonstrates & imitates production React deployments on Azure infrastructure.
Step 1: Azure VM Provisioning
Creating an Ubuntu 24.04 LTS virtual machine involved several critical decisions:
VM Configuration Analysis:
- Size Selection: B1s (1 vCPU, 1 GB RAM) - cost-effective for learning environments
- Authentication: SSH keys provide better security than passwords
- Storage: Premium SSD for faster I/O operations
Step 2: Development Stack Installation
The deployment requires a complete development environment setup:
# System updates
sudo apt update && sudo apt upgrade -y
# Node.js 18.x LTS installation via NodeSource
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# Nginx web server installation
sudo apt install -y nginx
Step 3: React Application Build Process
Understanding the React build process is crucial for production deployments:
# Clone the application
git clone https://github.com/suvrajeetbanerjee/my-react-app.git
cd my-react-app
# Install dependencies
npm install
# Create production build
npm run build
Why Building is Essential:
- ๐ฆ Code Optimization: Minification and bundling reduce file sizes
- ๐ Performance: Optimized assets load faster
- ๐ Security: Source code is compiled and obfuscated
Step 4: Nginx Configuration for SPAs
Single Page Applications(SPA) requires special web server configuration to handle client-side routing:
server {
listen 80 default_server;
root /home/azureuser/my-react-app/build;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
Critical Configuration Elements:
- ๐ฏ try_files directive: Enables client-side routing by falling back to index.html
- ๐ root directive: Points to the React build directory
- ๐ index directive: Specifies the default file to serve
๐งต Overcoming the 500 Internal Server Error Challenge
The most valuable learning experience came from troubleshooting a critical production error. The application was built successfully, Nginx was running, but the dreaded 500 Internal Server Error appeared.
Root Cause Analysis:
# Error log investigation revealed
sudo tail -f /var/log/nginx/error.log
# Output: stat() "/home/azureuser/my-react-app/build" failed (13: Permission denied)
The Permission Problem:
Nginx runs as the www-data
user, but couldn't access files in the user's home directory due to restrictive permissions. This helps revisit concepts about Unix file permissions and web server security models.
Solution Implementation:
# Fix directory permissions
sudo chmod 755 /home
sudo chmod 755 /home/azureuser
sudo chmod 755 /home/azureuser/my-react-app
# Add www-data to user group
sudo usermod -a -G azureuser www-data
# Verify access
sudo -u www-data stat /home/azureuser/my-react-app/build
๐ก This challenge reinforces the importance of understanding Linux permissions, web server architecture, along with systematic troubleshooting approaches.
๐๏ธ Three-Tier Network Architecture with Load Balancer ๐
๐งต Understanding Network Architecture Fundamentals
Three-tier architecture represents a fundamental design pattern in enterprise applications, providing separation of concerned layers across presentation, application, and data layers.
Network Design Principles
Subnet Planning Strategy:
Azure reserves 5 IP addresses per subnet, making proper CIDR planning essential:
VNet: 10.0.0.0/16 (65,536 available addresses)
โโโ Web Subnet: 10.0.1.0/24 (251 usable addresses)
โโโ App Subnet: 10.0.2.0/25 (123 usable addresses)
โโโ DB Subnet: 10.0.3.0/26 (59 usable addresses)
Network Security Groups (NSG) Deep Dive
NSGs function as virtual firewalls, controlling traffic at the subnet and network interface level. Understanding NSG rule evaluation is crucial for security:
Rule Processing Logic:
- Priority-based: Lower numbers are processed first (100-4096)
- First Match Wins: Processing stops at first matching rule
- Default Deny: Implicit deny rules at the end
Critical NSG Best Practices:
IP Address Range Configuration:
One of the most important lessons involves NSG source IP configuration. Instead of using /32
(single IP), it's better to use /24
ranges for dynamic IP scenarios:
# Problem: Dynamic ISP IP changes break SSH access
Source: 185.43.167.32/32 # โ Breaks when ISP changes IP
# Solution: Use broader range for ISP dynamic allocation
Source: 185.43.167.0/24 # โ
Accommodates ISP IP changes
Why /24 is Superior:
- ๐ Dynamic IP Resilience: ISPs often allocate IPs within the same /24 range
- ๐ Usable Address Range: /24 provides 254 usable addresses vs. 0 for /32
- ๐ก๏ธ Operational Reliability: Reduces connection failures due to IP changes
๐ก *This insight came directly from experiencing SSH connection failures when my ISP changed my dynamic IP address.(
Azure Load Balancer Implementation
Azure Load Balancer operates at Layer 4 (TCP/UDP), distributing incoming traffic across healthy backend instances:
Load Balancer Components:
- ๐ฏ Frontend IP: Public IP address receiving traffic
- ๐ Backend Pool: Collection of VMs receiving distributed traffic
- ๐ฅ Health Probe: Monitors backend instance health
- โ๏ธ Load Balancing Rules: Defines traffic distribution logic
Health Probe Configuration:
Protocol: TCP
Port: 80
Interval: 5 seconds
Unhealthy Threshold: 2 failures
Health probes ensure traffic only routes to functional instances, providing automatic failover capabilities.
๐ EpicBook Full-Stack Application with MySQL ๐๏ธ
๐งต Full-Stack Application Architecture
The EpicBook application represents a complete three-tier architecture implementation:
- Frontend: Static files served by Nginx
- Backend: Node.js API server (port 3001)
- Database: MySQL server for data persistence
Application Deployment Strategy
Node.js Backend Configuration:
// Database connection configuration
{
"development": {
"username": "epicbooksadmin",
"password": "EBAdmn123",
"database": "bookstore",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
Nginx Reverse Proxy Setup:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# Frontend (React build)
root /home/azureuser/theepicbook/frontend/build;
index index.html;
location / {
try_files $uri /index.html;
}
# Backend API proxy (change 3001 if your backend uses a different port)
location /api/ {
proxy_pass http://127.0.0.1:3001/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Connection "";
}
}
MySQL Database Management
Database Setup Process:
# MySQL security configuration
sudo mysql_secure_installation
# Database and user creation
mysql -u root -p
CREATE DATABASE bookstore;
CREATE USER 'epicbooksadmin'@'localhost' IDENTIFIED BY 'EBAdmn123';
GRANT ALL PRIVILEGES ON bookstore.* TO 'epicbooksadmin'@'localhost';
FLUSH PRIVILEGES;
Azure MySQL Flexible Server Challenge
A significant learning experience involved attempting to deploy Azure Database for MySQL Flexible Server. Despite extensive troubleshooting, I encountered persistent provisioning errors:
Error Encountered:
Code="ProvisionNotSupportedForRegion"
Message="Provisioning in requested region is not supported."
Root Cause Analysis:
The issue stemmed from Azure free tier limitations and regional restrictions for MySQL Flexible Server resources. Even after 30+ hours of debugging and submitting support tickets, the service remained unavailable.
Solution Adaptation:
Instead of abandoning the project, I pivoted to installing MySQL directly on the VM:
# Local MySQL installation
sudo apt install -y mysql-server mysql-client
sudo systemctl start mysql
sudo systemctl enable mysql
This challenge taught valuable lessons about:
- ๐ Solution Adaptability: Finding alternatives when cloud services aren't available
- ๐ ๏ธ Local vs. Managed Services: Trade-offs between convenience and control
- ๐ฐ Cost Management: Understanding service limitations in free tiers
๐ Security and Best Practices Reflections ๐ก๏ธ
๐งต Network Security Implementation
NSG Rule Optimization:
- โ Principle of Least Privilege: Only open required ports
- ๐ฏ Source Restriction: Use specific IP ranges instead of "Any"
- ๐ Rule Documentation: Clear naming conventions for maintainability
SSH Key Management:
- ๐ Key-based Authentication: More secure than passwords
- ๐ก๏ธ Proper Permissions:
chmod 400
for private keys - ๐ Key Rotation: Regular key updates for enhanced security
Application Security Considerations
File Permissions Management:
Understanding Unix permissions is crucial for web application deployment:
- ๐ Directory Permissions:
755
allows read/execute access - ๐ File Permissions:
644
provides read access for web servers - ๐ฅ Group Management: Adding web server users to appropriate groups
๐ฐ Cost Management and Resource Optimization ๐ก
๐งต Azure Cost Control Strategies
Resource Lifecycle Management:
- ๐๏ธ Immediate Cleanup: Delete resources after testing
- ๐ Resource Monitoring: Use Azure Cost Management tools
- โฐ Scheduled Shutdowns: Auto-shutdown for non-production VMs
Cost-Effective Configurations:
- ๐ป VM Sizing: B1s instances for learning environments
- ๐พ Storage Optimization: Standard SSD instead of Premium when appropriate
- ๐ Region Selection: Choose regions with lower pricing
Resource Group Strategy
Using resource groups effectively enables:
- ๐งน Bulk Deletion: Remove all related resources simultaneously
- ๐ท๏ธ Cost Tracking: Monitor spending by project or environment
- ๐ Access Control: Apply RBAC policies consistently
๐ง Troubleshooting Methodologies Developed ๐
๐งต Systematic Problem-Solving Approach
1. Error Log Analysis:
# Nginx error logs
sudo tail -f /var/log/nginx/error.log
# System logs
sudo journalctl -u nginx -f
# Application logs
node server.js 2>&1 | tee app.log
2. Network Connectivity Testing:
# Test local connectivity
curl http://localhost
# Test external access
curl http://VM-PUBLIC-IP
# Port availability check
netstat -tlnp | grep :80
3. Permission Verification:
# Test file access as web server user
sudo -u www-data stat /path/to/files
# Verify directory permissions
ls -la /home/azureuser/
๐ Key Learning Outcomes for Technical Growth ๐
๐งต Infrastructure Skills Acquired
Azure Platform Mastery:
- โ๏ธ Resource Management: Creating and configuring VMs, NSGs, Load Balancers
- ๐ Network Architecture: Three-tier design patterns and security groups
- ๐ง Service Integration: Connecting multiple Azure services effectively
Linux System Administration:
- ๐ฅ๏ธ Server Management: Package installation, service configuration
- ๐ Permission Management: Unix file permissions and user groups
- ๐ Troubleshooting: Log analysis and systematic problem resolution
Application Deployment Expertise
Web Server Configuration:
- ๐ Nginx Mastery: Reverse proxy setup, static file serving
- โ๏ธ Process Management: Service startup, monitoring, and debugging
- ๐ง Performance Optimization: Gzip compression, caching strategies & PM2 (production-ready process manager for Node.js applications.
Database Integration:
- ๐๏ธ MySQL Administration: Installation, user management, security
- ๐ Application Connectivity: Database connection configuration
- ๐ ๏ธ Troubleshooting: Connection issues and permission problems
DevOps Practices Internalized
Infrastructure as Code Mindset:
- ๐ Documentation: Comprehensive step-by-step procedures
- ๐ Reproducibility: Scripted deployments and configurations
- ๐งน Resource Management: Proper cleanup and cost control
๐ฎ Next Steps and Advanced Concepts ๐
๐งต Upcoming Learning Objectives
Based on this week's foundation, the next learning phase will focus on:
Automation and Orchestration:
- ๐ค Infrastructure as Code: ARM templates and Terraform
- ๐ CI/CD Pipelines: Azure DevOps and GitHub Actions
- ๐ณ Containerization: Docker and Azure Container Instances
Advanced Networking:
- ๐ Virtual Network Peering: Cross-region connectivity
- ๐ก๏ธ Azure Firewall: Advanced threat protection
- ๐ Network Monitoring: Traffic analysis and optimization
Scalability and Performance:
- ๐ Auto-scaling: VM Scale Sets and Application Gateway
- ๐พ Caching Strategies: Redis and CDN implementation
- ๐ Monitoring: Application Insights and Azure Monitor
๐งต Production Readiness Considerations
Security Enhancements:
- ๐ Key Vault Integration: Secure secret management
- ๐ SSL/TLS Configuration: HTTPS implementation
- ๐ก๏ธ WAF Deployment: Web Application Firewall protection
High Availability Design:
- ๐ Multi-Region Deployment: Geographic redundancy
- ๐พ Database Replication: Master-slave configurations
- ๐ Backup Strategies: Automated backup and recovery
๐ Conclusion: Building Production-Ready Skills ๐ช
Week 6 of the DevOps journey provided invaluable hands-on experience with Microsoft Azure's cloud ecosystem. From deploying React applications to architecting three-tier networks & managing full-stack applications with databases โ each blogs, documentations & posts that builds upon previous knowledge while introducing new challenges building an unshakeable foundation.
The most significant learning came not from successful deployments, but from overcoming obstacles like permission issues, MySQL service limitations, and network configuration challenges. These real-world problems teaches systematic troubleshooting approaches, adaptability, and the importance of understanding underlying infrastructure concepts.
Key Takeaways:
- ๐ฏ Practical Experience: Hands-on learning beats theoretical knowledge
- ๐ Problem-Solving: Systematic approaches to complex issues
- ๐ Documentation: Detailed records enable knowledge retention
- ๐ฐ Cost Awareness: Cloud resource management is crucial
- ๐ Security First: Proper configuration prevents vulnerabilities
๐ฏ This blog marks the end of Week 6 of 12 of the free DevOps cohort organized by Pravin Mishra sir ๐, building upon ๐๏ธ Infrastructure as Code Mastery: From Manual Chaos to CloudFormation Symphony [Week-5]โ๏ธโก from the DevOps Series โ documenting my complete leanring journey from fundamentals to advanced implementations.
๐ You can start your DevOps journey for free from Pravin's comprehensive YouTube Playlist.
๐ท๏ธ Tags:
#Azure
#DevOps
#MySQL
#CloudComputing
#ProblemSolving
#NodeJS
#WebDevelopment
#CloudArchitecture
#TechnicalChallenges
#LearningJourney
#DatabaseManagement
#CloudSolutions
#TechStruggles
#DevOpsCommunity
#Networking
#VirtualMachines
#React
#TechnicalLearning
#CloudSecurity
#LoadBalancers
#NSG
#SystemAdministration
#ProfessionalDevelopment
#TechSkills
#ContinuousLearning
#CloudArchitecture
Top comments (0)