English | π―π΅ ζ₯ζ¬θͺ
This repository is a monorepo for managing microservices and modular frontend applications. It provides unified management of cloud-native applications with automated CI/CD pipelines powered by GitHub Actions, supporting both infrastructure (Terragrunt) and application (Kubernetes) deployments.
- Architecture: Microservices with modular frontend components
- Infrastructure Management: Infrastructure as Code with Terragrunt + Terraform
- CI/CD: Automated deployment pipelines with label-driven selective deployment
- Environments: 3-tier environment structure (develop / staging / production)
- Deployment Strategy: Parallel execution of infrastructure and application deployments
- Target Users: Developers, DevOps Engineers, System Administrators
- Microservices: Independently deployable backend services
- Modular Frontend: Component-based frontend applications with independent deployment capabilities
- Automation System: Label-driven deployment with parallel execution
- Configuration Management: Unified configuration and policy management across environments
This monorepo aims to support scalable and maintainable system development while facilitating collaboration between teams.
Each service follows a standardized directory structure supporting multiple deployment stacks:
.
βββ terragrunt/ # Infrastructure stack
β βββ envs/{environment}/ # Environment-specific configurations
βββ kubernetes/ # Application stack (if needed)
β βββ overlays/{environment}/ # Environment-specific overlays
βββ src/(Application code) # Implementation
βββ docker # Dockerfile
- Stack-based Architecture: Services support multiple deployment stacks (terragrunt, kubernetes, and others)
- Environment Isolation: Separate configurations for each environment (develop/staging/production)
- Extensible Design: Additional stacks can be easily added to any service as needed
This repository adopts an environment-based branch strategy:
βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββββββ
β feature/* ββββββΆβ develop βββββββΆβ staging ββββββΆβ production β
β branch β β branch β β branch β β branch β
βββββββββββββββ βββββββββββββββ βββββββββββββββ ββββββββββββββββ
β β β β
PR Creation PR Creation PR Creation PR Creation
β β β β
Auto-labeling Auto-labeling Auto-labeling Auto-labeling
β β β β
βββββββββββββ βββββββββββββββββ βββββββββββββββ ββββββββββββββββββ
β develop β β develop/svc β βstaging/svc β βproduction/svc β
β deploy β β deploy β βdeploy β βdeploy β
βββββββββββββ βββββββββββββββββ βββββββββββββββ ββββββββββββββββββ
develop: Deploy changed services to development environmentstaging: Deploy changed services to staging environmentproduction: Deploy changed services to production environment
- Feature Development: Develop on
feature/*branches - PR Creation: Create PR to
developbranch - Auto-labeling: Changed services automatically get
deploy:{service}labels - Review & Merge: Code review followed by merge
- Auto-deployment: After merge, relevant services automatically deploy to appropriate environment
develop environment β staging environment β production environment
(Service-specific) (Service-specific) (Service-specific)
flowchart TD
A[π File Changes] --> B[π·οΈ Label Dispatcher]
B --> C[deploy:service-a<br/>deploy:service-b]
C --> D{π Event Type}
D -->|PR Event| E[π Preview Mode]
D -->|Merge Event| F[π Apply Mode]
E --> G[π‘οΈ Safety Check & Environment Detection]
F --> G
G --> H[β‘ Parallel Stack Execution]
H --> I[ποΈ Terragrunt Executor]
H --> J[π― Kubernetes Executor]
I -->|Preview| K[π terraform plan]
I -->|Apply| L[π terraform apply]
J -->|Preview| M[π kubectl diff]
J -->|Apply| N[π kubectl apply]
K --> O[π PR Comment<br/>Infrastructure Changes]
M --> P[π PR Comment<br/>Manifest Changes]
L --> Q[βοΈ AWS Infrastructure<br/>Updated]
N --> R[π¦ GitOps Repository<br/>Manifest Committed]
R --> S[π FluxCD Sync]
S --> T[π― Kubernetes Cluster<br/>Updated]
style E fill:#e1f5fe
style F fill:#f3e5f5
style I fill:#fff8e1
style J fill:#e8f5e8
Execution Example:
# File changes detected
apps/web/user-portal/src/* β deploy:user-portal
services/api-gateway/src/* β deploy:api-gateway
# PR creation on develop branch
π terragrunt plan + kubectl diff β π PR comments show changes
# Merge on develop branch
π terragrunt apply β βοΈ AWS / kubectl apply β π¦ GitOps β π FluxCD β π― K8s- Function: Detects file changes and automatically assigns
deploy:{service}labels to changed services - Trigger: PR creation/update
- Benefits: Eliminates manual labeling work, clarifies deployment targets
- Function: Executes deployment operations based on PR labels and event type
- Preview Mode: On PR creation/update - runs infrastructure plan and manifest diff
- Apply Mode: On PR merge - executes actual infrastructure and application deployment
- Multi-Stack Support: Supports multiple deployment stacks (terragrunt, kubernetes, and others) in parallel
- Trigger: PR events and branch push events
- Safety: Requires PR-based merges, prevents deployment on direct pushes
- Function: Infrastructure deployment using Terragrunt + Terraform
- Plan Mode: On PR events - generates and displays infrastructure changes
- Apply Mode: On merge events - executes actual infrastructure deployment
- AWS Integration: OIDC authentication with environment-specific IAM roles
- Function: Application deployment using Kubernetes manifests
- Diff Mode: On PR events - generates and displays manifest changes with PR comments
- Apply Mode: On merge events - commits manifests to GitOps repository
- GitOps: Integrates with separate GitOps repository for manifest management
The deployment system uses workflow-config.yaml to define:
environments:
- environment: develop
aws_region: ap-northeast-1
iam_role_plan: arn:aws:iam::559744160976:role/github-oidc-auth-develop-github-actions-role
iam_role_apply: arn:aws:iam::559744160976:role/github-oidc-auth-develop-github-actions-role
directory_conventions:
- root: "apps/web/{service}"
stacks:
- name: terragrunt
directory: "terragrunt/envs/{environment}"
- name: kubernetes
directory: "kubernetes/overlays/{environment}"
- root: "services/{service}"
stacks:
- name: terragrunt
directory: "terragrunt/envs/{environment}"
- name: kubernetes
directory: "kubernetes/overlays/{environment}"- Selective Deployment: Execute deployment only for changed services
- Parallel Processing: Concurrent deployment of multiple services and deployment stacks
- Multi-Stack Support: Flexible support for terragrunt, kubernetes, and additional deployment stacks
- Resource Optimization: Eliminate unnecessary executions across all stack types
- GitOps Integration: Kubernetes manifests managed via separate repository
- Preview Capabilities: Infrastructure plan and manifest diff on PRs
- PR Required: Prevents deployment from direct pushes
- Environment Isolation: Environment-specific IAM role access control
- Deployment Halt: Automatic stop in uncertain situations
- OIDC Authentication: Keyless authentication without long-term credentials
- Audit Logging: Record all deployment operations
- Terragrunt + Terraform: Infrastructure as Code
- Kubernetes: Container orchestration and application deployment
- AWS: Cloud platform
- GitHub Actions: CI/CD pipeline and OIDC authentication
Each service follows a consistent structure:
- Microservices: Independent backend services with their own technology stack
- Frontend Modules: Component-based frontend applications with independent deployment capabilities
- Multi-Stack Deployment: Services can use multiple deployment stacks as needed:
- Terragrunt: Infrastructure provisioning and management
- Kubernetes: Container orchestration and application deployment
- Additional Stacks: Extensible to support other deployment methods (serverless, static sites, etc.)
This repository provides a foundation for scalable microservice and modular frontend development with comprehensive CI/CD automation.