From c9fafa1ed597484845615b60714b9bf330775015 Mon Sep 17 00:00:00 2001 From: Yoon Seo Jin <154308339+Y00NSJ@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:37:52 +0900 Subject: [PATCH 1/5] Update deploy.yml --- .github/workflows/deploy.yml | 37 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c439eb..67a1c6c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,26 +25,23 @@ jobs: - name: Build with Gradle (skip test) run: ./noonsongmaker/gradlew -p noonsongmaker clean build -x test - - name: Set up SSH key - run: | - mkdir -p ~/.ssh - echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - - - name: Test EC2 host value - run: ping -c 2 ${{ secrets.EC2_HOST }} - - - name: Add EC2 host to known_hosts - run: ssh-keyscan ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts - - - name: Upload JAR to EC2 - run: | - scp -i ~/.ssh/id_rsa -P ${{ secrets.EC2_PORT }} noonsongmakerbuild/libs/noonsongmaker-0.0.1-SNAPSHOT.jar ${{ secrets.EC2_HOST }}:/home/ec2-user/build/libs/ - - - name: Restart docker-compose on EC2 - run: | - ssh -i ~/.ssh/id_rsa -p ${{ secrets.EC2_PORT }} ${{ secrets.EC2_HOST }} << 'EOF' + - name: SCP + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} + source: noonsongmaker/build/libs/noonsongmaker-0.0.1-SNAPSHOT.jar + target: /home/ec2-user/build/libs + + - name: SSH + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_SSH_KEY }} + script_stop: true + script: | cd /home/ec2-user docker-compose down docker-compose up -d - EOF From 96258b40060c6c9fb89867103242fb6bef28aea4 Mon Sep 17 00:00:00 2001 From: Yoon Seo Jin <154308339+Y00NSJ@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:52:23 +0900 Subject: [PATCH 2/5] Update deploy.yml --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 67a1c6c..8a54325 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,6 +33,7 @@ jobs: key: ${{ secrets.EC2_SSH_KEY }} source: noonsongmaker/build/libs/noonsongmaker-0.0.1-SNAPSHOT.jar target: /home/ec2-user/build/libs + strip_components: 3 - name: SSH uses: appleboy/ssh-action@v1.0.3 From d4932bb90880930b6e1dce8d885f46019a242bcc Mon Sep 17 00:00:00 2001 From: Yoon Seo Jin <154308339+Y00NSJ@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:12:55 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Feat:=20=ED=94=84=EB=A1=A0=ED=8A=B8?= =?UTF-8?q?=EC=97=94=EB=93=9C=20=EB=B0=B0=ED=8F=AC=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EC=A3=BC=EC=86=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/sookmyung/noonsongmaker/Config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java index c72c987..aafaed8 100644 --- a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java +++ b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java @@ -82,7 +82,7 @@ public Filter jwtAuthorizeFilter(JwtProvider jwtProvider, UserRepository userRep public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowCredentials(true); // 인증 정보 포함할 경우 true - configuration.setAllowedOriginPatterns(List.of("http://localhost:5173", "http://localhost:8080", "http://52.79.237.120:8080")); // 프론트엔드 주소 + configuration.setAllowedOriginPatterns(List.of("http://localhost:5173", "http://localhost:8080", "http://52.79.237.120:8080", "https://snowflakemaker.netlify.app")); // 프론트엔드 주소 configuration.setAllowedHeaders(List.of("*")); configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH")); configuration.setExposedHeaders(List.of("Content-Type")); From b7548f8925381d66e7652b2f68e763aacb149787 Mon Sep 17 00:00:00 2001 From: Yoon Seo Jin <154308339+Y00NSJ@users.noreply.github.com> Date: Thu, 27 Mar 2025 19:41:34 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=EB=B0=B1=20=EC=84=9C=EB=B2=84=20=EB=8F=84?= =?UTF-8?q?=EB=A9=94=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/sookmyung/noonsongmaker/Config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java index aafaed8..bb2df44 100644 --- a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java +++ b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java @@ -82,7 +82,7 @@ public Filter jwtAuthorizeFilter(JwtProvider jwtProvider, UserRepository userRep public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowCredentials(true); // 인증 정보 포함할 경우 true - configuration.setAllowedOriginPatterns(List.of("http://localhost:5173", "http://localhost:8080", "http://52.79.237.120:8080", "https://snowflakemaker.netlify.app")); // 프론트엔드 주소 + configuration.setAllowedOriginPatterns(List.of("http://localhost:5173", "http://localhost:8080", "http://52.79.237.120:8080", "https://snowflakemaker.netlify.app", "https://nsmaker.o-r.kr")); // 프론트엔드 주소 configuration.setAllowedHeaders(List.of("*")); configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "PATCH")); configuration.setExposedHeaders(List.of("Content-Type")); From 4f7de3c7167f60844a7d127a830001f30cce8889 Mon Sep 17 00:00:00 2001 From: Yoon Seo Jin <154308339+Y00NSJ@users.noreply.github.com> Date: Thu, 27 Mar 2025 19:56:16 +0900 Subject: [PATCH 5/5] =?UTF-8?q?options=20=EC=9A=94=EC=B2=AD=20permitall=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java index bb2df44..f20c525 100644 --- a/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java +++ b/noonsongmaker/src/main/java/sookmyung/noonsongmaker/Config/SecurityConfig.java @@ -49,6 +49,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .requireExplicitSave(false) // SecurityContext 자동 저장 활성화 ) .authorizeHttpRequests(auth -> auth + .requestMatchers(HttpMethod.OPTIONS, "/**").permitAll() .requestMatchers("/auth/logout", "/auth/login", "/auth/signup", "/auth/verify-code", "/auth/send-email","/intro/info-new", "/auth/refresh", "/sse/subscribe/{userId}").permitAll() .anyRequest().authenticated()