msa-event-market is an e-ecommerce toy project for personal study. msa-event-market aims to build as an MSA (Micro Service Architecture) and EDA (Event-Driven Architecture) based on K8s (Kubernetes). msa-event-market services are deployed, operated, and monitored on K8s cluster. In addition, DB, message queue, cache, proxy, log analyzer/collector, metric collector, and CI/CD tool used by msa-event-market services also operate on K8s cluster.
msa-event-market project's component stack
msa-event-market project is composed of the following git repositories.
-
helm-charts : Helm charts of DB, message queue, cache, proxy, log analyzer/collector, metric collector, and CI/CD tool used by msa-event-market services.
-
service-auth : Auth service manages user information and is responsible for authentication/authorization of msa-event-market service. Auth service is developed with Golang.
-
service-store : Store service manages store and product inventory. Store service is developed with Java on SpringBoot.
-
deploy-services : Service deployment configuration git repository for GitOps.
The following considerations are reflected in msa-event-market services.
-
Architecture - Each msa-event-market service follows the clean architecture.
-
Service mesh - msa-event-market services run on service mesh for detailed traffic control and easy monitoring. Service mesh is applied through Istio. Istio uses OpenTracing for easy request tracing between multiple services.
-
Event-driven architecture - msa-event-market services use event-driven architecture for loose coupling and asynchronous processing. Kafka is used as the event of msa-event-market services.
-
Transaction pattern - msa-event-market services use saga pattern and outbox pattern for stable transaction processing with debezium outbox router.
-
API - msa-event-market services support HTTP and gRPC as APIs. HTTP API is provided for external clients, and gRPC API is provided for use between msa-event-market services. HTTP API is exposed through OpenAPI 3.0 and swagger. GRPC API supports reflection to discover services.
-
Healthz endpoint - msa-event-market services supports the "/healthz" endpoint that can check the operating status of the service. The "/healthz" endpoint is used when configuring the liveness/readiness probe on K8s cluster.
-
Gracefully shutdown - msa-event-market services supports gracefully shutdown to minimize deployment impact. K8s sends SIGTERM signal to notify the app of termination before the app termination. Therefore, when msa-event-market services receive a sigterm signal, they terminate the service gracefully.
-
Log - msa-event-market services output the log in plain text format for easy debugging in a personal development environment, and output the log in JSON format for easy parsing when operating in K8s Cluster. Logs of msa-event-market services are collected by Fluentd and stored in Elastic Search. All request related logs output TraceID based on OpenTracing to make it easy to trace the request.
-
Metric - Metrics of msa-event-market services are collected through Prometheus and exporter, and visualized through Grafana.
-
CI/CD - msa-event-market services use CI/CD for stable service distribution. CI (Continuous Integration) is performed through Github Actions and CD (Continuous Deployment) is performed through ArgoCD.