Skip to content

Repository files navigation

Go Web Application DevOps Project

πŸ“‹ Overview

This project demonstrates a complete end-to-end DevOps pipeline for a Golang-based web application, covering containerization, CI/CD automation, GitOps, and production-grade deployment using industry-standard tools. It provides a foundation for cloud-native applications with Kubernetes and microservices architecture.

The web application itself is a simple website built with Go's net/http package that serves static HTML pages.

πŸ“· Project Screenshots

Screenshot 1

Screenshot 2

Screenshot 3

πŸš€ Features

Application Features

  • Simple web server with multiple pages (Home, Courses, About, Contact)
  • Static content serving
  • Lightweight and fast Go-based implementation

DevOps Implementation

🐳 Containerization

  • Multi-Stage Docker Build:
    • Efficient containerization using a lightweight multi-stage Dockerfile
    • Build stage using official golang image
    • Runtime stage using minimal distroless/base image
    • Optimization for image size and security
    • Clear separation of build and runtime layers

🎑 Kubernetes Deployment

  • Base Manifests:
    • Deployment configuration with replicas and resource limits
    • Service definition for internal networking
    • ConfigMaps for environment-specific settings
    • Environment-agnostic templates for reusability

πŸ“Š Helm Chart Configuration

  • Custom Helm Charts:
    • Environment-specific values (Dev, QA, Production)
    • Parameterized templates for consistent deployments
    • Release management with versioning
    • Values overriding for environment customization

πŸ”„ CI Pipeline (GitHub Actions)

  • Automated Workflow:
    • Triggered on every Git push
    • Parallel testing and linting
    • Docker image building with caching
    • Vulnerability scanning
    • Publishing to Docker Hub or Amazon ECR
    • Status notifications

πŸ“€ CD Pipeline (ArgoCD + GitOps)

  • Declarative Delivery:
    • Git repository as single source of truth
    • ArgoCD syncing changes from Git to the cluster
    • Automatic or manual promotion between environments
    • Rollback capabilities
    • Drift detection

☁️ Kubernetes Cluster Setup

  • Amazon EKS Configuration:
    • Managed Kubernetes with Fargate profiles
    • Required node groups and IAM roles
    • Proper network configuration
    • Security groups and policies
    • kubectl, eksctl, and Helm setup for access

🌐 Ingress Controller

  • NGINX Ingress Controller:
    • External access management
    • Path-based routing configured
    • TLS/HTTPS termination
    • Rate limiting and access control

πŸ”— DNS Mapping

  • Domain Configuration:
    • Custom domain exposure
    • Integration with AWS Route53
    • ExternalDNS for automatic DNS records
    • Load balancer configuration

πŸ”§ Tech Stack & Tools

Category Tools Used
Language Golang
Containerization Docker (Multi-stage build)
Orchestration Kubernetes (EKS)
Package Management Helm
CI/CD GitHub Actions, ArgoCD
GitOps ArgoCD (Declarative delivery)
Cluster Provisioning Amazon EKS, eksctl, kubectl
Ingress NGINX Ingress Controller
Domain Management AWS Route53, ExternalDNS
Version Control Git + GitHub

πŸ“ˆ Outcomes & Benefits

  • Fully Automated Pipeline: Complete CI/CD pipeline from code push to production deployment
  • Environment Management: Environment-specific configurations and scalable Helm-based releases
  • Modern Workflow: GitOps approach aligned with current industry best practices
  • Scalability: Foundation for microservices architecture with proper networking and service discovery
  • Security: Reduced attack surface with distroless containers and proper network policies
  • Maintainability: Declarative configurations with infrastructure as code principles

🏁 Getting Started

Prerequisites

  • Go 1.18 or higher
  • Docker and Docker Compose
  • kubectl and Helm
  • AWS CLI and eksctl (for EKS deployment)
  • ArgoCD CLI (optional)

Local Development

  1. Clone the repository:

    git clone https://github.com/yourusername/go-web-app-devops.git
    cd go-web-app-devops
  2. Run the application locally:

    go run main.go
  3. Access the application at:

Docker Build & Run

# Build the Docker image
docker build -t go-web-app:latest .

# Run the container
docker run -p 8080:8080 go-web-app:latest

# Access the application at http://localhost:8080/courses

Kubernetes Deployment

Using Raw Manifests

# Apply the Kubernetes manifests
kubectl apply -f k8s/manifests/

# Verify the deployment
kubectl get pods
kubectl get svc

Using Helm

# Install using Helm
helm install go-web-app ./helm/go-web-app-chart

# Upgrade an existing release
helm upgrade go-web-app ./helm/go-web-app-chart --values ./helm/go-web-app-chart/values.yaml

EKS Deployment

Follow the detailed instructions in the eks/ directory:

  1. Prerequisites: eks/01-prereq.md
  2. Cluster Setup: eks/02-install-eks-fargate.md

Setting Up ArgoCD

Follow the GitOps setup guide in gitops/argocd/01-install.md

πŸ“ Project Structure

.
β”œβ”€β”€ Dockerfile                 # Multi-stage Docker build
β”œβ”€β”€ go.mod                     # Go module dependencies
β”œβ”€β”€ main.go                    # Main application code
β”œβ”€β”€ main_test.go               # Unit tests
β”œβ”€β”€ eks/                       # EKS cluster setup documents
β”œβ”€β”€ gitops/                    # GitOps configuration (ArgoCD)
β”œβ”€β”€ helm/                      # Helm charts for the application
β”‚   └── go-web-app-chart/
β”‚       β”œβ”€β”€ Chart.yaml
β”‚       β”œβ”€β”€ values.yaml        # Default values
β”‚       └── templates/         # Kubernetes template manifests
β”œβ”€β”€ ingress-controller/        # Ingress controller setup
β”œβ”€β”€ k8s/                       # Raw Kubernetes manifests
β”‚   └── manifests/
└── static/                    # Static web content
    β”œβ”€β”€ home.html
    β”œβ”€β”€ courses.html
    β”œβ”€β”€ about.html
    β”œβ”€β”€ contact.html
    └── images/

πŸ§ͺ Testing

Run unit tests:

go test ./...

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

End-to-end DevOps pipeline for a Golang web app using Docker, Kubernetes, GitHub Actions, Helm, and ArgoCD

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages