WebNest
Team/Md Arif Hossain/devops-learning-multicloud

Repository

devops-learning-multicloud

Production-grade DevOps setup for AWS, Azure, GCP, and Oracle Cloud with auto-scaling, monitoring, and cost optimization.

View on GitHub ↗
HCL0 stars0 forks

README

Complete Multi-Cloud DevOps Learning Project

Production-grade DevOps setup for AWS, Azure, GCP, and Oracle Cloud with auto-scaling, monitoring, and cost optimization.

CI Status

  • GitHub Actions: Build/Test and Security workflows available in the Actions tab
  • GitLab CI: Pipelines visible in your project’s CI/CD → Pipelines
  • Bitbucket Pipelines: Pipelines dashboard in the Bitbucket repository

🎯 Project Overview

This comprehensive DevOps learning project demonstrates production-ready infrastructure across multiple cloud providers with:

  • Multi-Cloud Support: AWS, Azure, GCP, Oracle Cloud
  • Container Orchestration: Kubernetes (EKS, AKS, GKE, OKE)
  • Infrastructure as Code: Terraform modules for all clouds
  • Configuration Management: Ansible playbooks and roles
  • Monitoring Stack: Prometheus, Grafana, Loki, AlertManager
  • Service Mesh: Consul, Istio, Linkerd
  • Container Registry: Harbor
  • Auto-Scaling: HPA, VPA, KEDA, Cluster Autoscaler
  • Load Testing: JMeter test plans and scenarios
  • CI/CD: GitHub Actions, GitLab CI, Jenkins, ArgoCD
  • Cost Optimization: Resource quotas, spot instances, right-sizing

🏗️ Architecture

Application Stack

  • Backend: NestJS (Node.js) API with TypeScript
  • Cache: Redis for session and data caching
  • Monitoring: Prometheus metrics, Grafana dashboards
  • Logging: Loki with Promtail
  • Service Discovery: Consul

Infrastructure Components

  • Compute: Kubernetes clusters with auto-scaling node groups
  • Networking: VPC/VNet with public/private subnets
  • Storage: Persistent volumes, object storage (S3/Blob/GCS)
  • Database: Managed databases (RDS/Azure SQL/Cloud SQL)
  • Load Balancing: Cloud-native load balancers
  • DNS: Route53/Azure DNS/Cloud DNS
  • Container Registry: ECR/ACR/GCR + Harbor

📋 Prerequisites

Required Tools

# Cloud CLIs
- AWS CLI v2
- Azure CLI
- gcloud CLI
- OCI CLI

# Infrastructure Tools
- Terraform >= 1.6
- Ansible >= 2.15
- kubectl >= 1.28
- Helm >= 3.12

# Container Tools
- Docker >= 24.0
- docker-compose >= 2.20

# Development Tools
- Node.js >= 18
- npm >= 9
- Git

# Testing Tools
- JMeter >= 5.6

🚀 Quick Start

1. Clone and Setup

git clone <repository-url>
cd devops-learning-multicloud

# Install prerequisites
make install-prerequisites

# Setup cloud credentials
./scripts/setup/setup-cloud-credentials.sh

2. Choose Your Cloud

AWS Deployment

# Initialize Terraform
cd terraform/aws
terraform init
terraform plan -var-file=environments/dev/terraform.tfvars
terraform apply -auto-approve

# Deploy application
cd ../../ansible
ansible-playbook -i inventory/aws/hosts.yml playbooks/aws/deploy-eks-app.yml

# Run load tests
cd ../jmeter
./scripts/run-load-test.sh --cloud aws --duration 300

Azure Deployment

# Initialize Terraform
cd terraform/azure
terraform init
terraform plan -var-file=environments/dev/terraform.tfvars
terraform apply -auto-approve

# Deploy application
cd ../../ansible
ansible-playbook -i inventory/azure/hosts.yml playbooks/azure/deploy-aks-app.yml

# Run load tests
cd ../jmeter
./scripts/run-load-test.sh --cloud azure --duration 300

GCP Deployment

# Initialize Terraform
cd terraform/gcp
terraform init
terraform plan -var-file=environments/dev/terraform.tfvars
terraform apply -auto-approve

# Deploy application
cd ../../ansible
ansible-playbook -i inventory/gcp/hosts.yml playbooks/gcp/deploy-gke-app.yml

# Run load tests
cd ../jmeter
./scripts/run-load-test.sh --cloud gcp --duration 300

Oracle Cloud Deployment

