From b0ef9d03339b59c7fb1741e6dae559abafd80c1a Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Tue, 7 Nov 2023 00:43:39 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat:=20Actuator=20=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94=20=EB=B0=8F=20manifest.yaml=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#54)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + k8s/manifest.yaml | 7 +++++++ .../java/com/diareat/diareat/config/WebSecurityConfig.java | 2 +- src/main/resources/application.properties | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9fc03f3..b17d8df 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-websocket' + implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5' compileOnly 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' diff --git a/k8s/manifest.yaml b/k8s/manifest.yaml index c079fe0..902ed61 100644 --- a/k8s/manifest.yaml +++ b/k8s/manifest.yaml @@ -26,6 +26,13 @@ spec: cpu: 0.3 ports: - containerPort: 8080 + readinessProbe: + httpGet: + path: /actuator/health + port: 8080 + initialDelaySeconds: 30 + periodSeconds: 5 + failureThreshold: 24 --- apiVersion: v1 kind: Service diff --git a/src/main/java/com/diareat/diareat/config/WebSecurityConfig.java b/src/main/java/com/diareat/diareat/config/WebSecurityConfig.java index 0bd9f3a..9c9a41c 100644 --- a/src/main/java/com/diareat/diareat/config/WebSecurityConfig.java +++ b/src/main/java/com/diareat/diareat/config/WebSecurityConfig.java @@ -17,7 +17,7 @@ public class WebSecurityConfig { private final JwtTokenProvider jwtTokenProvider; private static final String[] AUTH_LIST = { // swagger 관련 URl - "/v2/api-docs", "/swagger-resources/**", "/swagger-ui.html", "/swagger-ui/**" + "/v2/api-docs", "/swagger-resources/**", "/swagger-ui.html", "/swagger-ui/**", "/actuator/health" }; @Bean diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 98fd09d..4fc1374 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -8,3 +8,10 @@ spring.mvc.pathmatch.matching-strategy=ant_path_matcher spring.redis.serializer=org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer spring.cache.type=redis spring.cache.redis.cache-null-values=true + +#actuator +management.endpoints.enabled-by-default=false +management.endpoint.health.enabled=true +management.endpoints.jmx.exposure.exclude = * +management.endpoints.web.exposure.include = health +