diff --git a/ARGOCD-SYNC-GUIDE.md b/ARGOCD-SYNC-GUIDE.md new file mode 100644 index 000000000..37eaa77a3 --- /dev/null +++ b/ARGOCD-SYNC-GUIDE.md @@ -0,0 +1,267 @@ +# πŸ”„ ArgoCD Sync Guide + +## Why Changes Don't Reflect Immediately + +ArgoCD checks your Git repository for changes every **3 minutes** by default. This is normal behavior! + +--- + +## ⚑ Quick Sync (Force Immediate Update) + +### Option 1: Use the Script (Recommended) +```powershell +.\sync-argocd.ps1 +``` + +This will: +1. List all applications +2. Force refresh each application +3. Show current sync status + +--- + +### Option 2: Manual Refresh via kubectl + +**Refresh all applications:** +```bash +kubectl patch application retail-store-ui -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +kubectl patch application retail-store-catalog -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +kubectl patch application retail-store-cart -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +kubectl patch application retail-store-checkout -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +kubectl patch application retail-store-orders -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +``` + +**Or refresh a specific application:** +```bash +kubectl patch application retail-store-ui -n argocd --type merge -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' +``` + +--- + +### Option 3: Use ArgoCD UI + +**Step 1:** Start port forwarding +```bash +kubectl port-forward svc/argocd-server -n argocd 8080:80 +``` + +**Step 2:** Open browser to http://localhost:8080 + +**Step 3:** Login with: +- Username: `admin` +- Password: Get it with: + ```bash + kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d + ``` + +**Step 4:** Click on an application and click "REFRESH" or "SYNC" + +--- + +## πŸ” Check Sync Status + +### View all applications +```bash +kubectl get applications -n argocd +``` + +### View detailed status +```bash +kubectl get application retail-store-ui -n argocd -o yaml +``` + +### Check last sync time +```bash +kubectl get applications -n argocd -o custom-columns=NAME:.metadata.name,SYNC:.status.sync.status,HEALTH:.status.health.status,LAST-SYNC:.status.operationState.finishedAt +``` + +--- + +## ⏱️ Understanding ArgoCD Sync Behavior + +### Automatic Sync (Enabled) +Your applications have `automated: true` which means: +- βœ… ArgoCD checks Git every **3 minutes** +- βœ… Automatically syncs when changes are detected +- βœ… `selfHeal: true` - fixes drift if someone manually changes resources +- βœ… `prune: true` - removes resources deleted from Git + +### Sync Frequency +Default: **3 minutes** + +To change this, you would need to modify ArgoCD's ConfigMap: +```bash +kubectl edit configmap argocd-cm -n argocd +``` + +Add: +```yaml +data: + timeout.reconciliation: 60s # Check every 60 seconds +``` + +--- + +## πŸ“‹ Complete Workflow + +### 1. Make Changes to Code +```bash +# Edit files +vim src/ui/chart/values.yaml +``` + +### 2. Commit and Push +```bash +git add . +git commit -m "Update UI configuration" +git push origin gitops +``` + +### 3. Force Sync (Optional - for immediate update) +```powershell +.\sync-argocd.ps1 +``` + +### 4. Verify Changes +```bash +# Check application status +kubectl get applications -n argocd + +# Check pods +kubectl get pods -n retail-store + +# Check if new version is deployed +kubectl describe pod -n retail-store | grep Image +``` + +--- + +## πŸ› Troubleshooting + +### Application shows "OutOfSync" +This is normal! It means ArgoCD detected changes but hasn't synced yet. + +**Solution:** Wait 3 minutes or force sync: +```powershell +.\sync-argocd.ps1 +``` + +### Application shows "Unknown" or "Progressing" +The application is being deployed. + +**Check status:** +```bash +kubectl get pods -n retail-store +kubectl logs -n retail-store +``` + +### Application shows "Degraded" or "Failed" +There's an issue with the deployment. + +**Check details:** +```bash +kubectl get application retail-store-ui -n argocd -o yaml +kubectl describe pod -n retail-store +kubectl logs -n retail-store +``` + +### Changes not appearing after 5+ minutes +**Check if commit was pushed:** +```bash +git log --oneline -5 +git status +``` + +**Check ArgoCD is watching correct branch:** +```bash +kubectl get application retail-store-ui -n argocd -o yaml | grep -A 5 "source:" +``` + +Should show: +```yaml +source: + repoURL: https://github.com/bashairfan0911/retail-store-sample-app + targetRevision: gitops + path: src/ui/chart +``` + +--- + +## 🎯 Best Practices + +### 1. Always Push to Git First +```bash +git push origin gitops +``` + +### 2. Wait or Force Sync +Either: +- Wait 3 minutes for auto-sync +- Or run: `.\sync-argocd.ps1` + +### 3. Verify Deployment +```bash +kubectl get pods -n retail-store +kubectl get applications -n argocd +``` + +### 4. Check Logs if Issues +```bash +kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=50 +``` + +--- + +## πŸ“Š Monitoring ArgoCD + +### Watch for changes in real-time +```bash +watch -n 5 kubectl get applications -n argocd +``` + +### View ArgoCD logs +```bash +kubectl logs -n argocd -l app.kubernetes.io/name=argocd-server --tail=100 -f +``` + +### View repo-server logs (Git sync) +```bash +kubectl logs -n argocd -l app.kubernetes.io/name=argocd-repo-server --tail=100 -f +``` + +--- + +## πŸš€ Quick Reference + +| Action | Command | +|--------|---------| +| **Force sync all** | `.\sync-argocd.ps1` | +| **Check status** | `kubectl get applications -n argocd` | +| **View details** | `kubectl get application -n argocd -o yaml` | +| **Access UI** | `kubectl port-forward svc/argocd-server -n argocd 8080:80` | +| **Get password** | `kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' \| base64 -d` | + +--- + +## πŸ’‘ Pro Tips + +1. **Use the sync script after every push:** + ```bash + git push origin gitops && .\sync-argocd.ps1 + ``` + +2. **Create an alias:** + ```bash + # Add to your PowerShell profile + function Sync-ArgoCD { .\sync-argocd.ps1 } + Set-Alias -Name argocd-sync -Value Sync-ArgoCD + ``` + +3. **Monitor in ArgoCD UI:** + - Keep ArgoCD UI open in browser + - Watch real-time sync status + - See detailed deployment logs + +--- + +**Remember:** ArgoCD auto-sync is working! It just takes up to 3 minutes. Use the sync script for immediate updates! πŸš€ diff --git a/BRANCHING_STRATEGY.md b/BRANCHING_STRATEGY.md new file mode 100644 index 000000000..1d54ee1f6 --- /dev/null +++ b/BRANCHING_STRATEGY.md @@ -0,0 +1,347 @@ +# Branching Strategy & GitOps Workflow + +This document explains the advanced branching strategy and GitOps workflow implemented in this retail store sample application. + +## πŸ“‹ Table of Contents + +- [Branch Architecture](#branch-architecture) +- [Public Application (Main Branch)](#public-application-main-branch) +- [Production (GitOps Branch)](#production-gitops-branch) +- [GitHub Actions Setup](#github-actions-setup) +- [Deployment Workflows](#deployment-workflows) +- [Infrastructure Components](#infrastructure-components) +- [Troubleshooting](#troubleshooting) +- [Development Workflow](#development-workflow) + +## πŸ—οΈ Branch Architecture + +This repository implements a **dual-branch GitOps strategy** designed for different deployment scenarios with clear separation between simple public deployments and production-ready automated workflows. + +```mermaid +graph LR + A[Developer] --> B[Code Changes] + B --> C{Target Branch?} + C -->|Simple Deployment| D[main branch] + C -->|Production| E[gitops branch] + + D --> F[Manual Deployment] + D --> G[Public ECR Images] + D --> H[Umbrella Chart] + + E --> I[GitHub Actions] + E --> J[Private ECR Images] + E --> K[Individual Apps] + + I --> L[Build & Push] + L --> M[Update Helm Charts] + M --> N[ArgoCD Sync] +``` + +## 🌐 Public Application (Main Branch) + +### **Purpose** +Simple deployment with public container images for demos, learning, and quick testing. + +### **Characteristics** +```yaml +βœ… Branch: main +βœ… Images: Public ECR (stable versions) +βœ… Deployment: Manual Helm chart management +βœ… ArgoCD: Umbrella chart (retail-store-app) +βœ… Workflows: None (no .github/workflows/) +βœ… Updates: Manual only +βœ… Target: Demos, learning, simple deployments +``` + +### **Image Configuration** +```yaml +# All services use public ECR images +ui: public.ecr.aws/aws-containers/retail-store-sample-ui:1.2.2 +catalog: public.ecr.aws/aws-containers/retail-store-sample-catalog:1.2.2 +cart: public.ecr.aws/aws-containers/retail-store-sample-cart:1.2.2 +checkout: public.ecr.aws/aws-containers/retail-store-sample-checkout:1.2.2 +orders: public.ecr.aws/aws-containers/retail-store-sample-orders:1.2.2 + +# Infrastructure components +mysql: public.ecr.aws/docker/library/mysql:8.0 +redis: public.ecr.aws/docker/library/redis:6.0-alpine +postgresql: public.ecr.aws/docker/library/postgres:13 +rabbitmq: public.ecr.aws/docker/library/rabbitmq:3.8-management +dynamodb-local: public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:1.25.1 +``` + +### **ArgoCD Configuration** +```yaml +# Uses umbrella chart for simplified management +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: retail-store-app +spec: + source: + targetRevision: main + path: src/app/chart +``` + +## 🏭 Production (GitOps Branch) + +### **Purpose** +Full production workflow with automated CI/CD pipeline and private container registry integration. + +### **Characteristics** +```yaml +βœ… Branch: gitops +βœ… Images: Private ECR (auto-updated) +βœ… Deployment: Automated via GitHub Actions +βœ… ArgoCD: Individual service applications +βœ… Workflows: Full CI/CD pipeline (.github/workflows/) +βœ… Updates: Automatic on code changes +βœ… Target: Production environments, enterprise deployments +``` + +### **Image Configuration** +```yaml +# Services use private ECR (updated by workflow) +ui: {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/retail-store-ui:{COMMIT_HASH} +catalog: {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/retail-store-catalog:{COMMIT_HASH} +cart: {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/retail-store-cart:{COMMIT_HASH} +checkout: {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/retail-store-checkout:{COMMIT_HASH} +orders: {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/retail-store-orders:{COMMIT_HASH} + +# Infrastructure components (same as main - preserved by workflow) +mysql: public.ecr.aws/docker/library/mysql:8.0 +redis: public.ecr.aws/docker/library/redis:6.0-alpine +postgresql: public.ecr.aws/docker/library/postgres:13 +rabbitmq: public.ecr.aws/docker/library/rabbitmq:3.8-management +dynamodb-local: public.ecr.aws/aws-dynamodb-local/aws-dynamodb-local:1.25.1 +``` + +### **ArgoCD Configuration** +```yaml +# Uses individual applications for granular control +- retail-store-ui +- retail-store-catalog +- retail-store-cart +- retail-store-checkout +- retail-store-orders + +# Each points to gitops branch +spec: + source: + targetRevision: gitops +``` + +## πŸ”§ GitHub Actions Setup + +### **Required Secrets** +Configure these secrets in your GitHub repository settings: + +| Secret Name | Description | Example | +|-------------|-------------|---------| +| `AWS_ACCESS_KEY_ID` | AWS Access Key for ECR/EKS access | `AKIA...` | +| `AWS_SECRET_ACCESS_KEY` | AWS Secret Key | `wJalrXUt...` | +| `AWS_REGION` | AWS Region for resources | `us-west-2` | +| `AWS_ACCOUNT_ID` | AWS Account ID for ECR URLs | `123456789012` | + +### **IAM Permissions Required** +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ecr:GetAuthorizationToken", + "ecr:BatchCheckLayerAvailability", + "ecr:GetDownloadUrlForLayer", + "ecr:BatchGetImage", + "ecr:InitiateLayerUpload", + "ecr:UploadLayerPart", + "ecr:CompleteLayerUpload", + "ecr:PutImage", + "ecr:CreateRepository", + "ecr:DescribeRepositories" + ], + "Resource": "*" + } + ] +} +``` + +## πŸ”„ Deployment Workflows + +### **Public Application Workflow** +```bash +1. Developer commits to main branch +2. Manual deployment required +3. Uses stable public images +4. ArgoCD syncs umbrella chart +5. All services deployed together +``` + +### **Production Workflow** +```bash +1. Developer commits to gitops branch (src/ directory) +2. GitHub Actions detects changes +3. Builds only changed services +4. Pushes images to private ECR +5. Updates Helm chart values with new image tags +6. Commits changes back to gitops branch +7. ArgoCD syncs individual applications +8. Only changed services are redeployed +``` + +### **Change Detection Logic** +```yaml +# Only builds services with actual code changes +Changed files in src/ui/ β†’ Build ui service +Changed files in src/catalog/ β†’ Build catalog service +Changed files in src/cart/ β†’ Build cart service +Changed files in src/checkout/ β†’ Build checkout service +Changed files in src/orders/ β†’ Build orders service + +# Manual trigger builds all services +workflow_dispatch β†’ Build all services +``` + +## πŸ—οΈ Infrastructure Components + +### **Service Images vs Infrastructure Images** + +#### **Service Images (Updated by Workflow)** +- **ui, catalog, cart, checkout, orders** - Application services +- **Source**: Private ECR repositories +- **Updates**: Automated via GitHub Actions +- **Versioning**: Git commit hash (7 characters) + +#### **Infrastructure Images (Preserved by Workflow)** +- **mysql, redis, postgresql, rabbitmq, dynamodb-local** - Database/messaging +- **Source**: Public ECR/Docker Hub +- **Updates**: Manual only (stable versions) +- **Versioning**: Semantic versioning + +### **Workflow Protection Logic** +```bash +# AWK script ensures only main service image is updated +/^image:/ { in_main_image = 1 } # Target first image: section only +in_main_image && /repository:/ && !updated_repo { + # Update only if we haven't updated repository yet +} +/^[a-zA-Z]/ && !/^image:/ { in_main_image = 0 } # Exit image section +``` + +## πŸ”§ Troubleshooting + +### **SharedResourceWarning in ArgoCD** +```yaml +# Problem: Same resources deployed by multiple applications +Error: ClusterIssuer/letsencrypt-prod is part of applications argocd/retail-store-app and retail-store-ui + +# Solution: Use only one deployment method per branch +Public Application branch: Use umbrella chart only +Production branch: Use individual applications only +``` + +### **Image Pull Errors** +```yaml +# Problem: Wrong ECR repository or missing images +Error: Failed to pull image "123456789012.dkr.ecr.us-west-2.amazonaws.com/retail-store-ui:abc1234" + +# Solutions: +1. Check ECR repository exists (workflow creates automatically) +2. Verify AWS credentials have ECR permissions +3. Ensure image was built and pushed successfully +4. Check GitHub Actions logs for build failures +``` + +### **Workflow Not Triggering** +```yaml +# Problem: GitHub Actions not running on commits +# Solutions: +1. Ensure changes are in src/ directory +2. Check branch is 'gitops' +3. Verify GitHub Actions is enabled +4. Check workflow file syntax (.github/workflows/deploy.yml) +``` + +### **Infrastructure Images Being Overwritten** +```yaml +# Problem: MySQL/Redis images pointing to private ECR +# Solution: Workflow should preserve infrastructure images +# Check: AWK script in deploy.yml targets only main service image +``` + +## πŸ‘¨β€πŸ’» Development Workflow + +### **For Public Application Changes (Main Branch)** +```bash +1. git checkout main +2. Make changes to application code +3. Update Helm chart values manually if needed +4. git commit && git push origin main +5. Deploy manually or let ArgoCD sync +``` + +### **For Production Changes (GitOps Branch)** +```bash +1. git checkout gitops +2. Make changes to application code in src/ directory +3. git commit && git push origin gitops +4. GitHub Actions automatically: + - Builds changed services + - Updates Helm charts + - Commits changes back +5. ArgoCD automatically syncs changes +``` + +### **Switching Between Branches** +```bash +# To use main branch (public application) +kubectl delete -f argocd/applications/ -n argocd # Remove production apps +git checkout main +kubectl apply -f argocd/applications/retail-store-app.yaml -n argocd + +# To use gitops branch (production) +kubectl delete application retail-store-app -n argocd # Remove umbrella app +git checkout gitops +kubectl apply -f argocd/applications/ -n argocd # Apply individual apps +``` + +## πŸ“Š Branch Comparison + +| Feature | Public Application (Main) | Production (GitOps) | +|---------|---------------------------|---------------------| +| **Target Environment** | Demos, Learning | Production | +| **Image Source** | Public ECR | Private ECR | +| **Image Updates** | Manual | Automated | +| **Deployment Method** | Umbrella Chart | Individual Apps | +| **CI/CD Pipeline** | None | GitHub Actions | +| **Change Detection** | Manual | Automatic | +| **Rollback Strategy** | Manual | Git revert | +| **Infrastructure Images** | Public (stable) | Public (preserved) | +| **Service Images** | Public (stable) | Private (dynamic) | + +## 🎯 Best Practices + +### **When to Use Public Application (Main Branch)** +- βœ… Demos and presentations +- βœ… Learning and experimentation +- βœ… Quick testing and prototyping +- βœ… Simple deployments without CI/CD needs + +### **When to Use Production (GitOps Branch)** +- βœ… Production deployments +- βœ… Enterprise environments +- βœ… Automated testing pipelines +- βœ… Continuous deployment workflows + +### **Security Considerations** +- πŸ”’ Use IAM roles with minimal permissions +- πŸ”’ Rotate AWS access keys regularly +- πŸ”’ Enable ECR image scanning +- πŸ”’ Use branch protection rules +- πŸ”’ Review automated commits + +--- + +This branching strategy provides a robust foundation for both stable production deployments and rapid development cycles while maintaining clear separation of concerns and automated quality gates. diff --git a/COMMANDS-TO-RUN.md b/COMMANDS-TO-RUN.md new file mode 100644 index 000000000..cf62871d1 --- /dev/null +++ b/COMMANDS-TO-RUN.md @@ -0,0 +1,134 @@ +# πŸš€ All Commands to Run + +## 1️⃣ Push README Changes to GitHub + +```bash +# Add all changes +git add . + +# Commit with message +git commit -m "Update all service README files with deployment status" + +# Push to GitHub +git push origin gitops +``` + +--- + +## 2️⃣ Force ArgoCD to Sync (Optional - for immediate update) + +```powershell +# Run the sync script +.\sync-argocd.ps1 +``` + +**OR wait 3 minutes for auto-sync** + +--- + +## 3️⃣ Verify Changes Were Deployed + +```bash +# Check ArgoCD application status +kubectl get applications -n argocd + +# Check if pods restarted (they won't for README changes, but you can verify sync) +kubectl get pods -n retail-store + +# View ArgoCD sync status +kubectl get application retail-store-ui -n argocd -o yaml | grep -A 5 "status:" +``` + +--- + +## 4️⃣ Access Monitoring (Optional) + +```powershell +# Start Grafana and Prometheus +.\start-monitoring.ps1 +``` + +Then open: +- Grafana: http://localhost:3000 (admin/prom-operator) +- Prometheus: http://localhost:9090 + +--- + +## 5️⃣ Access ArgoCD UI (Optional) + +```bash +# Port forward ArgoCD +kubectl port-forward svc/argocd-server -n argocd 8080:80 +``` + +Then open: http://localhost:8080 + +Get password: +```bash +kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d +``` + +--- + +## 6️⃣ Check Application Status + +```bash +# Get all pods +kubectl get pods -n retail-store + +# Get all services +kubectl get svc -n retail-store + +# Get ingress +kubectl get ingress -n retail-store + +# Get load balancer URL +kubectl get svc -n ingress-nginx ingress-nginx-controller -o yaml | grep hostname +``` + +--- + +## 🎯 Quick One-Liner (Push + Sync) + +```bash +git add . && git commit -m "Update README files" && git push origin gitops && .\sync-argocd.ps1 +``` + +--- + +## πŸ“ What Changed + +Updated README.md files in: +- βœ… src/ui/README.md +- βœ… src/catalog/README.md +- βœ… src/cart/README.md +- βœ… src/checkout/README.md +- βœ… src/orders/README.md + +Each now shows: +- Last updated date +- ArgoCD GitOps deployment status +- Current version info + +--- + +## ⏱️ Expected Timeline + +1. **Push to GitHub:** Instant +2. **ArgoCD detects change:** Up to 3 minutes (or instant with sync script) +3. **Sync completes:** 10-30 seconds + +**Note:** README changes don't trigger pod restarts, but you'll see the sync status update in ArgoCD! + +--- + +## πŸ” Verify in ArgoCD UI + +After syncing, you'll see: +- βœ… All applications show "Synced" status +- βœ… Last sync time updated +- βœ… Commit hash matches your latest commit + +--- + +**Ready to run? Copy and paste the commands above! πŸš€** diff --git a/GIT-COMMANDS.md b/GIT-COMMANDS.md new file mode 100644 index 000000000..7a5c47df1 --- /dev/null +++ b/GIT-COMMANDS.md @@ -0,0 +1,168 @@ +# Git Commands Reference + +## πŸš€ Quick Push (Recommended) + +Run the automated script: +```powershell +.\push-to-github.ps1 +``` + +This will: +1. Add all changes +2. Show you what will be committed +3. Ask for a commit message +4. Commit and push to GitHub + +--- + +## πŸ“ Manual Git Commands + +### 1. Check Status +```bash +git status +``` + +### 2. Add All Changes +```bash +git add . +``` + +Or add specific files: +```bash +git add HOW-TO-ACCESS.md +git add start-monitoring.ps1 +git add monitoring-ingress.yaml +git add retail-store-servicemonitors.yaml +``` + +### 3. Commit Changes +```bash +git commit -m "Add monitoring stack and access documentation" +``` + +### 4. Push to GitHub +```bash +git push origin gitops +``` + +--- + +## πŸ”„ Common Git Workflows + +### Push All Changes +```bash +git add . +git commit -m "Your commit message here" +git push origin gitops +``` + +### Check What Changed +```bash +git status +git diff +``` + +### View Commit History +```bash +git log --oneline +git log --graph --oneline --all +``` + +### Pull Latest Changes +```bash +git pull origin gitops +``` + +### Create New Branch +```bash +git checkout -b feature/new-feature +git push origin feature/new-feature +``` + +### Switch Branches +```bash +git checkout main +git checkout gitops +``` + +--- + +## πŸ“¦ What Will Be Pushed + +Current untracked files: +- `HOW-TO-ACCESS.md` - Complete access guide +- `access-monitoring.md` - Monitoring access details +- `start-monitoring.ps1` - Quick start script for monitoring +- `monitoring-ingress.yaml` - Ingress configuration +- `retail-store-servicemonitors.yaml` - Prometheus ServiceMonitors +- `push-to-github.ps1` - This push script +- `GIT-COMMANDS.md` - This file + +Modified files: +- `src/ui/chart/values.yaml` - Updated with correct endpoints +- `src/cart/chart/values.yaml` - Fixed syntax error +- `terraform/addons.tf` - Disabled AWS Load Balancer Controller + +--- + +## πŸ” Authentication + +If you're prompted for credentials: + +**HTTPS (Username/Password or Token):** +```bash +git config --global user.name "Your Name" +git config --global user.email "your.email@example.com" +``` + +**SSH (Recommended):** +```bash +# Generate SSH key +ssh-keygen -t ed25519 -C "your.email@example.com" + +# Add to GitHub +# Copy the public key and add it to GitHub Settings > SSH Keys +cat ~/.ssh/id_ed25519.pub +``` + +--- + +## πŸ› Troubleshooting + +### If push is rejected: +```bash +# Pull first, then push +git pull origin gitops --rebase +git push origin gitops +``` + +### If you have merge conflicts: +```bash +# Resolve conflicts in files, then: +git add . +git rebase --continue +git push origin gitops +``` + +### Undo last commit (keep changes): +```bash +git reset --soft HEAD~1 +``` + +### Discard all local changes: +```bash +git reset --hard HEAD +git clean -fd +``` + +--- + +## πŸ“Š Current Repository Info + +- **Repository:** https://github.com/bashairfan0911/retail-store-sample-app +- **Current Branch:** gitops +- **Remote:** origin + +--- + +**Ready to push? Run:** `.\push-to-github.ps1` πŸš€ diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 000000000..68b0c0e1d --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,578 @@ +# πŸ“œ Deployment History & Scripts + +## 🎯 Project Overview + +**Project:** Retail Store Sample Application on AWS EKS +**Date:** October 2, 2025 +**Region:** us-west-2 +**Cluster:** retail-store-2zn5 + +--- + +## πŸ“‹ Deployment Timeline + +### 1. Initial Infrastructure Setup +```bash +# Navigate to terraform directory +cd terraform + +# Initialize Terraform +terraform init + +# Plan the deployment +terraform plan + +# Apply infrastructure +terraform apply -auto-approve +``` + +**What was deployed:** +- βœ… VPC with public and private subnets +- βœ… EKS Cluster (v1.33) +- βœ… Node groups with Karpenter autoscaling +- βœ… Security groups and IAM roles + +--- + +### 2. EKS Add-ons Installation + +**Installed Components:** +- βœ… Cert-Manager (SSL certificate management) +- βœ… NGINX Ingress Controller (Load balancing) +- βœ… Kube Prometheus Stack (Monitoring) +- βœ… ArgoCD (GitOps) + +**Key Configuration Changes:** +- Disabled AWS Load Balancer Controller (conflicted with NGINX) +- Configured NGINX with NLB annotations +- Added wait and timeout settings for helm releases + +--- + +### 3. Issues Encountered & Fixes + +#### Issue 1: AWS Load Balancer Controller Webhook Conflict +**Problem:** AWS Load Balancer Controller webhook was blocking other services +**Solution:** +```bash +# Removed AWS Load Balancer Controller +helm uninstall aws-load-balancer-controller -n kube-system + +# Updated terraform/addons.tf to disable it +# enable_aws_load_balancer_controller = false +``` + +#### Issue 2: UI Chart Missing Values +**Problem:** Helm chart had missing required values (certManager, istio, app.chat) +**Solution:** +```bash +# Fixed src/ui/chart/values.yaml +git add src/ui/chart/values.yaml +git commit -m "Add missing certManager, istio, and app configuration" +git push origin gitops +``` + +#### Issue 3: Cart Service YAML Syntax Error +**Problem:** Extra `.` at beginning of src/cart/chart/values.yaml +**Solution:** +```bash +# Fixed the syntax error +git add src/cart/chart/values.yaml +git commit -m "Fix cart values.yaml syntax error" +git push origin gitops +``` + +#### Issue 4: Wrong Cart Service Name +**Problem:** UI was looking for `retail-store-cart` but service was named `retail-store-cart-carts` +**Solution:** +```bash +# Updated UI endpoint configuration +git add src/ui/chart/values.yaml +git commit -m "Fix cart service endpoint name" +git push origin gitops + +# Restarted UI deployment +kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=ui +``` + +--- + +## πŸš€ Final Deployment Commands + +### Configure kubectl +```bash +aws eks update-kubeconfig --region us-west-2 --name retail-store-2zn5 +``` + +### Deploy ArgoCD Applications +```bash +# Apply projects +kubectl apply -n argocd -f argocd/projects/ + +# Apply applications +kubectl apply -n argocd -f argocd/applications/ +``` + +### Enable Monitoring +```bash +# Create ServiceMonitors for retail store apps +kubectl apply -f retail-store-servicemonitors.yaml + +# Verify monitoring +kubectl get servicemonitor -n monitoring | grep retail-store +``` + +--- + +## πŸ“Š Current Architecture + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ AWS EKS Cluster β”‚ +β”‚ (retail-store-2zn5) β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ NGINX Ingress Controller β”‚ β”‚ +β”‚ β”‚ (NLB: k8s-ingressn-ingressn-b81d5b7b46...) β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”‚ β”‚ β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ +β”‚ β”‚ β”‚ Retail Store Namespace β”‚ β”‚ β”‚ +β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ retail-store-ui β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ retail-store-catalog β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ retail-store-cart-carts β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ retail-store-checkout β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ retail-store-orders β”‚ β”‚ β”‚ +β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ +β”‚ β”‚ β”‚ Monitoring Namespace β”‚ β”‚ β”‚ +β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ Prometheus β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ Grafana β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ Alertmanager β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ Node Exporter β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ Kube State Metrics β”‚ β”‚ β”‚ +β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ +β”‚ β”‚ β”‚ ArgoCD Namespace β”‚ β”‚ β”‚ +β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ ArgoCD Server β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ ArgoCD Repo Server β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β€’ ArgoCD Application Controller β”‚ β”‚ β”‚ +β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”‚ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +--- + +## πŸ”§ Useful Scripts + +### 1. Start Monitoring Stack +```powershell +# start-monitoring.ps1 +Write-Host "Starting Grafana and Prometheus port forwarding..." -ForegroundColor Green + +# Start Grafana +Start-Process powershell -ArgumentList "-NoExit", "-Command", "Write-Host 'Grafana Port Forward - Keep this window open' -ForegroundColor Cyan; kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80" + +Start-Sleep -Seconds 2 + +# Start Prometheus +Start-Process powershell -ArgumentList "-NoExit", "-Command", "Write-Host 'Prometheus Port Forward - Keep this window open' -ForegroundColor Cyan; kubectl port-forward -n monitoring svc/kube-prometheus-stack-prometheus 9090:9090" + +Start-Sleep -Seconds 5 + +# Open browsers +Start-Process "http://localhost:3000" +Start-Process "http://localhost:9090" + +Write-Host "" +Write-Host "Grafana: http://localhost:3000 (admin/prom-operator)" -ForegroundColor Cyan +Write-Host "Prometheus: http://localhost:9090" -ForegroundColor Cyan +``` + +**Usage:** +```powershell +.\start-monitoring.ps1 +``` + +--- + +### 2. Check Application Status +```bash +#!/bin/bash +# check-status.sh + +echo "=== Retail Store Pods ===" +kubectl get pods -n retail-store + +echo "" +echo "=== ArgoCD Applications ===" +kubectl get applications -n argocd + +echo "" +echo "=== Ingress Endpoints ===" +kubectl get ingress -A + +echo "" +echo "=== Monitoring Pods ===" +kubectl get pods -n monitoring + +echo "" +echo "=== Load Balancer URL ===" +kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' +echo "" +``` + +**Usage:** +```bash +chmod +x check-status.sh +./check-status.sh +``` + +--- + +### 3. View Application Logs +```bash +#!/bin/bash +# view-logs.sh + +SERVICE=$1 + +if [ -z "$SERVICE" ]; then + echo "Usage: ./view-logs.sh [ui|catalog|cart|checkout|orders]" + exit 1 +fi + +case $SERVICE in + ui) + kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=100 -f + ;; + catalog) + kubectl logs -n retail-store -l app.kubernetes.io/name=catalog --tail=100 -f + ;; + cart) + kubectl logs -n retail-store -l app.kubernetes.io/name=carts --tail=100 -f + ;; + checkout) + kubectl logs -n retail-store -l app.kubernetes.io/name=checkout --tail=100 -f + ;; + orders) + kubectl logs -n retail-store -l app.kubernetes.io/name=orders --tail=100 -f + ;; + *) + echo "Unknown service: $SERVICE" + echo "Available: ui, catalog, cart, checkout, orders" + exit 1 + ;; +esac +``` + +**Usage:** +```bash +chmod +x view-logs.sh +./view-logs.sh ui +``` + +--- + +### 4. Restart Services +```bash +#!/bin/bash +# restart-services.sh + +SERVICE=$1 + +if [ -z "$SERVICE" ]; then + echo "Restarting all retail store services..." + kubectl rollout restart deployment -n retail-store +else + echo "Restarting $SERVICE..." + case $SERVICE in + ui) + kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=ui + ;; + catalog) + kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=catalog + ;; + cart) + kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=carts + ;; + checkout) + kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=checkout + ;; + orders) + kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=orders + ;; + *) + echo "Unknown service: $SERVICE" + exit 1 + ;; + esac +fi + +echo "Done!" +``` + +**Usage:** +```bash +chmod +x restart-services.sh +./restart-services.sh ui +# or restart all +./restart-services.sh +``` + +--- + +### 5. Get ArgoCD Password +```bash +#!/bin/bash +# get-argocd-password.sh + +echo "ArgoCD Admin Password:" +kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d +echo "" +``` + +**Usage:** +```bash +chmod +x get-argocd-password.sh +./get-argocd-password.sh +``` + +--- + +### 6. Port Forward All Services (PowerShell) +```powershell +# port-forward-all.ps1 + +Write-Host "Starting all port forwards..." -ForegroundColor Green + +# Grafana +Start-Process powershell -ArgumentList "-NoExit", "-Command", "Write-Host 'Grafana (3000)' -ForegroundColor Cyan; kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80" + +Start-Sleep -Seconds 1 + +# Prometheus +Start-Process powershell -ArgumentList "-NoExit", "-Command", "Write-Host 'Prometheus (9090)' -ForegroundColor Cyan; kubectl port-forward -n monitoring svc/kube-prometheus-stack-prometheus 9090:9090" + +Start-Sleep -Seconds 1 + +# ArgoCD +Start-Process powershell -ArgumentList "-NoExit", "-Command", "Write-Host 'ArgoCD (8080)' -ForegroundColor Cyan; kubectl port-forward -n argocd svc/argocd-server 8080:80" + +Start-Sleep -Seconds 3 + +Write-Host "" +Write-Host "All services are now accessible:" -ForegroundColor Green +Write-Host " Grafana: http://localhost:3000 (admin/prom-operator)" -ForegroundColor Cyan +Write-Host " Prometheus: http://localhost:9090" -ForegroundColor Cyan +Write-Host " ArgoCD: http://localhost:8080 (admin/)" -ForegroundColor Cyan +Write-Host "" +Write-Host "Keep all terminal windows open!" -ForegroundColor Yellow +``` + +**Usage:** +```powershell +.\port-forward-all.ps1 +``` + +--- + +## 🌐 Access URLs + +### Direct Access (via Load Balancer) +``` +Retail Store: http://k8s-ingressn-ingressn-b81d5b7b46-3a4c63d7d41297d2.elb.us-west-2.amazonaws.com +``` + +### Port Forward Access +``` +Grafana: http://localhost:3000 (admin/prom-operator) +Prometheus: http://localhost:9090 +ArgoCD: http://localhost:8080 (admin/) +``` + +--- + +## πŸ“¦ Git Commits Made + +```bash +# 1. Fixed UI chart configuration +git commit -m "Fix UI chart: Add missing certManager and ingress configuration" + +# 2. Added istio configuration +git commit -m "Add istio configuration to UI chart" + +# 3. Added complete app configuration +git commit -m "Add complete app configuration to UI chart" + +# 4. Fixed cart syntax error +git commit -m "Fix cart values.yaml syntax error" + +# 5. Fixed cart service endpoint +git commit -m "Fix cart service endpoint name" + +# 6. Updated terraform config +git commit -m "Update terraform addons config" +``` + +--- + +## πŸ” Monitoring Queries + +### Prometheus Queries +```promql +# HTTP Request Rate +rate(http_server_requests_seconds_count{namespace="retail-store"}[5m]) + +# Memory Usage +container_memory_usage_bytes{namespace="retail-store"} + +# CPU Usage +rate(container_cpu_usage_seconds_total{namespace="retail-store"}[5m]) + +# JVM Memory +jvm_memory_used_bytes{namespace="retail-store"} + +# Pod Count +count(kube_pod_info{namespace="retail-store"}) + +# Request Duration (95th percentile) +histogram_quantile(0.95, rate(http_server_requests_seconds_bucket{namespace="retail-store"}[5m])) +``` + +--- + +## πŸ“ Files Created + +1. **Infrastructure:** + - `terraform/addons.tf` - EKS add-ons configuration + - `terraform/main.tf` - Main infrastructure + - `terraform/variables.tf` - Variables + +2. **Monitoring:** + - `retail-store-servicemonitors.yaml` - Prometheus ServiceMonitors + - `monitoring-ingress.yaml` - Ingress for monitoring (not used) + +3. **Documentation:** + - `HOW-TO-ACCESS.md` - Complete access guide + - `access-monitoring.md` - Monitoring access details + - `HISTORY.md` - This file + +4. **Scripts:** + - `start-monitoring.ps1` - Quick start monitoring + - `port-forward-all.ps1` - Port forward all services + +5. **Application Charts:** + - `src/ui/chart/values.yaml` - Fixed UI configuration + - `src/cart/chart/values.yaml` - Fixed cart configuration + +--- + +## πŸŽ“ Lessons Learned + +1. **AWS Load Balancer Controller vs NGINX Ingress:** + - Don't use both simultaneously - they conflict + - NGINX Ingress with NLB annotations is simpler for this use case + +2. **Helm Chart Values:** + - Always validate all template references have corresponding values + - Use `helm template` to test before deploying + +3. **ArgoCD Auto-Sync:** + - Auto-sync is great but sometimes needs manual refresh + - Use `kubectl patch` to force refresh when needed + +4. **Service Naming:** + - Be consistent with service names across charts + - Document the actual service names vs expected names + +5. **Port Forwarding vs Ingress:** + - Port forwarding is more reliable for admin tools + - Ingress is better for public-facing applications + +--- + +## πŸš€ Next Steps + +### Potential Improvements: +1. **Add SSL/TLS:** + ```bash + # Enable cert-manager ClusterIssuer + # Configure ingress with TLS + ``` + +2. **Add Horizontal Pod Autoscaling:** + ```bash + kubectl autoscale deployment -n retail-store retail-store-ui --cpu-percent=70 --min=2 --max=10 + ``` + +3. **Add Custom Grafana Dashboards:** + - Create dashboards for retail store metrics + - Import community dashboards + +4. **Set up Alerting:** + - Configure Alertmanager rules + - Set up notification channels (Slack, email) + +5. **Add Backup Strategy:** + - Velero for cluster backups + - Database backups if using persistent storage + +--- + +## πŸ“ž Support Commands + +### Get Cluster Info +```bash +kubectl cluster-info +kubectl get nodes +kubectl get namespaces +``` + +### Troubleshooting +```bash +# Check pod events +kubectl describe pod -n retail-store + +# Check service endpoints +kubectl get endpoints -n retail-store + +# Check ingress details +kubectl describe ingress -n retail-store retail-store-ui + +# Check logs from all containers +kubectl logs -n retail-store --all-containers=true +``` + +### Cleanup (if needed) +```bash +# Delete retail store +kubectl delete namespace retail-store + +# Delete monitoring +kubectl delete namespace monitoring + +# Delete ArgoCD +kubectl delete namespace argocd + +# Destroy infrastructure +cd terraform +terraform destroy -auto-approve +``` + +--- + +**Last Updated:** October 2, 2025 +**Status:** βœ… Fully Operational +**Maintained By:** DevOps Team diff --git a/HOW-TO-ACCESS.md b/HOW-TO-ACCESS.md new file mode 100644 index 000000000..48c1c7208 --- /dev/null +++ b/HOW-TO-ACCESS.md @@ -0,0 +1,175 @@ +# πŸš€ How to Access Your Applications + +## βœ… What's Running + +All services are deployed and running: +- βœ… Retail Store Application (UI, Catalog, Cart, Checkout, Orders) +- βœ… Monitoring Stack (Prometheus, Grafana, Alertmanager) +- βœ… ArgoCD (GitOps) + +--- + +## πŸ›οΈ 1. Retail Store Application + +**URL:** http://k8s-ingressn-ingressn-b81d5b7b46-3a4c63d7d41297d2.elb.us-west-2.amazonaws.com + +Just open this URL in your browser - no login required! + +**What you can do:** +- Browse products +- Add items to cart +- Complete checkout +- View orders + +--- + +## πŸ“Š 2. Grafana (Monitoring Dashboards) + +### Quick Start: +```powershell +.\start-monitoring.ps1 +``` + +This will: +1. Start port forwarding for Grafana and Prometheus +2. Open both in your browser automatically + +### Manual Access: + +**Step 1:** Open a new terminal and run: +```bash +kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80 +``` + +**Step 2:** Open browser to: http://localhost:3000 + +**Step 3:** Login with: +- Username: `admin` +- Password: `prom-operator` + +**Keep the terminal open while using Grafana!** + +--- + +## πŸ” 3. Prometheus (Metrics) + +**Step 1:** Open a new terminal and run: +```bash +kubectl port-forward -n monitoring svc/kube-prometheus-stack-prometheus 9090:9090 +``` + +**Step 2:** Open browser to: http://localhost:9090 + +**Try these queries:** +```promql +# HTTP requests per second +rate(http_server_requests_seconds_count{namespace="retail-store"}[5m]) + +# Memory usage +container_memory_usage_bytes{namespace="retail-store"} + +# CPU usage +rate(container_cpu_usage_seconds_total{namespace="retail-store"}[5m]) +``` + +--- + +## πŸ”„ 4. ArgoCD (GitOps Dashboard) + +**Step 1:** Open a new terminal and run: +```bash +kubectl port-forward svc/argocd-server -n argocd 8080:80 +``` + +**Step 2:** Open browser to: http://localhost:8080 + +**Step 3:** Get the password: +```bash +kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d +``` + +**Step 4:** Login with: +- Username: `admin` +- Password: (from step 3) + +--- + +## πŸ› οΈ Useful Commands + +### Check Status +```bash +# All retail store pods +kubectl get pods -n retail-store + +# All ArgoCD applications +kubectl get applications -n argocd + +# All ingresses +kubectl get ingress -A +``` + +### View Logs +```bash +# UI logs +kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=50 -f + +# All retail store logs +kubectl logs -n retail-store --all-containers=true --tail=100 +``` + +### Restart Services +```bash +# Restart UI +kubectl rollout restart deployment -n retail-store -l app.kubernetes.io/name=ui + +# Restart all +kubectl rollout restart deployment -n retail-store +``` + +--- + +## 🎯 Quick Summary + +| Service | Access Method | URL | Credentials | +|---------|---------------|-----|-------------| +| **Retail Store** | Direct | http://k8s-ingressn-ingressn-b81d5b7b46-3a4c63d7d41297d2.elb.us-west-2.amazonaws.com | None | +| **Grafana** | Port Forward | http://localhost:3000 | admin / prom-operator | +| **Prometheus** | Port Forward | http://localhost:9090 | None | +| **ArgoCD** | Port Forward | http://localhost:8080 | admin / (get from secret) | + +--- + +## πŸ› Troubleshooting + +**If retail store shows 500 error:** +```bash +kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=50 +kubectl get pods -n retail-store +``` + +**If port forward fails:** +- Check if port is already in use: `netstat -ano | findstr :3000` +- Kill the process or use a different port +- Make sure kubectl is connected: `kubectl get nodes` + +**If services are not responding:** +```bash +# Check pod status +kubectl get pods -n retail-store + +# Restart services +kubectl rollout restart deployment -n retail-store +``` + +--- + +## πŸ“ Files Created + +- `start-monitoring.ps1` - Quick script to start Grafana and Prometheus +- `access-monitoring.md` - Detailed monitoring access guide +- `monitoring-ingress.yaml` - Ingress configuration (not used, using port-forward instead) +- `retail-store-servicemonitors.yaml` - Prometheus service monitors + +--- + +**Enjoy your fully deployed retail store with monitoring! πŸŽ‰** diff --git a/QUICK-START.md b/QUICK-START.md new file mode 100644 index 000000000..e26fef98c --- /dev/null +++ b/QUICK-START.md @@ -0,0 +1,172 @@ +# πŸš€ Quick Start Guide + +## What You Have Deployed + +βœ… **Retail Store Application** - Full e-commerce app with microservices +βœ… **Monitoring Stack** - Prometheus + Grafana for metrics and dashboards +βœ… **GitOps** - ArgoCD for continuous deployment +βœ… **Kubernetes Cluster** - EKS on AWS with auto-scaling + +--- + +## 🎯 3 Simple Steps to Get Started + +### Step 1: Access the Retail Store +Open your browser and go to: +``` +http://k8s-ingressn-ingressn-b81d5b7b46-3a4c63d7d41297d2.elb.us-west-2.amazonaws.com +``` + +### Step 2: Start Monitoring +Run in PowerShell: +```powershell +.\start-monitoring.ps1 +``` + +### Step 3: Push to GitHub +Run in PowerShell: +```powershell +.\push-to-github.ps1 +``` + +**That's it!** πŸŽ‰ + +--- + +## πŸ“š Detailed Guides + +- **[HOW-TO-ACCESS.md](HOW-TO-ACCESS.md)** - Complete access guide for all services +- **[GIT-COMMANDS.md](GIT-COMMANDS.md)** - Git commands reference +- **[access-monitoring.md](access-monitoring.md)** - Monitoring stack details + +--- + +## πŸ› οΈ Quick Commands + +### Check Everything is Running +```bash +kubectl get pods -A +``` + +### View Retail Store Status +```bash +kubectl get pods -n retail-store +kubectl get svc -n retail-store +kubectl get ingress -n retail-store +``` + +### View Monitoring Status +```bash +kubectl get pods -n monitoring +``` + +### View ArgoCD Applications +```bash +kubectl get applications -n argocd +``` + +### View Logs +```bash +# UI logs +kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=50 -f + +# All logs +kubectl logs -n retail-store --all-containers=true --tail=100 +``` + +--- + +## πŸ”— Important URLs + +| Service | URL | Credentials | +|---------|-----|-------------| +| **Retail Store** | http://k8s-ingressn-ingressn-b81d5b7b46-3a4c63d7d41297d2.elb.us-west-2.amazonaws.com | None | +| **Grafana** | http://localhost:3000 (after port-forward) | admin / prom-operator | +| **Prometheus** | http://localhost:9090 (after port-forward) | None | +| **ArgoCD** | http://localhost:8080 (after port-forward) | admin / (get from secret) | + +--- + +## πŸ“¦ What's Included + +### Retail Store Microservices +- **UI** - Frontend application +- **Catalog** - Product catalog service +- **Cart** - Shopping cart service +- **Checkout** - Checkout service +- **Orders** - Order management service + +### Monitoring Stack +- **Prometheus** - Metrics collection +- **Grafana** - Dashboards and visualization +- **Alertmanager** - Alert management +- **Node Exporter** - Node metrics +- **Kube State Metrics** - Kubernetes metrics + +### Infrastructure +- **EKS Cluster** - Managed Kubernetes on AWS +- **VPC** - Isolated network +- **Load Balancer** - NGINX Ingress Controller +- **Auto Scaling** - Karpenter for node scaling +- **GitOps** - ArgoCD for deployment automation + +--- + +## πŸŽ“ Next Steps + +1. **Explore Grafana Dashboards** + - Login to Grafana + - Browse pre-built Kubernetes dashboards + - Create custom dashboards for retail store metrics + +2. **Monitor Application Metrics** + - Open Prometheus + - Run queries to see application metrics + - Set up alerts + +3. **Use ArgoCD** + - View application sync status + - Manually sync applications + - Monitor deployment health + +4. **Customize the Application** + - Modify Helm charts in `src/*/chart/` + - Commit changes to GitHub + - Watch ArgoCD auto-deploy + +--- + +## πŸ› Troubleshooting + +**Problem:** Retail store shows 500 error +```bash +kubectl logs -n retail-store -l app.kubernetes.io/name=ui --tail=50 +kubectl rollout restart deployment -n retail-store +``` + +**Problem:** Port forward fails +```bash +# Check if port is in use +netstat -ano | findstr :3000 + +# Use different port +kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3001:80 +``` + +**Problem:** Services not responding +```bash +kubectl get pods -n retail-store +kubectl describe pod -n retail-store +``` + +--- + +## πŸ“ž Support + +- Check logs: `kubectl logs -n retail-store ` +- Describe resources: `kubectl describe pod -n retail-store ` +- View events: `kubectl get events -n retail-store --sort-by='.lastTimestamp'` + +--- + +**Happy deploying! πŸš€** diff --git a/README.md b/README.md index 7c22597cc..1611914d7 100644 --- a/README.md +++ b/README.md @@ -3,41 +3,37 @@ ![Banner](./docs/images/banner.png)
-
[![Stars](https://img.shields.io/github/stars/LondheShubham153/retail-store-sample-app)](Stars) -![GitHub License](https://img.shields.io/github/license/LondheShubham153/retail-store-sample-app?color=green) +![GitHub License](https://img.shields.io/github/license/bashairfan0911/retail-store-sample-app?color=green) ![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%LondheShubham153%2Fretail-store-sample-app%2Frefs%2Fheads%2Fmain%2F.release-please-manifest.json&query=%24%5B%22.%22%5D&label=release) + +

AWS Containers Retail Sample - GitOps Edition

+
-
+**Modern microservices architecture deployed on AWS EKS using GitOps principles with automated CI/CD pipeline** - -

AWS Containers Retail Sample

-
-This is a sample application designed to illustrate various concepts related to containers on AWS. It presents a sample retail store application including a product catalog, shopping cart and checkout, deployed using modern DevOps practices including GitOps and Infrastructure as Code. - ## Table of Contents -- [Overview](#overview) -- [Architecture](#architecture) -- [Prerequisites](#prerequisites) -- [Getting Started](#getting-started) -- [GitOps Workflow](#gitops-workflow) -- [EKS Auto Mode](#eks-auto-mode) -- [Infrastructure Components](#infrastructure-components) -- [CI/CD Pipeline](#cicd-pipeline) -- [Monitoring and Observability](#monitoring-and-observability) -- [Cleanup](#cleanup) -- [Troubleshooting](#troubleshooting) - -## Overview +- [Quick Start](#-quick-start) +- [️ Architecture](#️-architecture) +- [Prerequisites](#-prerequisites) +- [Installation](#-installation) +- [Deployment](#-deployment) +- [Access Your Applications](#-access-your-applications) +- [GitOps Workflow](#-gitops-workflow) +- [Monitoring](#-monitoring) +- [Automation Scripts](#-automation-scripts) +- [Troubleshooting](#-troubleshooting) +- [Cleanup](#-cleanup) +- [Documentation](#-documentation) -The Retail Store Sample App demonstrates a modern microservices architecture deployed on AWS EKS using GitOps principles. The application consists of multiple services that work together to provide a complete retail store experience: +## Quick Start -![Application Architecture Diagram](./docs/images/application-architecture.png) +**Deploy the complete retail store application!** - **UI Service**: Java-based frontend - **Catalog Service**: Go-based product catalog API @@ -45,440 +41,434 @@ The Retail Store Sample App demonstrates a modern microservices architecture dep - **Orders Service**: Java-based order management API - **Checkout Service**: Node.js-based checkout orchestration API -## Infrastructure Architecture +--- + +## Architecture + +### **Application Architecture** + +The retail store consists of 5 microservices working together: + +| Service | Language | Purpose | Port | +| ------------ | ------------------ | ---------------------- | ---- | +| **UI** | Java (Spring Boot) | Web interface | 8080 | +| **Catalog** | Go | Product catalog API | 8081 | +| **Cart** | Java (Spring Boot) | Shopping cart API | 8082 | +| **Orders** | Java (Spring Boot) | Order management API | 8083 | +| **Checkout** | Node.js (NestJS) | Checkout orchestration | 8084 | + +![Application Architecture](./docs/images/architecture.png) + +### **Infrastructure Architecture** -![Infrastructure Architecture Diagram](./docs/images/architecture.png) +![EKS](docs/images/EKS.gif) -The Infrastructure Architecture follows cloud-native best practices: +**🎯 What you get:** -- **Microservices**: Each component is developed and deployed independently -- **Containerization**: All services run as containers on Kubernetes -- **GitOps**: Infrastructure and application deployment managed through Git -- **Infrastructure as Code**: All AWS resources defined using Terraform -- **CI/CD**: Automated build and deployment pipelines with GitHub Actions +- **Purpose**: Full production workflow with CI/CD pipeline +- **Images**: Private ECR (auto-updated with commit hashes) +- **Deployment**: Automated via GitHub Actions +- **Updates**: Automatic on code changes +- **Best for**: Production environments, automated workflows, enterprise deployments + +### **GitOps Workflow** + +```mermaid +graph LR + A[Code Push] --> B[GitHub Actions] + B --> C[Build Images] + C --> D[Push to ECR] + D --> E[Update Helm Charts] + E --> F[Commit Changes] + F --> G[ArgoCD Sync] + G --> H[Deploy to EKS] +``` + +--- ## Prerequisites -Before you begin, ensure you have the following tools installed: +1. **Install Prerequisites**: AWS CLI, Terraform, kubectl, Docker, Helm +2. **Configure AWS**: `aws configure` with appropriate credentials +3. **Clone Repository**: `git clone https://github.com/bashairfan0911/retail-store-sample-app.git` +4. **Deploy Infrastructure**: Run Terraform in two phases (see [Getting Started](#getting-started)) +5. **Access Application**: Get load balancer URL and browse the retail store -- **AWS CLI** (configured with appropriate credentials) -- **Terraform** (version 1.0.0 or later) -- **kubectl** (compatible with Kubernetes 1.23+) -- **Git** (2.0.0 or later) -- **Docker** (for local development) -- **Helm** +### **Required Tools** -## Getting Started +| Tool | Version | Installation | +| ------------- | ------- | ------------------------------------------------------------------------------------ | +| **AWS CLI** | v2+ | [Install Guide](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) | +| **Terraform** | 1.0+ | [Install Guide](https://developer.hashicorp.com/terraform/install) | +| **kubectl** | 1.33+ | [Install Guide](https://kubernetes.io/docs/tasks/tools/) | +| **Docker** | 20.0+ | [Install Guide](https://docs.docker.com/get-docker/) | +| **Helm** | 3.0+ | [Install Guide](https://helm.sh/docs/intro/install/) | +| **Git** | 2.0+ | [Install Guide](https://git-scm.com/downloads) | -Follow these steps to **install Prerequisites:** +### **Quick Installation Scripts** -- #### 1. AWS CLI: +
+πŸ”§ One-Click Installation (Linux/macOS) - * These commands will download and install the **AWS Command Line Interface**. +```bash +#!/bin/bash +# Install all prerequisites -```sh +# AWS CLI curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install -# Verify the installation +# Terraform +curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - +sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +sudo apt-get update && sudo apt-get install terraform + +# kubectl +curl -LO "https://dl.k8s.io/release/v1.33.3/bin/linux/amd64/kubectl" +chmod +x kubectl +sudo mv kubectl /usr/local/bin/ + +# Docker +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh + +# Helm +curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + +# Verify installations aws --version +terraform --version +kubectl version --client +docker --version +helm version ``` -- #### 2. Terraform: - - - **Terraform** is installed by downloading the binary appropriate for your operating system. - - -
- Click for Linux & macOS Instructions - - 1. **Download the Binary**: Go to the [Terraform Downloads Page](https://releases.hashicorp.com/terraform/1.12.2) to find the correct zip file for your system (e.g., Linux AMD64, macOS ARM64). - - 2. **Install the Binary**: Unzip the file and move the `terraform` executable to a directory in your system's PATH. - - ```sh - # Example for a downloaded file - unzip terraform_1.9.0_linux_amd64.zip - sudo mv terraform /usr/local/bin/ - ``` - or - ```sh - # Example for macOS - brew install terraform - ``` - 3. **Verify the Installation**: - - ```sh - terraform --version - ``` -
- - -
- Click for Windows Instructions - - * **Official Guide:** [Install Terraform on Windows](https://developer.hashicorp.com/terraform/install) - -
- -- #### 3. kubectl: - - * These commands install a specific version of **kubectl**. - - -
- Click for macOS Instructions - - ```sh - # Download the kubectl binary - curl -LO "https://dl.k8s.io/release/v1.33.3/bin/darwin/arm64/kubectl" - - # Make the binary executable - chmod +x ./kubectl - - # Move the binary into your PATH - sudo mv ./kubectl /usr/local/bin/kubectl - ``` - -
- - -
- Click for Linux Instructions - - ```sh - # Download the kubectl binary - curl -LO "https://dl.k8s.io/release/v1.33.3/bin/linux/amd64/kubectl" - - # Make the binary executable - chmod +x ./kubectl - - # Move the binary into your PATH - sudo mv ./kubectl /usr/local/bin/kubectl - ``` - -
- -- #### [4. Docker](https://docs.docker.com/desktop/setup/install/linux/): - - - > **Step 1: Set Up the Repository:** - - ```sh - sudo apt-get update - sudo apt-get install \ - ca-certificates \ - curl \ - gnupg - ``` - - - > **Step 2: Add Docker’s Official GPG Key:** - - ```sh - sudo install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - sudo chmod a+r /etc/apt/keyrings/docker.gpg - ``` - - - > **Step 3: Set Up the Docker Repository:** - - ```sh - echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - ``` - - - - > **Step 4: Install Docker Engine:** - - ```sh - sudo apt-get update - sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - - # Verify the installation - docker --version - ``` - -- #### 5. Helm: - - ```sh - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 - chmod 700 get_helm.sh - ./get_helm.sh --version v3.18.4 - ``` - - - -Follow these steps to deploy the application: - -### Step 1. Configure AWS with **`Root User`** Credentials: - - Ensure your AWS CLI is configured with the **Root user credentials:** +
-```sh -aws configure -``` +### **AWS Account Requirements** -### Step 2. Clone the Repository: +- **AWS Account** with appropriate permissions -```sh +--- + +## πŸ”§ Installation + +### **Step 1: Clone Repository** + +```bash git clone https://github.com/LondheShubham153/retail-store-sample-app.git cd retail-store-sample-app +git checkout gitops ``` -> [!IMPORTANT] -> ### Step 3: Initial Deployment with Public Images: -> ->
-> Click to Read: First-Time Deployment Instructions -> -> * On the initial deploy, ArgoCD is configured to use public container images as specified in this guide. -> * After this first deployment, the GitHub Actions workflow will run automatically, updating the `values.yaml` files to use your private ECR images and tags for all future deployments. ->
-> -> ### Automatic Update Instructions: -> -> ```sh -> ./scripts/update-helm-values.sh -> ``` -> -> ### Manual Update Instructions: -> -> For the initial deployment, you must update the `values.yaml` file for each of the five services to use the public ECR images. -> -> #### **Service-Specific Configuration** -> ->
-> 1. Cart Service -> -> Update `src/cart/chart/values.yaml` to match the following content: -> ```yaml -> # ... other values -> image: -> repository: public.ecr.aws/aws-containers/retail-store-sample-cart -> pullPolicy: Always -> tag: "1.2.2" -> # ... other values -> ``` ->
-> ->
-> 2. Catalog Service -> -> Update `src/catalog/chart/values.yaml` to match the following content: -> ```yaml -> # ... other values -> image: -> repository: public.ecr.aws/aws-containers/retail-store-sample-catalog -> pullPolicy: Always -> tag: "1.2.2" -> # ... other values -> ``` ->
-> ->
-> 3. Checkout Service -> -> Update `src/checkout/chart/values.yaml` to match the following content: -> ```yaml -> # ... other values -> image: -> repository: public.ecr.aws/aws-containers/retail-store-sample-checkout -> pullPolicy: Always -> tag: "1.2.2" -> # ... other values -> ``` ->
-> ->
-> 4. Orders Service -> -> Update `src/orders/chart/values.yaml` to match the following content: -> ```yaml -> # ... other values -> image: -> repository: public.ecr.aws/aws-containers/retail-store-sample-orders -> pullPolicy: Always -> tag: "1.2.2" -> # ... other values -> ``` ->
-> ->
-> 5. UI Service -> -> Update `src/ui/chart/values.yaml` to match the following content: -> ```yaml -> # ... other values -> image: -> repository: public.ecr.aws/aws-containers/retail-store-sample-ui -> pullPolicy: Always -> tag: "1.2.2" -> # ... other values -> ``` ->
-> - - -### Step 4. Deploy Infrastructure with Terraform: - -The deployment is split into two phases for better control: - - -### Phase 1 of Terraform: Create EKS Cluster - -In Phase 1: Terraform Initialises and creates resources within the retail_app_eks module. +### **Step 2: Configure AWS** + +```bash +# Configure AWS CLI +aws configure + +# Verify configuration +aws sts get-caller-identity +aws eks list-clusters --region us-west-2 +``` + +### **Step 3: Setup GitHub Secrets (Required for GitOps)** + +Go to your GitHub repository β†’ **Settings** β†’ **Secrets and variables** β†’ **Actions** + +Add these secrets: + +| Secret Name | Description | Example | +| ----------------------- | -------------- | -------------- | +| `AWS_ACCESS_KEY_ID` | AWS Access Key | `AKIA...` | +| `AWS_SECRET_ACCESS_KEY` | AWS Secret Key | `wJalrXUt...` | +| `AWS_REGION` | AWS Region | `us-west-2` | +| `AWS_ACCOUNT_ID` | AWS Account ID | `123456789012` | + +--- + +## Deployment + +### **Phase 1: Infrastructure Deployment** + +```bash +cd terraform/ +``` ```sh -cd retail-store-sample-app/terraform/ +# Initialize Terraform terraform init -terraform apply -target=module.retail_app_eks -target=module.vpc --auto-approve ``` image +```sh +# Deploy EKS cluster and VPC +terraform apply -target=module.retail_app_eks -target=module.vpc --auto-approve +``` -This creates the core infrastructure, including: -- VPC with public and private subnets -- Amazon EKS cluster with Auto Mode enabled -- Security groups and IAM roles - +**⏱️ Expected time: 15-20 minutes** -### Step 6: Update kubeconfig to Access the Amazon EKS Cluster: -``` -aws eks update-kubeconfig --name retail-store --region -``` +This creates: -### Phase 2 of Terraform: Once you update kubeconfig, apply the Remaining Configuration: +- βœ… VPC with public/private subnets +- βœ… EKS cluster with Auto Mode +- βœ… Security groups and IAM roles +### **Phase 2: Configure kubectl** ```bash -terraform apply --auto-approve +# Get cluster name (with random suffix) +terraform output cluster_name + +# Update kubeconfig +aws eks update-kubeconfig --region us-west-2 --name $(terraform output -raw cluster_name) + +# Verify connection +kubectl get nodes ``` -This deploys: -- ArgoCD for Setup GitOps -- NGINX Ingress Controller -- Cert Manager for SSL certificates +### **Phase 3: Deploy Applications** -### Step 7: GitHub Actions: +```bash +# Deploy ArgoCD and add-ons +terraform apply --auto-approve +``` -For GitHub Actions, first configure secrets so the pipelines can be automatically triggered: +**⏱️ Expected time: 05-10 minutes** -**Create an IAM User, policies, and generate credentials** +This deploys: -**Go to your GitHub repo β†’ Settings β†’ Secrets and variables β†’ Actions β†’ New repository secret.** +- βœ… ArgoCD for GitOps +- βœ… NGINX Ingress Controller +- βœ… Cert Manager for SSL +- βœ… ArgoCD applications +### **Phase 4: Access Application** -| Secret Name | Value | -|-----------------------|------------------------------------| -| `AWS_ACCESS_KEY_ID` | `Your AWS Access Key ID` | -| `AWS_SECRET_ACCESS_KEY` | `Your AWS Secret Access Key` | -| `AWS_REGION` | `region-name` | -| `AWS_ACCOUNT_ID` | `your-account-id` | +```bash +# Get load balancer URL +kubectl get svc -n ingress-nginx +``` +**🌐 Open the URL in your browser to access the retail store!** +image -> [!IMPORTANT] -> Once the entire cluster is created, any changes pushed to the repository will automatically trigger GitHub Actions. +--- -GitHub Actions will automatically build and push the updated Docker images to Amazon ECR. +## GitOps Workflow +### **How It Works** +1. **Code Push** β†’ Changes to `src/` directory +2. **GitHub Actions** β†’ Detects changed services +3. **Build & Push** β†’ Creates Docker images in ECR +4. **Update Charts** β†’ Modifies Helm chart values +5. **ArgoCD Sync** β†’ Automatically deploys to EKS image +### **Making Changes** -### Verify Deployment +```bash +# 1. Make changes to any service +vim src/ui/src/main/resources/templates/fragments/bare.html -Check if the nodes are running: +# 2. Commit and push +git add . +git commit -m "Add new feature to UI" +git push origin gitops -```bash -kubectl get nodes +# 3. Monitor deployment +# - Check GitHub Actions: https://github.com/bashairfan0911/actions +# - Check ArgoCD UI: https://localhost:9090 ``` -### Step 8: Access the Application: +The workflow automatically detects which services changed: + +### **Component Details** + +| Component | Language | Container Image | Helm Chart | Description | +| --------------------------- | -------- | --------------------------------------------------------------------------- | --------------------------------------- | --------------------------------------- | +| [UI](./src/ui/) | Java | [ Link](https://gallery.ecr.aws/aws-containers/retail-store-sample-ui) | [ Chart](src/ui/chart/values.yaml) | Store user interface | +| [Catalog](./src/catalog/) | Go | [ Link](https://gallery.ecr.aws/aws-containers/retail-store-sample-catalog) | [ Chart](src/catalog/chart/values.yaml) | Product catalog API | +| [Cart](./src/cart/) | Java | [Link](https://gallery.ecr.aws/aws-containers/retail-store-sample-cart) | [Chart](src/cart/chart/values.yaml) | User shopping carts API | +| [Orders](./src/orders/) | Java | [Link](https://gallery.ecr.aws/aws-containers/retail-store-sample-orders) | [Chart](src/orders/chart/values.yaml) | User orders API | +| [Checkout](./src/checkout/) | Node.js | [Link](https://gallery.ecr.aws/aws-containers/retail-store-sample-checkout) | [Chart](src/checkout/chart/values.yaml) | API to orchestrate the checkout process | -The application is exposed through the NGINX Ingress Controller. Get the load balancer URL: +--- + +## Monitoring + +### **ArgoCD Dashboard** ```bash -kubectl get svc -n ingress-nginx +# Get ArgoCD admin password +kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d + +# Port-forward to ArgoCD UI +kubectl port-forward svc/argocd-server -n argocd 9090:443 & + +# Access: https://localhost:9090 +# Username: admin +# Password: (from above command) ``` -Use the EXTERNAL-IP of the ingress-nginx-controller service to access the application. +![ArgoCD UI Dashboard](./docs/images/argocd-ui.png) -image +### **Application Status** -### Step 9: Argo CD Automated Deployment: +```bash +# Check all applications +kubectl get applications -n argocd -**Verify ArgoCD installation** +# Check application health +kubectl describe application retail-store-ui -n argocd -``` -kubectl get pods -n argocd +# Check pods +kubectl get pods -n retail-store + +# Check services +kubectl get svc -n retail-store + +# Check ingress +kubectl get ingress -n retail-store ``` +## πŸ”§ Troubleshooting -### Step 10: Port-forward to Argo CD UI and login: +### **Useful Commands** -**Get ArgoCD admin password** -``` -kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d -``` +```bash +# Get cluster info +kubectl cluster-info -**Port-forward to Argo CD UI** -``` -kubectl port-forward svc/argocd-server -n argocd 8080:443 & +# Check nodes +kubectl get nodes + +# Check all namespaces +kubectl get pods -A + +# Check logs +kubectl logs -n retail-store deployment/ui + +# Check events +kubectl get events -n retail-store ``` -Open your browser and navigate to: -https://localhost:8080 +--- -Username: admin +### **Debug Commands** -Password: +```bash +# Check all resources +kubectl get all -A -### Step 10: Access ArgoCD UI +# Check events across all namespaces +kubectl get events --sort-by='.lastTimestamp' -Once ArgoCD is deployed, you can access the web interface: +# Check ArgoCD logs +kubectl logs -n argocd deployment/argocd-server +kubectl logs -n argocd deployment/argocd-application-controller -
- ArgoCD UI Dashboard -

ArgoCD UI showing deployed retail store applications

-
+# Check ingress controller logs +kubectl logs -n ingress-nginx deployment/ingress-nginx-controller + +# Check application logs +kubectl logs -n retail-store deployment/ui +kubectl logs -n retail-store deployment/catalog +``` + +--- -The ArgoCD UI provides: -- **Application Status**: Real-time sync status of all services -- **Resource View**: Detailed view of Kubernetes resources -- **Sync Operations**: Manual sync and rollback capabilities -- **Health Monitoring**: Application and resource health status +## Advanced Topics -### Step 11: Monitor Application Deployment +### **Customization** + +
+πŸ”§ Enable Monitoring ```bash -kubectl get pods -n retail-store -kubectl get ingress -n retail-store +# Edit terraform/addons.tf +enable_kube_prometheus_stack = true + +# Apply changes +terraform apply --auto-approve + +# Access Grafana +kubectl port-forward svc/kube-prometheus-stack-grafana -n monitoring 3000:80 ``` -### Step 12: Cleanup +
-To delete all resources created by Terraform: +--- +## Cleanup -**For Phase 1: Run this command** +### **Destroy Infrastructure** ```bash +cd terraform/ + +# Option 1: Destroy everything at once +terraform destroy --auto-approve + +# Option 2: Destroy in phases (recommended) +terraform destroy -target=module.eks_addons --auto-approve terraform destroy -target=module.retail_app_eks --auto-approve +terraform destroy --auto-approve ``` +image -**For Phase 2: Run this command** -``` -terraform destroy --auto-approve +### **Clean Up ECR Repositories** + +```bash +# Delete ECR repositories (manual step) +aws ecr delete-repository --repository-name retail-store-ui --force +aws ecr delete-repository --repository-name retail-store-catalog --force +aws ecr delete-repository --repository-name retail-store-cart --force +aws ecr delete-repository --repository-name retail-store-checkout --force +aws ecr delete-repository --repository-name retail-store-orders --force ``` -image +### **Remove GitHub Secrets** + +1. Go to GitHub repository β†’ **Settings** β†’ **Secrets and variables** β†’ **Actions** +2. Delete all AWS-related secrets -> [!NOTE] -> Only ECR Repositories you need to Delete it from AWS Console Manually. +--- +## 🀝 Contributing +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 This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICENSE) file for details. + +--- + +## πŸ™ Acknowledgments + +- **AWS Containers Team** for the original sample application +- **ArgoCD Community** for the excellent GitOps tooling +- **Terraform Community** for the AWS modules +- **GitHub Actions** for the CI/CD platform + +--- + +
+ +**⭐ Star this repository if you found it helpful!** + +**πŸ”„ For advanced GitOps workflows, see [BRANCHING_STRATEGY.md](./BRANCHING_STRATEGY.md)** + +
diff --git a/access-monitoring.md b/access-monitoring.md new file mode 100644 index 000000000..b6b5138b9 --- /dev/null +++ b/access-monitoring.md @@ -0,0 +1,58 @@ +# Access Monitoring Stack + +## Grafana Dashboard + +### Step 1: Start Port Forward +Open a **new terminal window** and run: +```bash +kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80 +``` + +### Step 2: Access Grafana +Open your browser and go to: **http://localhost:3000** + +### Step 3: Login +- Username: `admin` +- Password: `prom-operator` + +Keep the terminal window open while using Grafana! + +--- + +## Prometheus + +### Step 1: Start Port Forward +Open a **new terminal window** and run: +```bash +kubectl port-forward -n monitoring svc/kube-prometheus-stack-prometheus 9090:9090 +``` + +### Step 2: Access Prometheus +Open your browser and go to: **http://localhost:9090** + +--- + +## Quick Access Script (Windows PowerShell) + +Save this as `start-monitoring.ps1`: + +```powershell +# Start Grafana +Start-Process powershell -ArgumentList "-NoExit", "-Command", "kubectl port-forward -n monitoring svc/kube-prometheus-stack-grafana 3000:80" + +# Wait a bit +Start-Sleep -Seconds 2 + +# Start Prometheus +Start-Process powershell -ArgumentList "-NoExit", "-Command", "kubectl port-forward -n monitoring svc/kube-prometheus-stack-prometheus 9090:9090" + +# Open browsers +Start-Sleep -Seconds 3 +Start-Process "http://localhost:3000" +Start-Process "http://localhost:9090" + +Write-Host "Grafana: http://localhost:3000 (admin/prom-operator)" +Write-Host "Prometheus: http://localhost:9090" +``` + +Then run: `.\start-monitoring.ps1` diff --git a/argocd/applications/retail-store-cart.yaml b/argocd/applications/retail-store-cart.yaml index 041ad3fcd..3936188fe 100644 --- a/argocd/applications/retail-store-cart.yaml +++ b/argocd/applications/retail-store-cart.yaml @@ -8,7 +8,7 @@ metadata: spec: project: retail-store source: - repoURL: https://github.com/LondheShubham153/retail-store-sample-app + repoURL: https://github.com/bashairfan0911/retail-store-sample-app targetRevision: gitops path: src/cart/chart helm: diff --git a/argocd/applications/retail-store-catalog.yaml b/argocd/applications/retail-store-catalog.yaml index 50cadc600..dd828b572 100644 --- a/argocd/applications/retail-store-catalog.yaml +++ b/argocd/applications/retail-store-catalog.yaml @@ -8,7 +8,7 @@ metadata: spec: project: retail-store source: - repoURL: https://github.com/LondheShubham153/retail-store-sample-app + repoURL: https://github.com/bashairfan0911/retail-store-sample-app targetRevision: gitops path: src/catalog/chart helm: diff --git a/argocd/applications/retail-store-checkout.yaml b/argocd/applications/retail-store-checkout.yaml index e9a260296..3717a1b3a 100644 --- a/argocd/applications/retail-store-checkout.yaml +++ b/argocd/applications/retail-store-checkout.yaml @@ -8,7 +8,7 @@ metadata: spec: project: retail-store source: - repoURL: https://github.com/LondheShubham153/retail-store-sample-app + repoURL: https://github.com/bashairfan0911/retail-store-sample-app targetRevision: gitops path: src/checkout/chart helm: diff --git a/argocd/applications/retail-store-orders.yaml b/argocd/applications/retail-store-orders.yaml index 6cfde9f3a..68ca0a704 100644 --- a/argocd/applications/retail-store-orders.yaml +++ b/argocd/applications/retail-store-orders.yaml @@ -8,7 +8,7 @@ metadata: spec: project: retail-store source: - repoURL: https://github.com/LondheShubham153/retail-store-sample-app + repoURL: https://github.com/bashairfan0911/retail-store-sample-app targetRevision: gitops path: src/orders/chart helm: diff --git a/argocd/applications/retail-store-ui.yaml b/argocd/applications/retail-store-ui.yaml index 2c6ceaced..f9f26ed3a 100644 --- a/argocd/applications/retail-store-ui.yaml +++ b/argocd/applications/retail-store-ui.yaml @@ -8,7 +8,7 @@ metadata: spec: project: retail-store source: - repoURL: https://github.com/LondheShubham153/retail-store-sample-app + repoURL: https://github.com/bashairfan0911/retail-store-sample-app targetRevision: gitops path: src/ui/chart helm: diff --git a/argocd/projects/retail-store-project.yaml b/argocd/projects/retail-store-project.yaml index 3eb3a0762..01a05766a 100644 --- a/argocd/projects/retail-store-project.yaml +++ b/argocd/projects/retail-store-project.yaml @@ -7,7 +7,7 @@ spec: description: Retail Store Sample Application sourceRepos: - - 'https://github.com/LondheShubham153/retail-store-sample-app' + - 'https://github.com/bashairfan0911/retail-store-sample-app' destinations: - namespace: retail-store diff --git a/docs/images/EKS.gif b/docs/images/EKS.gif new file mode 100644 index 000000000..745ac3495 Binary files /dev/null and b/docs/images/EKS.gif differ diff --git a/docs/images/architecture.png b/docs/images/architecture.png index c3671fe91..7c35538a0 100644 Binary files a/docs/images/architecture.png and b/docs/images/architecture.png differ diff --git a/docs/images/argocd-ui.png b/docs/images/argocd-ui.png new file mode 100644 index 000000000..2c3324211 Binary files /dev/null and b/docs/images/argocd-ui.png differ diff --git a/monitoring-ingress.yaml b/monitoring-ingress.yaml new file mode 100644 index 000000000..3df3eb259 --- /dev/null +++ b/monitoring-ingress.yaml @@ -0,0 +1,39 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grafana + namespace: monitoring + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - http: + paths: + - path: /grafana + pathType: Prefix + backend: + service: + name: kube-prometheus-stack-grafana + port: + number: 80 +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: prometheus + namespace: monitoring + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - http: + paths: + - path: /prometheus + pathType: Prefix + backend: + service: + name: kube-prometheus-stack-prometheus + port: + number: 9090 diff --git a/push-to-github.ps1 b/push-to-github.ps1 new file mode 100644 index 000000000..ed11fa6b2 --- /dev/null +++ b/push-to-github.ps1 @@ -0,0 +1,40 @@ +# Push Changes to GitHub +Write-Host "Pushing changes to GitHub..." -ForegroundColor Green +Write-Host "" + +# Check current branch +$branch = git branch --show-current +Write-Host "Current branch: $branch" -ForegroundColor Cyan + +# Add all changes +Write-Host "Adding files..." -ForegroundColor Yellow +git add . + +# Show status +Write-Host "" +Write-Host "Files to be committed:" -ForegroundColor Yellow +git status --short + +# Commit +Write-Host "" +$commitMessage = Read-Host "Enter commit message (or press Enter for default)" +if ([string]::IsNullOrWhiteSpace($commitMessage)) { + $commitMessage = "Add monitoring stack and access documentation" +} + +Write-Host "Committing with message: $commitMessage" -ForegroundColor Yellow +git commit -m "$commitMessage" + +# Push +Write-Host "" +Write-Host "Pushing to origin/$branch..." -ForegroundColor Yellow +git push origin $branch + +Write-Host "" +Write-Host "==================================================" -ForegroundColor Green +Write-Host "Successfully pushed to GitHub!" -ForegroundColor Green +Write-Host "==================================================" -ForegroundColor Green +Write-Host "" +Write-Host "View your changes at:" -ForegroundColor Cyan +Write-Host "https://github.com/bashairfan0911/retail-store-sample-app/tree/$branch" -ForegroundColor White +Write-Host "" diff --git a/retail-store-servicemonitors.yaml b/retail-store-servicemonitors.yaml new file mode 100644 index 000000000..564050bca --- /dev/null +++ b/retail-store-servicemonitors.yaml @@ -0,0 +1,94 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: retail-store-ui + namespace: monitoring + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: ui + namespaceSelector: + matchNames: + - retail-store + endpoints: + - port: http + path: /actuator/prometheus + interval: 30s +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: retail-store-catalog + namespace: monitoring + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: catalog + namespaceSelector: + matchNames: + - retail-store + endpoints: + - port: http + path: /actuator/prometheus + interval: 30s +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: retail-store-cart + namespace: monitoring + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: carts + namespaceSelector: + matchNames: + - retail-store + endpoints: + - port: http + path: /actuator/prometheus + interval: 30s +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: retail-store-checkout + namespace: monitoring + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: checkout + namespaceSelector: + matchNames: + - retail-store + endpoints: + - port: http + path: /actuator/prometheus + interval: 30s +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: retail-store-orders + namespace: monitoring + labels: + release: kube-prometheus-stack +spec: + selector: + matchLabels: + app.kubernetes.io/name: orders + namespaceSelector: + matchNames: + - retail-store + endpoints: + - port: http + path: /actuator/prometheus + interval: 30s diff --git a/scripts/update-helm-values.sh b/scripts/update-helm-values.sh deleted file mode 100755 index 53c08697f..000000000 --- a/scripts/update-helm-values.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e - -# A list of all services to update -SERVICES=("cart" "catalog" "checkout" "orders" "ui") -TAG="1.2.2" - -echo "Updating values.yaml files to use public ECR images..." - -# Function to detect OS and use appropriate sed command -sed_inplace() { - if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS requires backup extension (using empty string) - sed -i '' "$@" - else - # Linux doesn't require backup extension - sed -i "$@" - fi -} - -for SERVICE in "${SERVICES[@]}"; do - FILE_PATH="src/${SERVICE}/chart/values.yaml" - PUBLIC_REGISTRY="public.ecr.aws/aws-containers/retail-store-sample-${SERVICE}" - - if [ -f "$FILE_PATH" ]; then - echo "Processing ${FILE_PATH}..." - - # Using sed to replace the repository and tag lines. - # The | separator is used to avoid issues with slashes in the path. - sed_inplace "s|^ repository:.*| repository: ${PUBLIC_REGISTRY}|" "$FILE_PATH" - sed_inplace "s|^ tag:.*| tag: \"${TAG}\"|" "$FILE_PATH" - - echo "Updated ${FILE_PATH}" - echo " Repository: ${PUBLIC_REGISTRY}" - echo " Tag: ${TAG}" - echo "" - else - echo "ERROR: File not found at ${FILE_PATH}" - exit 1 - fi -done - -echo "All services updated successfully!" -echo "" -echo "Updated services:" -for SERVICE in "${SERVICES[@]}"; do - echo " - ${SERVICE}: public.ecr.aws/aws-containers/retail-store-sample-${SERVICE}:${TAG}" -done \ No newline at end of file diff --git a/src/cart/README.md b/src/cart/README.md index e292059ad..475d3148c 100644 --- a/src/cart/README.md +++ b/src/cart/README.md @@ -1,6 +1,10 @@ # AWS Containers Retail Sample - Cart Service - + + + +**Status:** βœ… Deployed and Running on EKS +**Version:** Latest from gitops branch | Language | Persistence | | -------- | --------------- | @@ -9,9 +13,8 @@ This service provides an API for storing customer shopping carts. Data is stored in Amazon DynamoDB. ## Configuration - The following environment variables are available for configuring the service: - + | Name | Description | Default | | ----------------------------------------------- | ------------------------------------------------------------------ | ----------- | | `PORT` | The port which the server will listen on | `8080` | diff --git a/src/cart/chart/values.yaml b/src/cart/chart/values.yaml index aafdc3490..902a0d8fc 100644 --- a/src/cart/chart/values.yaml +++ b/src/cart/chart/values.yaml @@ -4,9 +4,9 @@ replicaCount: 1 image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-cart + repository: 485126686729.dkr.ecr.us-west-2.amazonaws.com/retail-store-cart pullPolicy: Always - tag: "f621162" + tag: "161f5b0" imagePullSecrets: - name: regcred nameOverride: "" diff --git a/src/catalog/README.md b/src/catalog/README.md index ce7d1d143..686a11cc1 100644 --- a/src/catalog/README.md +++ b/src/catalog/README.md @@ -1,6 +1,10 @@ # AWS Containers Retail Sample - Catalog Service - + + + +**Status:** βœ… Deployed and Running on EKS +**Version:** Latest from gitops branch | Language | Persistence | | -------- | ----------- | @@ -21,11 +25,11 @@ The following environment variables are available for configuring the service: | RETAIL_CATALOG_PERSISTENCE_USER | Database user | `catalog_user` | | RETAIL_CATALOG_PERSISTENCE_PASSWORD | Database password | `""` | | RETAIL_CATALOG_PERSISTENCE_CONNECT_TIMEOUT | Database connection timeout in seconds | `5` | - + ## Endpoints - + Several "utility" endpoints are provided with useful functionality for various scenarios: - + | Method | Name | Description | | -------- | ------------------------ | ---------------------------------------------------------------------------------- | | `POST` | `/chaos/status/{code}` | All HTTP requests to API paths will return the given HTTP status code | diff --git a/src/catalog/chart/values.yaml b/src/catalog/chart/values.yaml index 6ef71f599..6eaa0e9e8 100644 --- a/src/catalog/chart/values.yaml +++ b/src/catalog/chart/values.yaml @@ -4,9 +4,9 @@ replicaCount: 1 image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-catalog + repository: 485126686729.dkr.ecr.us-west-2.amazonaws.com/retail-store-catalog pullPolicy: Always - tag: "0fd57ea" + tag: "1739e6b" imagePullSecrets: - name: regcred nameOverride: "" @@ -70,9 +70,9 @@ app: mysql: create: false image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-catalog + repository: public.ecr.aws/docker/library/mysql pullPolicy: IfNotPresent - tag: "0fd57ea" + tag: "8.0" service: type: ClusterIP port: 3306 diff --git a/src/checkout/README.md b/src/checkout/README.md index c65815ca0..2c9dd5aa4 100644 --- a/src/checkout/README.md +++ b/src/checkout/README.md @@ -1,6 +1,10 @@ # AWS Containers Retail Sample - Checkout Service - + + + +**Status:** βœ… Deployed and Running on EKS +**Version:** Latest from gitops branch | Language | Persistence | | -------- | ----------- | @@ -19,9 +23,9 @@ The following environment variables are available for configuring the service: | `RETAIL_CHECKOUT_PERSISTENCE_REDIS_URL` | The endpoint of the Redis server used to store state. | `""` | | `RETAIL_CHECKOUT_ENDPOINTS_ORDERS` | The endpoint of the orders API. If empty uses a mock implementation | `""` | | `RETAIL_CHECKOUT_SHIPPING_NAME_PREFIX` | A string prefix that can be applied to the names of the shipping options | `""` | - + ## Endpoints - + Several "utility" endpoints are provided with useful functionality for various scenarios: | Method | Name | Description | diff --git a/src/checkout/chart/values.yaml b/src/checkout/chart/values.yaml index 462eee992..01b9cc8e1 100644 --- a/src/checkout/chart/values.yaml +++ b/src/checkout/chart/values.yaml @@ -4,9 +4,9 @@ replicaCount: 1 image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-checkout + repository: 485126686729.dkr.ecr.us-west-2.amazonaws.com/retail-store-checkout pullPolicy: Always - tag: "4e06597" + tag: "1739e6b" imagePullSecrets: - name: regcred nameOverride: '' @@ -67,9 +67,9 @@ app: redis: create: false image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-checkout + repository: public.ecr.aws/docker/library/redis pullPolicy: IfNotPresent - tag: "4e06597" + tag: "6.0-alpine" service: type: ClusterIP port: 6379 diff --git a/src/orders/README.md b/src/orders/README.md index 078737c30..af046835a 100644 --- a/src/orders/README.md +++ b/src/orders/README.md @@ -1,12 +1,14 @@ # AWS Containers Retail Sample - Orders Service - + + + +**Status:** βœ… Deployed and Running on EKS +**Version:** Latest from gitops branch | Language | Persistence | | -------- | ----------- | | Java | MySQL | -| -------- | ----------- | -| Java | MySQL | This service provides an API for storing orders. Data is stored in MySQL. diff --git a/src/orders/chart/values.yaml b/src/orders/chart/values.yaml index 55243afe0..3a52049b5 100644 --- a/src/orders/chart/values.yaml +++ b/src/orders/chart/values.yaml @@ -4,9 +4,9 @@ replicaCount: 1 image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-orders + repository: 485126686729.dkr.ecr.us-west-2.amazonaws.com/retail-store-orders pullPolicy: Always - tag: "3b4d73a" + tag: "1739e6b" imagePullSecrets: - name: regcred nameOverride: "" @@ -79,9 +79,9 @@ app: postgresql: create: false image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-orders + repository: public.ecr.aws/docker/library/postgres pullPolicy: IfNotPresent - tag: "3b4d73a" + tag: "13" service: type: ClusterIP port: 5432 @@ -100,9 +100,9 @@ postgresql: rabbitmq: create: false image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-orders + repository: public.ecr.aws/docker/library/rabbitmq pullPolicy: IfNotPresent - tag: "3b4d73a" + tag: "3.8-management" service: type: ClusterIP amqp: diff --git a/src/ui/README.md b/src/ui/README.md index f5b1390c1..1f4d69f78 100644 --- a/src/ui/README.md +++ b/src/ui/README.md @@ -1,6 +1,10 @@ # AWS Containers Retail Sample - UI Service - + + + +**Status:** βœ… Deployed and Running on EKS +**Version:** Latest from gitops branch | Language | Persistence | | -------- | ----------- | diff --git a/src/ui/chart/values.yaml b/src/ui/chart/values.yaml index 2007a7789..62662fa16 100644 --- a/src/ui/chart/values.yaml +++ b/src/ui/chart/values.yaml @@ -1,12 +1,12 @@ -# Default values for ui. +# Default values for orders. # This is a YAML-formatted file. # Declare variables to be passed into your templates. replicaCount: 1 image: - repository: 220755213644.dkr.ecr.us-west-2.amazonaws.com/retail-store-ui + repository: 485126686729.dkr.ecr.us-west-2.amazonaws.com/retail-store-ui pullPolicy: Always - tag: "4a6b314" + tag: "38efcb1" imagePullSecrets: - name: regcred nameOverride: "" @@ -26,28 +26,24 @@ securityContext: capabilities: drop: - ALL - add: - - NET_BIND_SERVICE readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 service: type: ClusterIP port: 80 - # annotations: {} - # loadBalancerClass: "" - # nodePort: 30000 resources: limits: memory: 512Mi requests: - cpu: 128m + cpu: 256m memory: 512Mi autoscaling: enabled: false minReplicas: 1 maxReplicas: 10 - targetCPUUtilizationPercentage: 50 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 nodeSelector: {} tolerations: [] affinity: {} @@ -60,82 +56,93 @@ metrics: prometheus.io/path: "/actuator/prometheus" configMap: create: true - name: # if blank this will be generated + name: app: - # theme: default - endpoints: - catalog: http://retail-store-catalog:80 - carts: http://retail-store-cart-carts:80 - orders: http://retail-store-orders:80 - checkout: http://retail-store-checkout:80 + theme: "" chat: enabled: false provider: "" model: "" - # temperature: 0.7 - # maxTokens: 300 - # prompt: | - # This will override the default system prompt - bedrock: - region: "" + temperature: "" + maxTokens: "" + prompt: "" openai: baseUrl: "" - # apiKey: "" -## Ingress for NGINX Ingress Controller -ingress: - enabled: false - className: "nginx" - annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "false" - nginx.ingress.kubernetes.io/force-ssl-redirect: "false" - cert-manager.io/cluster-issuer: "letsencrypt-prod" - nginx.ingress.kubernetes.io/proxy-body-size: "8m" - nginx.ingress.kubernetes.io/proxy-connect-timeout: "30" - nginx.ingress.kubernetes.io/proxy-send-timeout: "600" - nginx.ingress.kubernetes.io/proxy-read-timeout: "600" - tls: [] - hosts: [] -ingresses: - # Direct ELB access - no host restriction - - name: direct - className: "nginx" - hosts: [] - annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "false" - nginx.ingress.kubernetes.io/force-ssl-redirect: "false" - nginx.ingress.kubernetes.io/proxy-body-size: "8m" - nginx.ingress.kubernetes.io/proxy-connect-timeout: "30" - nginx.ingress.kubernetes.io/proxy-send-timeout: "600" - nginx.ingress.kubernetes.io/proxy-read-timeout: "600" - tls: [] - # Domain-based access with SSL - - name: domain - className: "nginx" - hosts: - - retail-store.trainwithshubham.com - annotations: - nginx.ingress.kubernetes.io/ssl-redirect: "true" - nginx.ingress.kubernetes.io/force-ssl-redirect: "true" - cert-manager.io/cluster-issuer: "letsencrypt-prod" - nginx.ingress.kubernetes.io/proxy-body-size: "8m" - nginx.ingress.kubernetes.io/proxy-connect-timeout: "30" - nginx.ingress.kubernetes.io/proxy-send-timeout: "600" - nginx.ingress.kubernetes.io/proxy-read-timeout: "600" - tls: - - secretName: tls-secret - hosts: - - retail-store.trainwithshubham.com - -# Cert Manager Configuration -certManager: - createClusterIssuer: true - email: trainwithshubham@gmail.com - clusterIssuerName: "letsencrypt-prod" - server: "https://acme-v02.api.letsencrypt.org/directory" - privateKeySecretName: "letsencrypt-prod-key" -istio: - enabled: false - hosts: [] + apiKey: "" + bedrock: + region: "" + endpoints: + catalog: "http://retail-store-catalog" + carts: "http://retail-store-cart-carts" + checkout: "http://retail-store-checkout" + orders: "http://retail-store-orders" + assets: "" + persistence: + provider: 'in-memory' + endpoint: '' + database: 'orders' + secret: + create: true + name: orders-db + username: orders + password: "" + messaging: + provider: 'in-memory' + rabbitmq: + addresses: [] + secret: + create: true + name: orders-rabbitmq + username: "" + password: "" +postgresql: + create: false + image: + repository: public.ecr.aws/docker/library/postgres + pullPolicy: IfNotPresent + tag: "13" + service: + type: ClusterIP + port: 5432 + podAnnotations: {} + nodeSelector: {} + tolerations: [] + affinity: {} + persistentVolume: + enabled: false + annotations: {} + labels: {} + accessModes: + - ReadWriteOnce + size: 10Gi + # storageClass: gp2 +rabbitmq: + create: false + image: + repository: public.ecr.aws/docker/library/rabbitmq + pullPolicy: IfNotPresent + tag: "3.8-management" + service: + type: ClusterIP + amqp: + port: 5672 + http: + port: 15672 + podAnnotations: {} + nodeSelector: {} + tolerations: [] + affinity: {} + persistentVolume: + enabled: false + annotations: {} + labels: {} + accessModes: + - ReadWriteOnce + size: 10Gi + # storageClass: gp2 +securityGroups: + create: false + securityGroupIds: [] opentelemetry: enabled: false instrumentation: "" @@ -143,3 +150,20 @@ podDisruptionBudget: enabled: false minAvailable: 2 maxUnavailable: 1 + +certManager: + createClusterIssuer: false + clusterIssuerName: "letsencrypt-prod" + server: "https://acme-v02.api.letsencrypt.org/directory" + email: "" + privateKeySecretName: "" + +ingress: + enabled: true + className: "nginx" + annotations: {} + hosts: [] + tls: [] + +istio: + enabled: false diff --git a/src/ui/src/main/resources/templates/home.html b/src/ui/src/main/resources/templates/home.html index ce6191e66..9508c4078 100644 --- a/src/ui/src/main/resources/templates/home.html +++ b/src/ui/src/main/resources/templates/home.html @@ -149,12 +149,12 @@

- The most public Secret Shop + The most public Secret Shop by TWS

- Everything a secret agent needs, minus the paperwork + Hello Dosto, Kaisa laga video, agar maza aaya toh LIKE. SHARE. SUBSCRIBE.