# Initialize Terraform
cd terraform/oracle-cloud
terraform init
terraform plan -var-file=environments/dev/terraform.tfvars
terraform apply -auto-approve

# Deploy application
cd ../../ansible
ansible-playbook -i inventory/oracle/hosts.yml playbooks/oracle/deploy-oke-app.yml

# Run load tests
cd ../jmeter
./scripts/run-load-test.sh --cloud oracle --duration 300

3. Local Development

# Start local environment
cd docker
docker compose up -d

# Access services
# API: http://localhost:3000
# Swagger: http://localhost:3000/api-docs
# Grafana: http://localhost:3001 (admin/admin123)
# Prometheus: http://localhost:9090

# View logs
docker compose logs -f nestjs-app

📊 Monitoring & Observability

Access Dashboards

# Port forward to Grafana
kubectl port-forward -n monitoring svc/grafana 3000:80

# Port forward to Prometheus
kubectl port-forward -n monitoring svc/prometheus 9090:9090

# Access Grafana
open http://localhost:3000

Available Dashboards

  • Kubernetes Cluster Overview
  • Application Metrics
  • Auto-Scaling Metrics
  • Cost Optimization
  • Redis Performance
  • Consul Service Mesh
  • Cloud-specific dashboards (CloudWatch, Azure Monitor, etc.)

🔧 Configuration

Environment Variables

Copy and customize environment files:

# Application
cp app/nestjs-api/.env.example app/nestjs-api/.env

# Cloud-specific
cp configs/env-templates/.env.aws.example configs/.env.aws
cp configs/env-templates/.env.azure.example configs/.env.azure
cp configs/env-templates/.env.gcp.example configs/.env.gcp
cp configs/env-templates/.env.oracle.example configs/.env.oracle

Terraform Variables

# Copy and customize for each cloud
cp terraform/aws/terraform.tfvars.example terraform/aws/terraform.tfvars
cp terraform/azure/terraform.tfvars.example terraform/azure/terraform.tfvars
cp terraform/gcp/terraform.tfvars.example terraform/gcp/terraform.tfvars
cp terraform/oracle-cloud/terraform.tfvars.example terraform/oracle-cloud/terraform.tfvars

🧪 Testing

Load Testing

# Basic load test
./jmeter/scripts/run-load-test.sh --cloud aws

# Stress test
./jmeter/scripts/run-stress-test.sh --cloud aws --users 1000

# Run all tests
./jmeter/scripts/run-all-tests.sh

Application Tests

cd app/nestjs-api

# Unit tests
npm test

# E2E tests
npm run test:e2e

# Coverage
npm run test:cov

📈 Auto-Scaling Scenarios

Horizontal Pod Autoscaling (HPA)

# Watch HPA in action
kubectl get hpa -n app -w

# Generate load
./jmeter/scripts/run-load-test.sh --duration 600 --rampup 60

Cluster Autoscaling

# Watch nodes scale
kubectl get nodes -w

# Deploy resource-intensive workload
kubectl apply -f kubernetes/autoscaling/cluster-autoscaler.yaml

KEDA Event-Driven Autoscaling

# Deploy KEDA scaler
kubectl apply -f kubernetes/autoscaling/keda-scaledobject.yaml

# Monitor scaling based on Redis queue length
kubectl get scaledobject -n app -w

💰 Cost Optimization

View Cost Reports

# Generate cost report for all clouds
./scripts/cost-optimization/cost-report.py

# Analyze resource usage
./scripts/cost-optimization/analyze-costs.sh

# Right-size recommendations
./scripts/cost-optimization/right-sizing.py

Cost Saving Features

  • Spot/Preemptible instances for non-critical workloads
  • Auto-scaling based on load (scale to zero when idle)
  • Resource quotas and limits
  • Lifecycle policies for logs and images
  • Reserved instances for production workloads

📚 Documentation

Learning Paths

  1. Getting Started
  2. Docker Basics
  3. Kubernetes Fundamentals
  4. Terraform Infrastructure
  5. Ansible Configuration
  6. Monitoring Setup
  7. Auto-Scaling Guide
  8. Cost Optimization
  9. CI/CD Pipelines

Architecture Diagrams

Runbooks

🔒 Security

Security Features

  • Network policies for pod-to-pod communication
  • Pod Security Policies (PSP) / Pod Security Standards (PSS)
  • RBAC for least-privilege access
  • Secrets encryption at rest
  • TLS for all external communications
  • Container image scanning with Harbor
  • Security groups / Firewall rules

Security Scanning

# Scan Docker images
docker scan nestjs-app:latest

