Introduction Overview

Contents:


Introduction: Monolith vs Microservices

Monolith: The application is deployed as a single unit, with all modules tightly coupled.
Microservices: The system consists of many small, independent services that communicate via APIs (REST/gRPC).


Challenges of Monolith Architecture

  • Difficult to scale individual components
  • Requires redeploying the entire application even for a single module change
  • Hard to maintain and onboard new developers
  • Limited adoption of new technologies

Benefits & Trade-offs of Microservices

Benefits

  • Independent deployment for each service
  • Easy to scale based on demand
  • Flexible technology choices
  • Good fault isolation

Trade-offs

  • More complex infrastructure
  • Requires service discovery, monitoring, and logging
  • Distributed data management
  • Strong CI/CD needed

Workshop Architecture Overview

Microservices

  • Gateway Service (Auth, routing)
  • Kitchen Service (Kitchen management)
  • Order Service (Orders)
  • Payment Service (Payments)
  • Stock Service (Inventory)

Tech stack

  • Golang, MongoDB, Consul, RabbitMQ, Jaeger
  • Docker, Kubernetes (EC2), Kyverno
  • Grafana, k6, gRPC, GitHub Actions

Prerequisites & Setup Requirements

Required knowledge

  • Golang + gRPC
  • Docker & Kubernetes
  • MongoDB
  • RabbitMQ basics

Environment requirements

  • Docker & kubectl installed
  • AWS account + EC2 instance
  • K8s cluster
  • Consul, RabbitMQ, Jaeger, Grafana
  • GitHub repository for CI/CD

1. Architecture Flow

system architecture

All services must register with Consul & communicate asynchronously via RabbitMQ.

  • Consul (Service Discovery)
  • Jaeger (Tracing)
  • k6 (Performance Test)
  • Docker + Kubernetes (EC2)
  • Kyverno (Policy Enforcement)
  • GitHub Actions (CI/CD)

2. Project Structure (Golang Microservice)


microservices-project/
├── gateway/
│   ├── gateway/
│   ├── public/
│   ├── go.sum
│   └── go.mod
├── common/
│   ├── api/
|   |   └──micro.pb.go
|   |   └──micro.proto
|   |   └──micro_grpc.pb.go
│   ├── broker/
│   ├── discovery/
│   ├── Makefile
│   ├── go.sum
│   └── go.mod
├── orders/
│   ├── gateway/
│   ├── go.sum
│   └── go.mod
├── kitchen/
│   ├── gateway/
│   ├── go.sum
│   └── go.mod
├── payments/
│   ├── gateway/
│   ├── processor/
│   ├── go.sum
│   └── go.mod
│
├── stock/
│   ├── store.go
│   ├── go.sum
│   └── go.mod
│
├── k8s/
│   ├── infra/
│   ├── ingress/
│   ├── kyverno\_policy/
│   └── services/
│
├── .github/workflows/
│
└── README.md