Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
.PHONY: help build up down restart logs health test test-simple clean

# 기본 타겟
help:
@echo "Available commands:"
@echo " make build - Gradle 빌드"
@echo " make up - 전체 환경 시작"
@echo " make down - 전체 환경 중지"
@echo " make restart - 전체 환경 재시작"
@echo " make logs - 로그 확인"
@echo " make health - 헬스체크"
@echo " make test - 부하 테스트 (10분)"
@echo " make test-simple - 간단 테스트 (30초)"
@echo " make clean - 컨테이너 + 볼륨 삭제"
@echo ""
@echo "Example:"
@echo " make build && make up && make health"

# Gradle 빌드
build:
@echo "Building with Gradle..."
./gradlew clean build -x test

# 환경 시작 (순서 보장)
up:
@echo "Starting production simulation environment..."
@echo "Step 1: Starting infrastructure (postgres, kafka, schema-registry)..."
docker-compose -f docker-compose.prod-simulation.yml up -d postgres kafka schema-registry
@echo "Waiting for infrastructure to be ready..."
sleep 20
@echo "Step 2: Starting Transfer APIs..."
docker-compose -f docker-compose.prod-simulation.yml up -d transfer-api-1 transfer-api-2
@echo "Waiting for Transfer APIs to be healthy..."
sleep 30
@echo "Step 3: Starting FDS APIs and remaining services..."
docker-compose -f docker-compose.prod-simulation.yml up -d --build
@echo "Done! Run 'make health' to check status"

# 환경 중지
down:
@echo "Stopping all services..."
docker-compose -f docker-compose.prod-simulation.yml down

# 재시작
restart:
@echo "Restarting all services..."
docker-compose -f docker-compose.prod-simulation.yml restart

# 로그 확인
logs:
docker-compose -f docker-compose.prod-simulation.yml logs -f

# 특정 서비스 로그
logs-api:
docker-compose -f docker-compose.prod-simulation.yml logs -f transfer-api-1 transfer-api-2

logs-relay:
docker-compose -f docker-compose.prod-simulation.yml logs -f transfer-relay-0 transfer-relay-1 transfer-relay-2

logs-fds:
docker-compose -f docker-compose.prod-simulation.yml logs -f fds-api-1 fds-api-2

logs-nginx:
docker-compose -f docker-compose.prod-simulation.yml logs -f nginx

# 헬스체크
health:
@chmod +x monitoring/prod-health-check.sh
@./monitoring/prod-health-check.sh

# 부하 테스트
test:
@echo "Running load test (10 minutes)..."
cd load-test && k6 run load-test.js

test-simple:
@echo "Running simple test (30 seconds)..."
cd load-test && k6 run simple-test.js

# 정리
clean:
@echo "Removing all containers and volumes..."
docker-compose -f docker-compose.prod-simulation.yml down -v

clean-all:
@echo "Removing all containers, volumes, and images..."
docker-compose -f docker-compose.prod-simulation.yml down -v --rmi all

# 개발 환경 (기존 docker-compose.yml)
dev-up:
@echo "Starting development environment..."
docker-compose up -d

dev-down:
@echo "Stopping development environment..."
docker-compose down

# 컨테이너 상태 확인
ps:
docker-compose -f docker-compose.prod-simulation.yml ps

# 리소스 사용량
stats:
docker stats --no-stream
21 changes: 14 additions & 7 deletions build-logic/src/main/kotlin/transentia/KafkaConventionPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ class KafkaConventionPlugin : Plugin<Project> {
target.pluginManager.apply("org.jetbrains.kotlin.plugin.allopen")
target.pluginManager.apply("io.spring.dependency-management")

target.afterEvaluate {
dependencies {
// TODO : spring cloude stream 마이그레이션
add("implementation", "org.springframework.kafka:spring-kafka")
add("implementation", "org.apache.kafka:kafka-streams")
add("implementation", "com.fasterxml.jackson.module:jackson-module-kotlin")
add("testImplementation", "org.springframework.kafka:spring-kafka-test")
// Spring Cloud BOM import (Spring Boot 3.3.2와 호환)
target.extensions.getByType(io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension::class.java).apply {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:2023.0.3")
}
}

target.dependencies {
// Spring Cloud Stream + Kafka Streams Binder (버전은 BOM에서 관리)
add("implementation", "org.springframework.cloud:spring-cloud-stream")
add("implementation", "org.springframework.cloud:spring-cloud-stream-binder-kafka-streams")
add("implementation", "org.springframework.kafka:spring-kafka")
add("implementation", "org.apache.kafka:kafka-streams")
add("implementation", "com.fasterxml.jackson.module:jackson-module-kotlin")
add("testImplementation", "org.springframework.kafka:spring-kafka-test")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class SpringBootAppConventionPlugin : Plugin<Project> {
target.pluginManager.apply("org.jetbrains.kotlin.plugin.allopen")
target.pluginManager.apply("org.jetbrains.kotlin.kapt")

// Spring Cloud BOM 추가 (Spring Boot 3.3.2와 호환)
target.extensions.getByType(io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension::class.java).apply {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:2023.0.3")
}
}

target.extensions.configure<KotlinJvmProjectExtension> {
jvmToolchain(21)
}
Expand All @@ -36,6 +43,10 @@ class SpringBootAppConventionPlugin : Plugin<Project> {
add("implementation", "org.springframework.boot:spring-boot-starter-json")
add("implementation", "org.jetbrains.kotlin:kotlin-reflect")

// Observability - Actuator + Prometheus
add("implementation", "org.springframework.boot:spring-boot-starter-actuator")
add("implementation", "io.micrometer:micrometer-registry-prometheus")

add("testImplementation", "org.springframework.boot:spring-boot-starter-test")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class ApiResponseBodyAdvice(
val req = request as? ServletServerHttpRequest
val resp = response as? ServletServerHttpResponse

// Actuator endpoints는 래핑하지 않음
val path = req?.servletRequest?.requestURI
if (path?.startsWith("/actuator") == true) {
return body
}

// 도메인별 커스터마이징 실행 (상태/헤더 자동 설정 등)
if (req != null && resp != null) {
customizers.filter { it.supports(body) }.forEach { it.customize(body, req, resp) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.github.hyungkishin.transentia.common.outbox.transfer

data class ClaimedRow(
val eventId: Long,
val aggregateId: String,
val payload: String,
val headers: String,
val attemptCount: Int = 0
Expand Down
Loading
Loading