# Audit Kubernetes manifests
kubectl audit

# Check for vulnerabilities
./scripts/security/security-scan.sh

🛠️ Makefile Commands

# Installation
make install-prerequisites  # Install all required tools
make install-aws           # Setup AWS CLI and tools
make install-azure         # Setup Azure CLI and tools
make install-gcp           # Setup GCP CLI and tools
make install-oracle        # Setup OCI CLI and tools

# Development
make dev                   # Start local development environment
make build                 # Build Docker images
make test                  # Run all tests
make lint                  # Run linters

# Deployment
make deploy-aws            # Deploy to AWS
make deploy-azure          # Deploy to Azure
make deploy-gcp            # Deploy to GCP
make deploy-oracle         # Deploy to Oracle Cloud
make deploy-all            # Deploy to all clouds

# Operations
make status                # Check deployment status
make logs                  # View application logs
make shell                 # Open shell in running container
make port-forward          # Port forward to services

# Monitoring
make dashboard             # Open Grafana dashboard
make metrics               # View Prometheus metrics
make alerts                # Check active alerts

# Cleanup
make clean                 # Clean local artifacts
make destroy-aws           # Destroy AWS infrastructure
make destroy-azure         # Destroy Azure infrastructure
make destroy-gcp           # Destroy GCP infrastructure
make destroy-oracle        # Destroy Oracle Cloud infrastructure
make destroy-all           # Destroy all cloud infrastructure

🤝 Contributing

This is a learning project. Feel free to:

  1. Fork the repository
  2. Experiment with configurations
  3. Add new cloud providers
  4. Improve documentation
  5. Share your learnings

📝 License

MIT License - Feel free to use this for learning and educational purposes.

🎓 Learning Objectives

After completing this project, you will understand:

  1. Multi-Cloud Infrastructure

    • Provisioning resources across different cloud providers
    • Cloud-specific services and their equivalents
    • Multi-cloud networking and connectivity
  2. Container Orchestration

    • Kubernetes architecture and components
    • Pod scheduling and resource management
    • Service discovery and load balancing
    • Storage and persistent volumes
  3. Infrastructure as Code

    • Terraform modules and state management
    • Cloud provider-specific resources
    • Best practices for IaC
  4. Configuration Management

    • Ansible playbooks and roles
    • Inventory management
    • Idempotent configuration
  5. Monitoring & Observability

    • Metrics collection with Prometheus
    • Log aggregation with Loki
    • Visualization with Grafana
    • Alerting strategies
  6. Auto-Scaling

    • Horizontal Pod Autoscaling (HPA)
    • Vertical Pod Autoscaling (VPA)
    • Cluster Autoscaling
    • Event-driven autoscaling with KEDA
  7. Cost Optimization

    • Resource right-sizing
    • Spot/Preemptible instances
    • Auto-scaling for cost reduction
    • Cost monitoring and reporting
  8. CI/CD Pipelines

    • Automated testing and deployment
    • GitOps with ArgoCD
    • Multi-stage deployments
    • Rollback strategies
  9. Security

    • Network policies
    • RBAC and access control
    • Secrets management
    • Container security
  10. Load Testing

    • Performance testing with JMeter
    • Stress and endurance testing
    • Analyzing bottlenecks
    • Capacity planning

📞 Support & Resources

Cloud Provider Documentation

Tool Documentation

🎯 Next Steps

  1. Start with local development using Docker Compose
  2. Deploy to a single cloud (AWS recommended for free tier)
  3. Implement monitoring and dashboards
  4. Run load tests and observe auto-scaling
  5. Explore cost optimization techniques
  6. Expand to other cloud providers
  7. Implement CI/CD pipelines
  8. Add advanced features (service mesh, security scanning)

Happy Learning! 🚀

OIDC Cloud Auth Examples

Use short-lived identity tokens from your CI provider instead of long-lived static secrets.

  • AWS (GitHub): configure an IAM role with trust to token.actions.githubusercontent.com and aud=sts.amazonaws.com, then in workflows use aws-actions/configure-aws-credentials@v4 with role-to-assume.
  • Azure (GitHub/GitLab): create a Federated Credential on the Azure AD app (issuer = your CI OIDC, subject = repo/ref) and use azure/login@v2 (GitHub) or az login --federated-token (GitLab).
  • GCP (GitHub/GitLab): set up a Workload Identity Pool + Provider; bind a service account to trust the provider; use google-github-actions/auth@v2 (GitHub) or OIDC cred-file with gcloud.
← Back to profile