๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Today I Learned

๋ฉ€ํ‹ฐ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ ์„ค์ •

 

Today I Learn โœ๐Ÿผ 

 

  • ์˜ค๋Š˜ ํ•˜๋ฃจ ๊ฐ€์žฅ ์ธ์ƒ ๊นŠ์—ˆ๋˜ ๋ฐฐ์›€์—๋Š” ๋ญ๊ฐ€ ์žˆ์—ˆ์ง€?

ํด๋” ๋ถˆ๋Ÿฌ์™”๋Š”๋ฐ ํ”„๋กœ์ ํŠธ๊ฐ€ ๋‹ค ๋“ฑ๋ก๋œ๊ฑฐ

 

  • ๊ทธ ๋ฐฐ์›€๊นŒ์ง€ ๋‹ค๊ฐ€๊ฐ€๋Š”๋ฐ ์–ด๋–ค ์–ด๋ ค์›€์ด ์žˆ์—ˆ์ง€?

ํ•ด๋ณด๋ฉด ๋˜์ง€

  • ๊ทธ ์–ด๋ ค์›€์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•œ ๋‚˜์˜ ์‹œ๋„๋“ค์€ ๋ฌด์—‡์ด ์žˆ์—ˆ์ง€?

ํ•ด๋ณด๋ฉด ๋จ

  • ๊ทธ ๊ณผ์ •์—์„œ ๋‚˜๋Š” ๋ฌด์—‡์„ ๊นจ๋‹ฌ์•˜๊ณ , ์–ด๋–ค ๊ฐ์ •/์ƒ๊ฐ์ด ๋“ค์—ˆ์—ˆ์ง€?

์ข‹๋‹ค

  • ์ด ์ƒํƒœ์—์„œ ์ดํ›„ ๋” ๋‚˜์€ ๋‚ด๊ฐ€ ๋˜๋ ค๋ฉด ๋ฌด์—‡์„ ๋ณด์™„ํ•˜์ง€?

๊ณ„์†๋œ ์—ฐ์Šต, ์‹ค์ฒœ


 

 

1. ๋ฉ€ํ‹ฐ๋ชจ๋“ˆ ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ ์„ค์ •

๋จผ์ € ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ๋ฅผ ๋ฉ€ํ‹ฐ๋ชจ๋“ˆ ๊ตฌ์กฐ๋กœ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ๋ฅผ ๋“ค์–ด, coopang์˜ ๊ตฌ์กฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค

coopang (๋ฃจํŠธ ํ”„๋กœ์ ํŠธ)
โ”œโ”€โ”€ eureka
โ”‚   โ””โ”€โ”€ src
โ”œโ”€โ”€ gateway
โ”‚   โ””โ”€โ”€ src
โ””โ”€โ”€ user
    โ””โ”€โ”€ src

 

์ด๋Ÿฌํ•œ ๊ตฌ์กฐ์—์„œ ๊ฐ ํ•˜์œ„ ํด๋”(eureka, gateway, user)๊ฐ€ ๋ณ„๋„์˜ ๋ชจ๋“ˆ๋กœ ์ธ์‹๋ฉ๋‹ˆ๋‹ค.


 

2. build.gradle ํŒŒ์ผ ์„ค์ • (Gradle ์‚ฌ์šฉ ์‹œ)

๋ฃจํŠธ ํ”„๋กœ์ ํŠธ์— build.gradle ํŒŒ์ผ์ด ์žˆ๋Š” ๊ฒฝ์šฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋ฅผ ํฌํ•จํ•˜๋„๋ก ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค

plugins {
	id 'java'
	id 'org.springframework.boot' version '3.3.3'
	id 'io.spring.dependency-management' version '1.1.6'
}

allprojects {

	group = 'com.coopang'
	version = '0.0.1-SNAPSHOT'

	java {
		toolchain {
			languageVersion = JavaLanguageVersion.of(17)
		}
	}

	repositories {
		mavenCentral()
	}

	ext {
		set('springCloudVersion', "2023.0.3")
	}
}

subprojects {
	// ๊ณตํ†ต ์„ค์ •
	apply plugin: 'java'
	apply plugin: 'io.spring.dependency-management'

	dependencyManagement {
		imports {
			mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
		}
	}

	dependencies {
		implementation 'org.springframework.boot:spring-boot-starter-actuator'

		// Lombok
		compileOnly 'org.projectlombok:lombok'
		annotationProcessor 'org.projectlombok:lombok'

		// Prometheus for metrics monitoring
		implementation 'io.micrometer:micrometer-registry-prometheus'

		// Loki Logback Appender for logging to Loki
		implementation 'com.github.loki4j:loki-logback-appender:1.5.1'

		// Swagger for API documentation
		implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

		// Testing dependencies
		testAnnotationProcessor 'org.projectlombok:lombok'
		testImplementation 'org.projectlombok:lombok'
	}

	test {
		useJUnitPlatform()
	}

}
 

settings.gradle ํŒŒ์ผ์— ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋ฅผ ์ถ”๊ฐ€

rootProject.name = 'coopang'
include 'eureka', 'gateway', 'user'

 

 

์ด๋ ‡๊ฒŒ ์„ค์ •ํ•˜๋ฉด ์ธํ…”๋ฆฌ์ œ์ด๊ฐ€ ํ”„๋กœ์ ํŠธ๋ฅผ ์—ด ๋•Œ ํ•˜์œ„ ํ”„๋กœ์ ํŠธ๋“ค์„ ์ž๋™์œผ๋กœ ๋ชจ๋“ˆ๋กœ ์ธ์‹ํ•ฉ๋‹ˆ๋‹ค.