From 331dcf9051d2781674a3e470fa2b7d13deff2f92 Mon Sep 17 00:00:00 2001 From: ruddmslee Date: Fri, 28 Feb 2025 07:18:13 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20target=20group=20health=20check=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SucceSS/config/security/SecurityConfig.java | 3 ++- .../web/controller/HealthCheckController.java | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/example/SucceSS/web/controller/HealthCheckController.java diff --git a/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java b/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java index 3c4dc52..58cee21 100644 --- a/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java +++ b/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java @@ -23,7 +23,8 @@ public class SecurityConfig { "/api/auth/sign-in/**", "/error", "/api/auth/reissue", - "/ws-chat/**" + "/ws-chat/**", + "/health" }; private static final String[] SWAGGER_WHITELIST = { "/swagger-ui/**", "/v3/api-docs/**" diff --git a/src/main/java/com/example/SucceSS/web/controller/HealthCheckController.java b/src/main/java/com/example/SucceSS/web/controller/HealthCheckController.java new file mode 100644 index 0000000..fe75195 --- /dev/null +++ b/src/main/java/com/example/SucceSS/web/controller/HealthCheckController.java @@ -0,0 +1,14 @@ +package com.example.SucceSS.web.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/health") +public class HealthCheckController { + @GetMapping + public String healthCheck() { + return "health check ok"; + } +} From 5df83888c04824362e25f92d266553f7953aaf7a Mon Sep 17 00:00:00 2001 From: ruddmslee Date: Fri, 28 Feb 2025 07:26:57 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Feat:=20=EC=B6=A9=EB=8F=8C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 21 +++++++++++++++++++ .../config/security/SecurityConfig.java | 1 + src/main/resources/application.properties | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0d3c3c1..5f5cce0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,3 +26,24 @@ services: - ./databases/config:/etc/mysql/conf.d ports: - "3306:3306" + + nginx: + container_name: nginx-proxy + image: nginx:latest + volumes: + - ./data/nginx:/etc/nginx/conf.d + - ./data/certbot/conf:/etc/letsencrypt + - ./data/certbot/www:/var/www/certbot + ports: + - "80:80" + - "443:443" + depends_on: + - certbot + + certbot: + image: certbot/certbot + container_name: certbot + volumes: + - ./data/certbot/conf:/etc/letsencrypt + - ./data/certbot/www:/var/www/certbot + entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" diff --git a/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java b/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java index 58cee21..07d8e1d 100644 --- a/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java +++ b/src/main/java/com/example/SucceSS/config/security/SecurityConfig.java @@ -24,6 +24,7 @@ public class SecurityConfig { "/error", "/api/auth/reissue", "/ws-chat/**", + "/.well-known/acme-challenge/**", // SSL 인증을 위한 예외 추가 "/health" }; private static final String[] SWAGGER_WHITELIST = { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index eec06f6..e71d6cb 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -21,4 +21,6 @@ logging.level.org.springframework.security=DEBUG logging.level.org.springframework.web=DEBUG # hugging face -spring.huggingface.api.url=${HUGGINGFACE_API_URL} \ No newline at end of file +spring.huggingface.api.url=${HUGGINGFACE_API_URL} + +spring.web.resources.static-locations=classpath:/static/, file:./src/main/resources/static/