From e2fb8995fff6f53fdfa59a8150d3333c6dff0321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=9A=A9=ED=98=81?= <95476328+99hyuk@users.noreply.github.com> Date: Sun, 27 Apr 2025 12:52:28 +0900 Subject: [PATCH 01/24] =?UTF-8?q?[CICD]=20release=20=EB=B0=B0=ED=8F=AC=20(?= =?UTF-8?q?#46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FIX] 인증 로직 개선 및 JWT 직렬화 방식 수정 (#38) * [FIX] principal을 UserDetails 객체로 변경하고 credentials은 인증 후 null 처리 * [FIX] JWT claims를 단순 타입으로 직렬화하도록 변경 * [REFACT] JWT claims 각주 설명 추가 * [FEAT] 건강상태 CRUD api 구현 (#35) 수고하셨습니다. * [REFACT] 도메인 연관관계 개선 및 엔티티 구조 리팩토링 (복합키 제거, 연관명칭 통일, 생명주기 관리 명확화) (#39) (#40) * [REFACT] Hospital orphanRemoval 설정, HospitalDepartment 복합키 제거 후 단일 기본키로 변경 * [REFACT] 자가진단증상 엔티티 클래스명 변경, 복합키 삭제 후 단일 기본키로 수정 * [REFACT] 도메인 클래스명 변경 VisitHistory -> MedicalRecord * [REFACT] 도메인 클래스명 변경 MedicalHistory -> HealthStatus, HealthStatus와 User를 1대1 관계로 설정 * [REFACT] 번역테이블 번역필드 추가, summary 테이블 기본 PK로 수정 및 연관관계 수정, Nation 테이블 국가 코드 필드 추가, privateInformation 테이블 비활성화 * [REFACT] 언어 CRUD 관련 컨트롤러, 로직 비활성화 (DB로 직접 관리) * [FIX] MedicalRecord, Summary 테이블 간 연관 필드 매핑 수정 * [FEAT] 의료기록 CRUD api 구현 (#33) * [FEAT] 의료기록 CRUD api 구현 * [REFACT] 의료기록 api 리팩토링 * [REFACT] 의료기록 api 리팩토링 * [REFACT] 의료기록 converter 수정 * [REFACT] 리뷰 반영_1 * [REFACT] 의료기록 api 피드백 반영 * [REFACT] Summary 테이블의 contents 필드 삭제 * [CHORE] VisitHistoryController 에 스웨거 세부 설정 추가 * [CHORE] 리뷰/피드백 반영 * [REFACT] visitHistoryService 의 visit history 조회 쿼리메서드 변경 * [CHORE] DepartmentRepository, HospitalRepository 삭제 * [CHORE] visitHistory -> medicalRecord(이름변경) 에 따른 수정사항 수정 * [CHORE] 건강상태 테이블명 변경 이후 수정사항 수정 (#42) * [FEAT] 건강상태 CRUD api 구현 * [REFACT] 건강상태 api 리팩토링 * [REFACT] 건강상태 converter 수정 * [REFACT] 건강상태 api 피드백 반영 * [REFACT] @UserId 로 변경 * [CHORE] MedicalHistoryController 에 스웨거 세부 설정 추가 * [CHORE] 리뷰/피드백 반영 * [REFACT] MedicalHistoryService 의 midecal history 조회 쿼리 메서드 변경 * [CHORE] MedicalHistory -> HealthStatus(테이블명 변경) 에 따른 수정사항 수정 * [REFACT] 건강상태 기록이 유저 한 명당 하나씩만 보유할 수 있으므로 모든 기록을 조회하는 관련 로직들 주석 처리 * [REFACT] 유저 <-> 건강상태 단방향으로 변경 * [REFACT] 사용하지 않는 로직 주석화 --------- Co-authored-by: 99hyuk * [FEAT] 자가진단표 api 구현 (#37) * [FEAT] 자가진단표 api 구현 * [REFACT] 자가진단표 api 리팩토링 * [CHORE] 오타 수정 * [REFACT] user api 리팩토링 * [REFACT] 증상 목록 조회 api 수정 * [REFACT] 자가진단표 api 컨버터 수정 * [CHORE] 사소한 코드 수정 * [TEMP] 임시저장 * [REFACT] 자가진단표 api 피드백 반영 * [REFACT] @UserId 로 변경 * [CHORE] SelfDiagnosisController, SymptomController 에 스웨거 세부 설정 추가 * [CHORE] 리뷰/피드백 반영 * [CHORE] 불필요한 코드, 파일 삭제 * [REFACT] selfDiagnosisService 의 self diagnosis 조회 쿼리 메서드 변경 * [REFACT] 피드백/리뷰 반영 SelfDiagnosisConverter 의 많은 메서드에 포함된 로직을 새 메서드(SymptomListForResponseDto) 로 뺌. UserController, UserService 의 사용자 삭제 api 삭제 및 사용자 비활성화 api 의 method 를 patch->delete 로 변경 * [CHORE] 피드백/리뷰 반영 1. SymptomConverter의 메서드명 변경(2 삭제) 2. 불필요한 user dto 모두 삭제 * [CHORE] SelfSymptom -> DiagnosisSymptom(이름변경)에 따른 수정사항 수정 * [CHORE] SelfDiagnosisConverter 일부 메서드 이름 수정 * [REFACT] 자가진단 수정하는 경우 tobuilder에서 user값을 받을 필요 없음, createAt 또한 엔티티 어노테이션에서 자동 적용되므로 삭제 * [REFACT] 변수명 수정 * [REFACT] SelfDiagnosis 엔티티 내 @SuperBuilder -> @Builder 로 수정 (상속 없음) * [REFACT] BaseEntity에 빌더 패턴 필요 없음 --------- Co-authored-by: 99hyuk * [CICD] Spring Boot Healthcheck 활성화 및 docker-compose 기반 자동 배포 구축, CORS 설정 (#43) (#44) * [FEAT] spring actuator 의존성 주입 * [FEAT] 배포용 yml에 actuator 헬스체크 경로 추가 * [REFACT] 배포 CD 워크플로우 수정 (compose.yml, .env 파일 생성, 도커 재시작) * [REFACT] curl localhost로 작동하도록 수정 * [REFACT] CORS 설정 원복 (필터 삭제, 모든 접속 허가, 로그인/회원가입을 제외하곤 인증된 사용자만 접근 가능) * [REFACT] cd_workflow 파일 수정 --------- Co-authored-by: doyonkim <111870376+kdy2224@users.noreply.github.com> --- .github/workflows/release_cd_workflow.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 47a55a6..72a6583 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -76,7 +76,7 @@ jobs: version: '3' services: app: - image: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest + image: \${{ secrets.DOCKER_HUB_USERNAME }}/\${{ secrets.DOCKER_HUB_REPOSITORY }}:latest container_name: app restart: always ports: @@ -96,13 +96,13 @@ EOF # .env 파일 생성 cat < /home/ubuntu/.env SPRING_PROFILES_ACTIVE=prod -RDS_HOST=${{ secrets.RDS_HOST }} -RDS_PORT=${{ secrets.RDS_PORT }} -RDS_DB=${{ secrets.RDS_DB }} -RDS_USERNAME=${{ secrets.RDS_USERNAME }} -RDS_PASSWORD=${{ secrets.RDS_PASSWORD }} -JWT_SECRET=${{ secrets.JWT_SECRET }} -OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} +RDS_HOST=\${{ secrets.RDS_HOST }} +RDS_PORT=\${{ secrets.RDS_PORT }} +RDS_DB=\${{ secrets.RDS_DB }} +RDS_USERNAME=\${{ secrets.RDS_USERNAME }} +RDS_PASSWORD=\${{ secrets.RDS_PASSWORD }} +JWT_SECRET=\${{ secrets.JWT_SECRET }} +OPENAI_API_KEY=\${{ secrets.OPENAI_API_KEY }} EOF # .env 파일 권한 설정 From ddf875cb8011c3c80796355e9ca27f4bd036ba9b Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 13:37:26 +0900 Subject: [PATCH 02/24] =?UTF-8?q?[REFACT]=20cd=5Fworkflow=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 71 +++++++++-------------- 1 file changed, 28 insertions(+), 43 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 8da8f59..94490b2 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -58,17 +58,6 @@ jobs: username: ${{ secrets.EC2_USER }} key: ${{ secrets.EC2_SSH_KEY }} script: | - # secrets를 미리 bash 변수에 담는다 - DOCKER_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }} - DOCKER_REPO=${{ secrets.DOCKER_HUB_REPOSITORY }} - RDS_HOST=${{ secrets.RDS_HOST }} - RDS_PORT=${{ secrets.RDS_PORT }} - RDS_DB=${{ secrets.RDS_DB }} - RDS_USERNAME=${{ secrets.RDS_USERNAME }} - RDS_PASSWORD=${{ secrets.RDS_PASSWORD }} - JWT_SECRET=${{ secrets.JWT_SECRET }} - OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - # docker-compose 설치 여부 확인, 없으면 설치 if ! command -v docker-compose &> /dev/null then @@ -82,39 +71,35 @@ jobs: # 최신 이미지 pull docker pull $DOCKER_USERNAME/$DOCKER_REPO:latest - # docker-compose.yml 생성 - cat < /home/ubuntu/docker-compose.yml -version: '3' -services: - app: - image: $DOCKER_USERNAME/$DOCKER_REPO:latest - container_name: app - restart: always - ports: - - '8080:8080' - env_file: - - .env - read_only: true - tmpfs: - - /tmp - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] - interval: 30s - timeout: 5s - retries: 3 -EOF - + # docker-compose.yml 생성 + echo "version: '3'" > /home/ubuntu/docker-compose.yml + echo "services:" >> /home/ubuntu/docker-compose.yml + echo " app:" >> /home/ubuntu/docker-compose.yml + echo " image: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest" >> /home/ubuntu/docker-compose.yml + echo " container_name: app" >> /home/ubuntu/docker-compose.yml + echo " restart: always" >> /home/ubuntu/docker-compose.yml + echo " ports:" >> /home/ubuntu/docker-compose.yml + echo " - '8080:8080'" >> /home/ubuntu/docker-compose.yml + echo " env_file:" >> /home/ubuntu/docker-compose.yml + echo " - .env" >> /home/ubuntu/docker-compose.yml + echo " read_only: true" >> /home/ubuntu/docker-compose.yml + echo " tmpfs:" >> /home/ubuntu/docker-compose.yml + echo " - /tmp" >> /home/ubuntu/docker-compose.yml + echo " healthcheck:" >> /home/ubuntu/docker-compose.yml + echo " test: [\"CMD\",\"curl\",\"-f\",\"http://localhost:8080/actuator/health\"]" >> /home/ubuntu/docker-compose.yml + echo " interval: 30s" >> /home/ubuntu/docker-compose.yml + echo " timeout: 5s" >> /home/ubuntu/docker-compose.yml + echo " retries: 3" >> /home/ubuntu/docker-compose.yml + # .env 파일 생성 - cat < /home/ubuntu/.env -SPRING_PROFILES_ACTIVE=prod -RDS_HOST=$RDS_HOST -RDS_PORT=$RDS_PORT -RDS_DB=$RDS_DB -RDS_USERNAME=$RDS_USERNAME -RDS_PASSWORD=$RDS_PASSWORD -JWT_SECRET=$JWT_SECRET -OPENAI_API_KEY=$OPENAI_API_KEY -EOF + echo "SPRING_PROFILES_ACTIVE=prod" > /home/ubuntu/.env + echo "RDS_HOST=${{ secrets.RDS_HOST }}" >> /home/ubuntu/.env + echo "RDS_PORT=${{ secrets.RDS_PORT }}" >> /home/ubuntu/.env + echo "RDS_DB=${{ secrets.RDS_DB }}" >> /home/ubuntu/.env + echo "RDS_USERNAME=${{ secrets.RDS_USERNAME }}" >> /home/ubuntu/.env + echo "RDS_PASSWORD=${{ secrets.RDS_PASSWORD }}" >> /home/ubuntu/.env + echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> /home/ubuntu/.env + echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> /home/ubuntu/.env # .env 파일 권한 설정 chmod 600 /home/ubuntu/.env From 9b87fb6424b4f6d7ecef62039c3025aad0ca6693 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 13:45:29 +0900 Subject: [PATCH 03/24] =?UTF-8?q?[REFACT]=20cd=5Fworkflow=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 94490b2..16b10bd 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -106,10 +106,8 @@ jobs: # docker-compose pull docker compose -f /home/ubuntu/docker-compose.yml pull - # docker-compose 재배포 - docker compose -f /home/ubuntu/docker-compose.yml down || true - docker compose -f /home/ubuntu/docker-compose.yml up -d + docker compose -f /home/ubuntu/docker-compose.yml up -d --force-recreate --remove-orphans - name: Send Discord Notification if: always() From 0e8d63d455bd09828cb516698c33d32933b8a6ce Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 13:57:11 +0900 Subject: [PATCH 04/24] =?UTF-8?q?[REFACT]=20cd=5Fworkflow=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 16b10bd..e3b6f88 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -69,9 +69,9 @@ jobs: docker system prune -af || true # 최신 이미지 pull - docker pull $DOCKER_USERNAME/$DOCKER_REPO:latest + docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest - # docker-compose.yml 생성 + # docker-compose.yml 생성 echo "version: '3'" > /home/ubuntu/docker-compose.yml echo "services:" >> /home/ubuntu/docker-compose.yml echo " app:" >> /home/ubuntu/docker-compose.yml @@ -103,9 +103,13 @@ jobs: # .env 파일 권한 설정 chmod 600 /home/ubuntu/.env - + + # 기존 app 컨테이너 강제 제거 (없어도 에러 무시) + docker rm -f app || true + # docker-compose pull docker compose -f /home/ubuntu/docker-compose.yml pull + # docker-compose 재배포 docker compose -f /home/ubuntu/docker-compose.yml up -d --force-recreate --remove-orphans From 976f7ff00d6ad02bb7e22ff195ba25404c6e48b4 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:09:28 +0900 Subject: [PATCH 05/24] =?UTF-8?q?[REFACT]=20DockerFile=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=EC=97=90=20curl=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 110620b..7dbe5d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM openjdk:17 +# curl 설치 (헬스체크용) +RUN apt-get update && apt-get install -y curl + ARG JAR_FILE=build/libs/*.jar COPY ${JAR_FILE} ouch.jar From 78d1b02b4b76cd100ef5c00f8d85418e68225991 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:12:38 +0900 Subject: [PATCH 06/24] =?UTF-8?q?[REFACT]=20cd=5Fworkflow=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=97=AC=EC=8A=A4=EC=B2=B4=ED=81=AC=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=ED=99=95=EB=8C=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index e3b6f88..2752d13 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -123,14 +123,15 @@ jobs: EMOJI="❌" fi - # 서버 Healthcheck - sleep 5 - HEALTH=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/actuator/health || true) - if [ "$HEALTH" == "200" ]; then - HEALTH_STATUS="✅ 서버 정상 작동" - else - HEALTH_STATUS="❌ 서버 비정상 작동" + # 반복 폴링 헬스체크 + HEALTH_STATUS="❌ 서버 비정상 작동" + for i in {1..12}; do + if curl -sSf http://localhost:8080/actuator/health; then + HEALTH_STATUS="✅ 서버 정상 작동" + break fi + sleep 5 + done MESSAGE="$EMOJI **Ouch 배포 결과**\\n상태: $STATUS\\n$HEALTH_STATUS\\n🔗 프로젝트: ${{ github.repository }}\\n👤 커밋: ${{ github.actor }}" From d7f4d6ff29768229cfe2c482a4a7e2a495a0f3e3 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:18:00 +0900 Subject: [PATCH 07/24] =?UTF-8?q?[REFACT]=20dockerfile=20=EC=9E=90?= =?UTF-8?q?=EB=B0=94=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7dbe5d3..bee000c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:17 +FROM openjdk:17-slim # curl 설치 (헬스체크용) RUN apt-get update && apt-get install -y curl From 034993f8767668797eab242aaf272746dabdf67a Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:27:44 +0900 Subject: [PATCH 08/24] =?UTF-8?q?[REFACT]=20SecurityConfig=EC=97=90=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=80=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=EB=8F=84=20healthcheck=EC=97=90=20?= =?UTF-8?q?=EC=A0=91=EA=B7=BC=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=98=90?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/onebridge/ouch/security/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index 1e69bfb..3eaafca 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -38,7 +38,7 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except http.addFilterAt(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); http.authorizeHttpRequests( (authorizeRequests) - -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 + -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health").permitAll() // 로그인, 회원가입 페이지는 모두 허용 .anyRequest().authenticated() // 그 외의 요청은 인증 필요 // -> authorizeRequests.anyRequest().permitAll() // 모든 사용자 접근 가능 // -> authorizeRequests.anyRequest().authenticated() // 로그인한 사용자만 접근 가능 From 4858c7bd5bc8e53ffafff7bf5887f1fd847a17a4 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:32:49 +0900 Subject: [PATCH 09/24] =?UTF-8?q?[REFACT]=20=EC=8A=A4=EC=9B=A8=EA=B1=B0?= =?UTF-8?q?=EB=8F=84=20=EC=A0=91=EC=86=8D=20=EA=B0=80=EB=8A=A5=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/onebridge/ouch/security/SecurityConfig.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index 3eaafca..a7aefe2 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -38,10 +38,9 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except http.addFilterAt(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); http.authorizeHttpRequests( (authorizeRequests) - -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health").permitAll() // 로그인, 회원가입 페이지는 모두 허용 + -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health", + "/swagger-ui/**", "/v3/api-docs/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 .anyRequest().authenticated() // 그 외의 요청은 인증 필요 - // -> authorizeRequests.anyRequest().permitAll() // 모든 사용자 접근 가능 - // -> authorizeRequests.anyRequest().authenticated() // 로그인한 사용자만 접근 가능 ); return http.build(); } From 6626c4e5e61f15e8a1d0bc72f75ba086bc70e4e5 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:48:12 +0900 Subject: [PATCH 10/24] =?UTF-8?q?[REFACT]=20CORS=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/onebridge/ouch/security/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index a7aefe2..218efd8 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -35,13 +35,13 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except http.cors( cors -> cors.configurationSource(corsConfigurationSource()) ); - http.addFilterAt(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); http.authorizeHttpRequests( (authorizeRequests) -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health", "/swagger-ui/**", "/v3/api-docs/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 .anyRequest().authenticated() // 그 외의 요청은 인증 필요 ); + http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); return http.build(); } From 9438986a8df3d9dfe96bfd4a948c84d7a0e05256 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:56:36 +0900 Subject: [PATCH 11/24] =?UTF-8?q?[REFACT]=20=EB=8F=84=EC=BB=A4=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=97=AC=EC=8A=A4=EC=B2=B4=ED=81=AC=20=EC=A7=80?= =?UTF-8?q?=EC=97=B0=EC=8B=9C=EA=B0=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bee000c..87ce8e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,5 @@ COPY ${JAR_FILE} ouch.jar ENTRYPOINT ["java", "-jar", "ouch.jar"] -HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ +HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \ CMD curl -f http://localhost:8080/actuator/health || exit 1 From c0c77985a06f53a6a484d7a8c35631d9b36211bd Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:57:29 +0900 Subject: [PATCH 12/24] =?UTF-8?q?[REFACT]=20cd=5Fworkflow=20=ED=97=AC?= =?UTF-8?q?=EC=8A=A4=EC=B2=B4=ED=81=AC=20=EC=8B=9C=EA=B0=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 2752d13..76c1db0 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -125,7 +125,7 @@ jobs: # 반복 폴링 헬스체크 HEALTH_STATUS="❌ 서버 비정상 작동" - for i in {1..12}; do + for i in {1..20}; do if curl -sSf http://localhost:8080/actuator/health; then HEALTH_STATUS="✅ 서버 정상 작동" break From 335dfe8f75016507fa195d857c646450814545c7 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Sun, 27 Apr 2025 14:59:42 +0900 Subject: [PATCH 13/24] =?UTF-8?q?[TEST]=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9C=84=ED=95=B4=20=EC=9D=B8=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/onebridge/ouch/security/SecurityConfig.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index 218efd8..d1d5c49 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -37,11 +37,12 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except ); http.authorizeHttpRequests( (authorizeRequests) - -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health", - "/swagger-ui/**", "/v3/api-docs/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 - .anyRequest().authenticated() // 그 외의 요청은 인증 필요 - ); - http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); + -> authorizeRequests.anyRequest().permitAll()); + // -> authorizeRequests.requestMatchers("/users/login", "/users/signup/**", "/actuator/health", "/health", + // "/swagger-ui/**", "/v3/api-docs/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 + // .anyRequest().authenticated() // 그 외의 요청은 인증 필요 + // ); + //http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); return http.build(); } From e1e17cca5e2dabea6053de1c0efc704470320b5e Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 04:43:41 +0900 Subject: [PATCH 14/24] =?UTF-8?q?[TEST]=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9C=84=ED=95=B4=20SecurityConfig=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(=EC=B5=9C=EC=8B=A0=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EA=B8=B0=EC=A4=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/onebridge/ouch/security/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index d1d5c49..a9c221d 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -35,6 +35,7 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except http.cors( cors -> cors.configurationSource(corsConfigurationSource()) ); + http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); http.authorizeHttpRequests( (authorizeRequests) -> authorizeRequests.anyRequest().permitAll()); @@ -42,7 +43,6 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except // "/swagger-ui/**", "/v3/api-docs/**").permitAll() // 로그인, 회원가입 페이지는 모두 허용 // .anyRequest().authenticated() // 그 외의 요청은 인증 필요 // ); - //http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); return http.build(); } From 095c6b5236f6b9412f0207131262f361a80ec33b Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 05:31:27 +0900 Subject: [PATCH 15/24] =?UTF-8?q?[REFACT]=20Discord=20=EC=95=8C=EB=A6=BC?= =?UTF-8?q?=20=ED=8F=B4=EB=A7=81=20=EC=8B=9C=EA=B0=84=20100=EC=B4=88=20->?= =?UTF-8?q?=20150=EC=B4=88=EB=A1=9C=20=EC=A6=9D=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 76c1db0..3cd91ed 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -125,12 +125,12 @@ jobs: # 반복 폴링 헬스체크 HEALTH_STATUS="❌ 서버 비정상 작동" - for i in {1..20}; do - if curl -sSf http://localhost:8080/actuator/health; then - HEALTH_STATUS="✅ 서버 정상 작동" - break - fi - sleep 5 + for i in {1..30}; do + if curl -sSf http://localhost:8080/actuator/health; then + HEALTH_STATUS="✅ 서버 정상 작동" + break + fi + sleep 5 done MESSAGE="$EMOJI **Ouch 배포 결과**\\n상태: $STATUS\\n$HEALTH_STATUS\\n🔗 프로젝트: ${{ github.repository }}\\n👤 커밋: ${{ github.actor }}" From 454d9c32e2c5d87794aa6b5aff63d858c4ea653f Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 05:32:18 +0900 Subject: [PATCH 16/24] =?UTF-8?q?=EB=B0=B0=ED=8F=AC=20prod.yml=20ddl-auto:?= =?UTF-8?q?=20create=20->=20update=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 68a72f6..69072eb 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -11,7 +11,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver jpa: hibernate: - ddl-auto: create + ddl-auto: update show-sql: true properties: hibernate: From f3f71d4325ef9e65a26b0c8aca02b8bc22861ba0 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 05:40:35 +0900 Subject: [PATCH 17/24] =?UTF-8?q?[REFACT]=20docker=20HealthCheck=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0=20(=EC=9E=91=EB=8F=99=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EC=A6=9D=EA=B0=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 5 +++-- Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 3cd91ed..0c8a8f0 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -89,8 +89,9 @@ jobs: echo " test: [\"CMD\",\"curl\",\"-f\",\"http://localhost:8080/actuator/health\"]" >> /home/ubuntu/docker-compose.yml echo " interval: 30s" >> /home/ubuntu/docker-compose.yml echo " timeout: 5s" >> /home/ubuntu/docker-compose.yml - echo " retries: 3" >> /home/ubuntu/docker-compose.yml - + echo " retries: 5" >> /home/ubuntu/docker-compose.yml + echo " start_period: 60s" >> /home/ubuntu/docker-compose.yml + # .env 파일 생성 echo "SPRING_PROFILES_ACTIVE=prod" > /home/ubuntu/.env echo "RDS_HOST=${{ secrets.RDS_HOST }}" >> /home/ubuntu/.env diff --git a/Dockerfile b/Dockerfile index 87ce8e6..da1be1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,5 +9,5 @@ COPY ${JAR_FILE} ouch.jar ENTRYPOINT ["java", "-jar", "ouch.jar"] -HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \ - CMD curl -f http://localhost:8080/actuator/health || exit 1 +HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=5 \ + CMD status=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/actuator/health) && [ "$status" -eq 200 ] From 914d795462628f45c3adbc737d2f803c08c4e11f Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 05:48:42 +0900 Subject: [PATCH 18/24] =?UTF-8?q?[REFACT]=20=EB=B0=B0=ED=8F=AC=20=ED=9B=84?= =?UTF-8?q?=20=EB=B9=8C=EB=93=9C=20=EA=B3=BC=EC=A0=95=EC=97=90=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 0c8a8f0..87ce9f0 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -20,18 +20,18 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Gradle Caching - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- +# - name: Gradle Caching +# uses: actions/cache@v3 +# with: +# path: | +# ~/.gradle/caches +# ~/.gradle/wrapper +# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} +# restore-keys: | +# ${{ runner.os }}-gradle- - name: Build jar - run: ./gradlew --info clean bootJar -x test + run: ./gradlew clean --refresh-dependencies --no-build-cache --no-daemon bootJar -x test #./gradlew --info clean bootJar -x test - name: docker login uses: docker/login-action@v3 @@ -45,6 +45,8 @@ jobs: context: . push: true tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest + no-cache: true # 💡 매 빌드마다 새 이미지 + pull: true # 💡 베이스 이미지도 최신으로 deploy: runs-on: ubuntu-latest From 952aebb276c63d4123d3ac382abac838b91f70b9 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 06:27:21 +0900 Subject: [PATCH 19/24] =?UTF-8?q?[REFACT]=20=EB=8F=84=EC=BB=A4=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=84=A4=EC=A0=95=EC=97=90=EC=84=9C=20=EC=96=B4?= =?UTF-8?q?=EB=96=A4=20.jar=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=ED=95=A0=20=EC=A7=80=20=EB=AA=85=ED=99=95=ED=9E=88=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index da1be1a..2ffe213 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM openjdk:17-slim # curl 설치 (헬스체크용) RUN apt-get update && apt-get install -y curl -ARG JAR_FILE=build/libs/*.jar +ARG JAR_FILE=build/libs/ouch.jar COPY ${JAR_FILE} ouch.jar From b836b1655ae68a0d895dba82133f5c50d880f6c4 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 07:37:12 +0900 Subject: [PATCH 20/24] =?UTF-8?q?[REFACT]=20cd=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=97=90=EC=84=9C=20=EB=8F=84=EC=BB=A4=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A0=95=EB=A6=AC,=20=EB=8F=84?= =?UTF-8?q?=EC=BB=A4=20=ED=97=AC=EC=8A=A4=EC=B2=B4=ED=81=AC=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=ED=8F=AC=ED=95=A8=20=EC=97=AC=EB=B6=80=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 87ce9f0..5ab72cb 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -33,6 +33,12 @@ jobs: - name: Build jar run: ./gradlew clean --refresh-dependencies --no-build-cache --no-daemon bootJar -x test #./gradlew --info clean bootJar -x test + # Actuator 포함 여부 검증 + - name: Assert actuator present + run: | + jar tf build/libs/ouch.jar | grep spring-boot-actuator || { + echo "❌ Actuator not in JAR"; exit 1; } + - name: docker login uses: docker/login-action@v3 with: @@ -60,6 +66,10 @@ jobs: username: ${{ secrets.EC2_USER }} key: ${{ secrets.EC2_SSH_KEY }} script: | + # 디스크 청소 두 줄 / Docker 이미지 정리 + docker system prune -af || true + docker builder prune -af + # docker-compose 설치 여부 확인, 없으면 설치 if ! command -v docker-compose &> /dev/null then @@ -67,9 +77,6 @@ jobs: sudo apt-get install -y docker-compose-plugin fi - # Docker 이미지 정리 - docker system prune -af || true - # 최신 이미지 pull docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest From f003b3db4a6c523a2474d80b1d7436dd80c5ebe2 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 07:56:48 +0900 Subject: [PATCH 21/24] =?UTF-8?q?[FIX]=20localhost=EB=8A=94=20=EB=9F=AC?= =?UTF-8?q?=EB=84=88=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=EA=B0=80=20=EC=9E=88=EC=96=B4=20EC2=20=EA=B8=B0?= =?UTF-8?q?=EC=A4=80=EC=9C=BC=EB=A1=9C=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B0=B0=ED=8F=AC=20=EC=95=8C=EB=A6=BC=20URL=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_cd_workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_cd_workflow.yml b/.github/workflows/release_cd_workflow.yml index 5ab72cb..871e938 100644 --- a/.github/workflows/release_cd_workflow.yml +++ b/.github/workflows/release_cd_workflow.yml @@ -66,9 +66,10 @@ jobs: username: ${{ secrets.EC2_USER }} key: ${{ secrets.EC2_SSH_KEY }} script: | - # 디스크 청소 두 줄 / Docker 이미지 정리 + # 디스크 청소 두 줄 / Docker 이미지, 로그 정리 docker system prune -af || true docker builder prune -af + docker volume prune -f # docker-compose 설치 여부 확인, 없으면 설치 if ! command -v docker-compose &> /dev/null @@ -136,7 +137,7 @@ jobs: # 반복 폴링 헬스체크 HEALTH_STATUS="❌ 서버 비정상 작동" for i in {1..30}; do - if curl -sSf http://localhost:8080/actuator/health; then + if curl -sSf https://ouchapi.duckdns.org/actuator/health >/dev/null; then HEALTH_STATUS="✅ 서버 정상 작동" break fi From 1912fdd0a4b604b84cf924c087412821b8bac14d Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 15:04:22 +0900 Subject: [PATCH 22/24] =?UTF-8?q?[FIX]=20Authorization=20=ED=97=A4?= =?UTF-8?q?=EB=8D=94=20=EB=85=B8=EC=B6=9C=20=EA=B0=80=EB=8A=A5=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95,=20=EC=BF=A0=ED=82=A4?= =?UTF-8?q?=20=EC=9E=90=EA=B2=A9=20=EC=A6=9D=EB=AA=85=20=EB=B9=84=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94=EB=90=98=EB=8F=84=EB=A1=9D=20CORS=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/onebridge/ouch/security/SecurityConfig.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index a9c221d..606b4e2 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -2,7 +2,6 @@ import java.util.List; -import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -14,7 +13,6 @@ import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; import com.onebridge.ouch.security.filter.JwtAuthenticationFilter; import com.onebridge.ouch.security.tokenManger.TokenManager; @@ -56,7 +54,10 @@ public CorsConfigurationSource corsConfigurationSource() { configuration.addAllowedHeader("*"); configuration.addAllowedMethod("*"); - configuration.setAllowCredentials(true); + configuration.setAllowCredentials(false); + + // ***응답 헤더 노출*** + configuration.setExposedHeaders(List.of("Authorization", "Refresh")); // 필요하면 추가 UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); From 3bbb14503d21df57a2e521be5f73c07040c2a695 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 17:03:04 +0900 Subject: [PATCH 23/24] =?UTF-8?q?[FIX]=20SelfDiagnosis=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=8B=9C=20createdAt=20null=20=EB=B0=A9=EC=96=B4?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20=EB=B0=8F=20Update=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EB=A6=AC=ED=84=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../converter/SelfDiagnosisConverter.java | 8 ------- .../request/DiagnosisCreateRequest.java | 3 --- .../response/DiagnosisUpdateResponse.java | 22 ------------------- .../selfDiagnosis/SelfDiagnosisService.java | 5 +---- 4 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 src/main/java/com/onebridge/ouch/dto/selfDiagnosis/response/DiagnosisUpdateResponse.java diff --git a/src/main/java/com/onebridge/ouch/converter/SelfDiagnosisConverter.java b/src/main/java/com/onebridge/ouch/converter/SelfDiagnosisConverter.java index a866d9d..ec22dc0 100644 --- a/src/main/java/com/onebridge/ouch/converter/SelfDiagnosisConverter.java +++ b/src/main/java/com/onebridge/ouch/converter/SelfDiagnosisConverter.java @@ -11,7 +11,6 @@ import com.onebridge.ouch.domain.mapping.DiagnosisSymptom; import com.onebridge.ouch.dto.selfDiagnosis.request.DiagnosisCreateRequest; import com.onebridge.ouch.dto.selfDiagnosis.request.DiagnosisUpdateRequest; -import com.onebridge.ouch.dto.selfDiagnosis.response.DiagnosisUpdateResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetDiagnosisByUserIdResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetDiagnosisResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetSymptomsOfDiagnosisResponse; @@ -19,13 +18,6 @@ @Component public class SelfDiagnosisConverter { - public DiagnosisUpdateResponse diagnosisToDiagnosisUpdateResponse(SelfDiagnosis updatedDiagnosis) { - List symptoms = symptomListForResponseDto(updatedDiagnosis); - return new DiagnosisUpdateResponse(updatedDiagnosis.getId(), updatedDiagnosis.getVisitType(), symptoms, - updatedDiagnosis.getDuration(), updatedDiagnosis.getPainSeverity(), updatedDiagnosis.getAdditionalNote(), - updatedDiagnosis.getCreatedAt().toString()); - } - public GetDiagnosisResponse diagnosisToGetDiagnosisResponse(SelfDiagnosis diagnosis) { List symptoms = symptomListForResponseDto(diagnosis); return new GetDiagnosisResponse(diagnosis.getUser().getId(), diagnosis.getVisitType(), symptoms, diff --git a/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/request/DiagnosisCreateRequest.java b/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/request/DiagnosisCreateRequest.java index 72ab9cd..142964b 100644 --- a/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/request/DiagnosisCreateRequest.java +++ b/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/request/DiagnosisCreateRequest.java @@ -14,9 +14,6 @@ @Getter public class DiagnosisCreateRequest { - // @NotNull(message = "User Id is required.") - // private Long userId; - @NotNull(message = "Visit type is required.") private VisitType visitType; diff --git a/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/response/DiagnosisUpdateResponse.java b/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/response/DiagnosisUpdateResponse.java deleted file mode 100644 index d599a4b..0000000 --- a/src/main/java/com/onebridge/ouch/dto/selfDiagnosis/response/DiagnosisUpdateResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.onebridge.ouch.dto.selfDiagnosis.response; - -import java.util.List; - -import com.onebridge.ouch.domain.enums.SymptomDuration; -import com.onebridge.ouch.domain.enums.VisitType; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class DiagnosisUpdateResponse { - - private Long id; - private VisitType visitType; - private List symptoms; - private SymptomDuration duration; - private Integer painSeverity; - private String additionalNote; - private String createdAt; -} diff --git a/src/main/java/com/onebridge/ouch/service/selfDiagnosis/SelfDiagnosisService.java b/src/main/java/com/onebridge/ouch/service/selfDiagnosis/SelfDiagnosisService.java index b4b3903..274a626 100644 --- a/src/main/java/com/onebridge/ouch/service/selfDiagnosis/SelfDiagnosisService.java +++ b/src/main/java/com/onebridge/ouch/service/selfDiagnosis/SelfDiagnosisService.java @@ -19,7 +19,6 @@ import com.onebridge.ouch.dto.selfDiagnosis.request.AddSymptomsToDiagnosisRequest; import com.onebridge.ouch.dto.selfDiagnosis.request.DiagnosisCreateRequest; import com.onebridge.ouch.dto.selfDiagnosis.request.DiagnosisUpdateRequest; -import com.onebridge.ouch.dto.selfDiagnosis.response.DiagnosisUpdateResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetDiagnosisByUserIdResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetDiagnosisResponse; import com.onebridge.ouch.dto.selfDiagnosis.response.GetSymptomsOfDiagnosisResponse; @@ -110,7 +109,7 @@ public GetSymptomsOfDiagnosisResponse getSymptomsOfDiagnosis(Long diagnosisId, L //자가진단표 수정 @Transactional - public DiagnosisUpdateResponse updateDiagnosis(Long diagnosisId, Long userId, DiagnosisUpdateRequest request) { + public void updateDiagnosis(Long diagnosisId, Long userId, DiagnosisUpdateRequest request) { SelfDiagnosis diagnosis = selfDiagnosisRepository.findByIdAndUserId(diagnosisId, userId) .orElseThrow(() -> new OuchException(DiagnosisErrorCode.DIAGNOSIS_NOT_FOUND)); @@ -139,8 +138,6 @@ public DiagnosisUpdateResponse updateDiagnosis(Long diagnosisId, Long userId, Di } selfDiagnosisRepository.save(updatedDiagnosis); - - return selfDiagnosisConverter.diagnosisToDiagnosisUpdateResponse(updatedDiagnosis); } //특정 자가진단표에 증상 추가 From 81ad1c2318ad5722b6474256912572f8ba252fa1 Mon Sep 17 00:00:00 2001 From: 99hyuk Date: Mon, 28 Apr 2025 17:35:11 +0900 Subject: [PATCH 24/24] =?UTF-8?q?[REFACT]=20SpringSecurity=20=EB=82=B4=20?= =?UTF-8?q?=20basic=20=EC=9D=B8=EC=A6=9D=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=84=A4=EC=A0=95,?= =?UTF-8?q?=20=EC=84=B8=EC=85=98=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 +- src/main/java/com/onebridge/ouch/security/SecurityConfig.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ffe213..8d51d82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM openjdk:17-slim -# curl 설치 (헬스체크용) +# curl 설치 (헬스체크용) openjdk:17 (slim버전이 아닌 full 버전)로 설치하고 RUN줄 삭제 해도 됨 RUN apt-get update && apt-get install -y curl ARG JAR_FILE=build/libs/ouch.jar diff --git a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java index 606b4e2..69be5e3 100644 --- a/src/main/java/com/onebridge/ouch/security/SecurityConfig.java +++ b/src/main/java/com/onebridge/ouch/security/SecurityConfig.java @@ -8,6 +8,7 @@ import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.config.annotation.web.configurers.FormLoginConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; import org.springframework.web.cors.CorsConfiguration; @@ -33,7 +34,8 @@ public SecurityFilterChain publicResourceConfig(HttpSecurity http) throws Except http.cors( cors -> cors.configurationSource(corsConfigurationSource()) ); - http.addFilterAfter(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); + http.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)); // 세션 사용 안함 + http.addFilterAt(new JwtAuthenticationFilter(tokenManager), BasicAuthenticationFilter.class); http.authorizeHttpRequests( (authorizeRequests) -> authorizeRequests.anyRequest().permitAll());