Skip to content

deepjoshi11th/CloudNativeTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Native Template

Microservices reference project with a Go-based user-service and Kubernetes deployment manifests for observability (Jaeger, OpenTelemetry), logging, and messaging.

Contents

  • services/user-service — Go HTTP service (port 8080), Prometheus metrics (/metrics), Redis and RabbitMQ integrations, OpenTelemetry tracing
  • kubernetes — Helm charts and manifests for deploying services and observability stack

Prerequisites

  • Go >= 1.26
  • Docker
  • Kubernetes cluster (minikube / kind / remote) and kubectl
  • (Optional) Helm for installing operator charts

Quickstart — Run user-service locally

  1. Change to the service directory:

    cd services/user-service

  2. Run with Go:

    go run .

    The service listens on port 8080. Endpoints:

    • GET /user — returns a sample user JSON
    • GET /metrics — Prometheus metrics
  3. Useful environment variables (defaults shown in code):

    • REDIS_ADDR — Redis address (default: redis-ha.redis.svc.cluster.local:6379)
    • RABBITMQ_URL — RabbitMQ connection URL
    • RABBITMQ_QUEUE — RabbitMQ queue name (default: user-events)
    • OTEL_COLLECTOR_ENDPOINT — OpenTelemetry collector endpoint (default: opentelemetry-collector.monitoring.svc.cluster.local:4317)
    • OTEL_INSECURE — set to false to disable insecure OTLP when needed

Docker

Build and run the container locally:

cd services/user-service

docker build -t user-service:local -f Dockerfile . docker run --rm -p 8080:8080
-e REDIS_ADDR=<redis_addr>
-e RABBITMQ_URL=<rabbitmq_url>
-e OTEL_COLLECTOR_ENDPOINT=<otel_endpoint>
user-service:local

Kubernetes

A set of manifests and Helm charts live in the kubernetes/ directory. To deploy the user service only:

kubectl apply -f kubernetes/user-service/deployment.yaml kubectl apply -f kubernetes/user-service/user.yaml

To bring up the observability stack, inspect kubernetes/jaeger-operator and other YAML/values files and follow those charts' READMEs.

Observability

  • Traces are sent to an OpenTelemetry Collector (OTLP/gRPC) and can be routed to Jaeger.
  • Prometheus metrics are exposed at /metrics.
  • Structured JSON logs with trace/span IDs are emitted via slog + slog-otel.

Project layout

  • services/ — microservices source and Dockerfiles
  • kubernetes/ — deployment manifests, Helm charts and values

Architecture

This repository follows a cloud-native microservice architecture:

  • user-service: Go HTTP service exposing /user and /metrics, integrates with Redis and RabbitMQ, and exports traces to an OpenTelemetry Collector.
  • Messaging: RabbitMQ for async events; default queue: user-events.
  • Data/Cache: Redis used for simple counters and ephemeral state.
  • Observability: OpenTelemetry Collector + Jaeger for tracing, Prometheus for metrics, and structured JSON logs (slog + slog-otel).

Architecture diagram

  • Add diagrams or screenshots to docs/images/ (create this folder and commit images there).

  • Recommended formats: PNG, SVG. Keep filenames short and descriptive (e.g., architecture.png).

  • Example markdown to include an image in this README:

    Architecture

Contributing

Contributions welcome. Open an issue or a PR with a clear description. Prefer small, focused changes. Add tests where appropriate.

Notes

  • No LICENSE file included. Add a LICENSE at repository root if you want to specify terms.
  • This README is a starting point; expand service-specific docs as features evolve.

About

This is a cloud native project using CNCF components in a production grade service implemented with golang. The service can be used as a reusable golden template. The kubernetes cluster having prometheus, grafana,loki, open telemetry collctor, jaeger, redis, rabbitmq, cert-manager,core-dns, traefik and more to count.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors