From 3dbda857d41b7361b57bd9a8b39a9711ac8afb7a Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 16:41:08 +0900 Subject: [PATCH 01/46] =?UTF-8?q?fix=20:=20=EC=9A=B4=EC=98=81=20CD=20?= =?UTF-8?q?=EC=97=90=20=EC=9E=88=EB=8A=94=20=EB=B0=B0=ED=8F=AC=EA=B3=BC?= =?UTF-8?q?=EC=A0=95=20=EC=97=90=EC=84=9C=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index 39b7d02..fff0165 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -79,7 +79,7 @@ jobs: script: | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} sudo docker pull {{ secrets.DOCKER_REPOSITORY_PROD }}:latest - docker-compose -f docker-compose-dev.yml down + docker-compose -f docker-compose.yml down docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose.yml . rm -r src From 6eb21319e6697e77bca795e35044254f902bf59c Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:01:25 +0900 Subject: [PATCH 02/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95=20(?= =?UTF-8?q?#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/Dockerfile-nginx | 6 ++++++ nginx/nginx.conf | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 nginx/Dockerfile-nginx create mode 100644 nginx/nginx.conf diff --git a/nginx/Dockerfile-nginx b/nginx/Dockerfile-nginx new file mode 100644 index 0000000..6e079cb --- /dev/null +++ b/nginx/Dockerfile-nginx @@ -0,0 +1,6 @@ +# nginx 빌드를 위한 도커파일 +FROM nginx:latest + +# 가상 공간의 nginx 기본 설정파일 삭제 후 작성한 설정파일로 대체 +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..da007db --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,34 @@ +worker_processes auto; + +http { + + # -------------------- spring-boot-dev WAS -------------------- + upstream backend { + server 13.124.127.77:8080; + } + + # Redirect all traffic to HTTPS + server { + listen 80; + server_name dev.nainga.store; + return 308 https://$host$request_uri; + } + + server { + listen 443 ssl; + server_name dev.nainga.store; + + ssl_certificate /etc/letsencrypt/live/[your_domain.com]/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/[your_domain.com]/privkey.pem; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + + location / { + proxy_pass backend; + proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 + proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 + } + } +} \ No newline at end of file From b7d7a37b1f0a0dc7ea844940642c98725c27cff9 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:01:38 +0900 Subject: [PATCH 03/46] =?UTF-8?q?feat=20:=20nginx=20CD=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 32f0522..93c1ccb 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -50,6 +50,16 @@ jobs: source: "src/main/resources/backend-submodule/docker-compose-dev.yml" target: "/home/ubuntu/" + # nginx 설정 파일 서버로 전달 + - name: Send nginx.conf + uses: appleboy/scp-action@master + with: + username: ubuntu + host: ${{ secrets.KCS_HOST_DEV }} + key: ${{ secrets.KCS_KEY_DEV }} + source: "./nginx/nginx.conf" + target: "/home/ubuntu/" + # Docker hub 로그인 - name: Login to dockerHub uses: docker/login-action@v2 @@ -57,7 +67,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME}} password: ${{ secrets.DOCKER_TOKEN}} - # Docker Hub 에 푸시 + # Docker Hub 에 Springboot 푸시 - name: Build and push uses: docker/build-push-action@v4 with: @@ -68,6 +78,17 @@ jobs: cache-from: type=gha cache-to: type=gha, mode=max + # Docker Hub 에 nginx 푸시 + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./nginx/Dockerfile-nginx + push: true + tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest + cache-from: type=gha + cache-to: type=gha, mode=max + # appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다. # 실행 시, docker-compose를 사용합니다. # useranme : ubuntu 우분투 기반 ec2 일 경우 기본이름 @@ -84,4 +105,6 @@ jobs: docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose-dev.yml . rm -r src + cp ./nginx/nginx.conf . + rm -r nginx docker-compose -f docker-compose-dev.yml up -d \ No newline at end of file From 95b36ce2134fc28e00a589c101a5aa4593a7a99b Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:03:34 +0900 Subject: [PATCH 04/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B8=8C=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=B5=9C=EC=8B=A0=ED=99=94=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index eb34453..735fb99 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit eb3445384718e97f34ac2588925c0b64a6a8a2ad +Subproject commit 735fb99e8aebdec3b58dc92ab5c6f92857bad5b0 From 38977b74762ebc5bc22e6de16851d6e3bd812853 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:06:43 +0900 Subject: [PATCH 05/46] =?UTF-8?q?feat=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EA=B1=B0=20=EC=B6=94=EA=B0=80=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 93c1ccb..07dc061 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -5,8 +5,13 @@ on: push: branches: - develop + - feature/** + pull_request: # 테스트 트리거 + branches: + - develop + - feature/** -# 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 + # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: contents: read From 59bb0c9e01a9d9cd0297205b6c9c8eda5b82a0c1 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:09:40 +0900 Subject: [PATCH 06/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B8=8C=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=BB=A4=EB=B0=8B=20=EC=B5=9C=EC=8B=A0=ED=99=94=20?= =?UTF-8?q?(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index eb34453..1da37af 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit eb3445384718e97f34ac2588925c0b64a6a8a2ad +Subproject commit 1da37afaa273e8cb6b2065bda4d9318b150269c0 From 042380773a034162f0c856000ef113da548e621c Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:16:05 +0900 Subject: [PATCH 07/46] =?UTF-8?q?feat=20:=20docker-compose-dev=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 735fb99..b238bd9 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 735fb99e8aebdec3b58dc92ab5c6f92857bad5b0 +Subproject commit b238bd921ddd715eee856973f6324ecec5da705a From 944794d33091afcb2992e894c43f615f8a2783bb Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:16:57 +0900 Subject: [PATCH 08/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B8=8C=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=B5=9C=EC=8B=A0=ED=99=94=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index b238bd9..beb7e52 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit b238bd921ddd715eee856973f6324ecec5da705a +Subproject commit beb7e52329b87e836759fed9a6bff99a2668c8cd From deebd451082200d658883e43c5ac944e769f22ce Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:30:00 +0900 Subject: [PATCH 09/46] =?UTF-8?q?feat=20:=20CD=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 07dc061..59505c0 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -73,7 +73,7 @@ jobs: password: ${{ secrets.DOCKER_TOKEN}} # Docker Hub 에 Springboot 푸시 - - name: Build and push + - name: Build and push springboot uses: docker/build-push-action@v4 with: context: . @@ -84,11 +84,11 @@ jobs: cache-to: type=gha, mode=max # Docker Hub 에 nginx 푸시 - - name: Build and push + - name: Build and push nginx uses: docker/build-push-action@v4 with: - context: . - file: ./nginx/Dockerfile-nginx + context: ./nginx + file: Dockerfile-nginx push: true tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest cache-from: type=gha From 2e7cf0d3cb7813126d94fbbd62584a7bf594abc7 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:35:31 +0900 Subject: [PATCH 10/46] =?UTF-8?q?feat=20:=20CD=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 59505c0..22827b3 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -5,7 +5,6 @@ on: push: branches: - develop - - feature/** pull_request: # 테스트 트리거 branches: - develop @@ -88,7 +87,7 @@ jobs: uses: docker/build-push-action@v4 with: context: ./nginx - file: Dockerfile-nginx + file: ./Dockerfile-nginx push: true tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest cache-from: type=gha From 13087a082f9f6ececb706fc86e9147a09092dcf9 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 20:39:11 +0900 Subject: [PATCH 11/46] =?UTF-8?q?feat=20:=20CD=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 22827b3..0e6de55 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -87,7 +87,7 @@ jobs: uses: docker/build-push-action@v4 with: context: ./nginx - file: ./Dockerfile-nginx + file: nginx/Dockerfile-nginx push: true tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest cache-from: type=gha From 0644740f7f727261a6645467b82710f810e86be3 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 21:09:01 +0900 Subject: [PATCH 12/46] =?UTF-8?q?feat=20:=20CD=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 0e6de55..b1a89f2 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -105,6 +105,7 @@ jobs: script: | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} sudo docker pull {{ secrets.DOCKER_REPOSITORY }}:latest + sudo docker pull {{ secrets.DOCKER_NGINX_REPOSITORY }}:latest docker-compose -f docker-compose-dev.yml down docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose-dev.yml . From 7874142f9d02af7e15bc223b8184cb8c928383d9 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 21:26:08 +0900 Subject: [PATCH 13/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index da007db..f52982a 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,4 +1,3 @@ -worker_processes auto; http { From 5f652b1f583b06bbd2cd30407c8db29866617392 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 21:41:03 +0900 Subject: [PATCH 14/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index f52982a..4b0ca12 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,9 +1,12 @@ +events { + worker_connections 1024; +} http { # -------------------- spring-boot-dev WAS -------------------- upstream backend { - server 13.124.127.77:8080; + server 13.124.127.77:8080; } # Redirect all traffic to HTTPS From 6b0b8306833a6af92af82567b2ad2769dbb1e174 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 22:18:04 +0900 Subject: [PATCH 15/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 9 --------- 1 file changed, 9 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 4b0ca12..fd426cf 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,6 +1,3 @@ -events { - worker_connections 1024; -} http { @@ -20,12 +17,6 @@ http { listen 443 ssl; server_name dev.nainga.store; - ssl_certificate /etc/letsencrypt/live/[your_domain.com]/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/[your_domain.com]/privkey.pem; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_prefer_server_ciphers on; - location / { proxy_pass backend; proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 From 0a8b0d41a821ee8204e57c44e5f9536490146cf1 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 22:58:45 +0900 Subject: [PATCH 16/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index fd426cf..da06357 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,3 +1,6 @@ +events { + worker_connections 1024; +} http { @@ -14,11 +17,11 @@ http { } server { - listen 443 ssl; + listen 443; server_name dev.nainga.store; location / { - proxy_pass backend; + proxy_pass http://backend; proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 From 02b4f50fd87f205d8a6554e3d5dc5326a0233ad1 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 23:33:05 +0900 Subject: [PATCH 17/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/Dockerfile-nginx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/Dockerfile-nginx b/nginx/Dockerfile-nginx index 6e079cb..338abd4 100644 --- a/nginx/Dockerfile-nginx +++ b/nginx/Dockerfile-nginx @@ -3,4 +3,4 @@ FROM nginx:latest # 가상 공간의 nginx 기본 설정파일 삭제 후 작성한 설정파일로 대체 RUN rm /etc/nginx/conf.d/default.conf -COPY nginx.conf /etc/nginx/conf.d \ No newline at end of file +COPY nginx.conf /etc/nginx/conf.d/nginx.conf \ No newline at end of file From ba295e516851e0ed091bb6af152dff13e034e142 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 23:42:35 +0900 Subject: [PATCH 18/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/Dockerfile-nginx | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx/Dockerfile-nginx b/nginx/Dockerfile-nginx index 338abd4..3798fe9 100644 --- a/nginx/Dockerfile-nginx +++ b/nginx/Dockerfile-nginx @@ -3,4 +3,5 @@ FROM nginx:latest # 가상 공간의 nginx 기본 설정파일 삭제 후 작성한 설정파일로 대체 RUN rm /etc/nginx/conf.d/default.conf +RUN rm /etc/nginx/conf.d/nginx.conf COPY nginx.conf /etc/nginx/conf.d/nginx.conf \ No newline at end of file From 839149522380381a9b18cdd27c1135b5157fbda3 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 23:46:34 +0900 Subject: [PATCH 19/46] =?UTF-8?q?fix=20:=20=EC=9E=98=EB=AA=BB=EB=90=9C=20n?= =?UTF-8?q?ginx=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/Dockerfile-nginx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/Dockerfile-nginx b/nginx/Dockerfile-nginx index 3798fe9..1dcbc75 100644 --- a/nginx/Dockerfile-nginx +++ b/nginx/Dockerfile-nginx @@ -3,5 +3,5 @@ FROM nginx:latest # 가상 공간의 nginx 기본 설정파일 삭제 후 작성한 설정파일로 대체 RUN rm /etc/nginx/conf.d/default.conf -RUN rm /etc/nginx/conf.d/nginx.conf +RUN sudo rm /etc/nginx/conf.d/nginx.conf COPY nginx.conf /etc/nginx/conf.d/nginx.conf \ No newline at end of file From 147ba7e0fe32e9847199754affb523e0b2ddc853 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 23:58:13 +0900 Subject: [PATCH 20/46] =?UTF-8?q?feat=20:=20ngnix=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 21 +++++++++------------ nginx/Dockerfile-nginx | 7 ------- 2 files changed, 9 insertions(+), 19 deletions(-) delete mode 100644 nginx/Dockerfile-nginx diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index b1a89f2..463446a 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -83,15 +83,15 @@ jobs: cache-to: type=gha, mode=max # Docker Hub 에 nginx 푸시 - - name: Build and push nginx - uses: docker/build-push-action@v4 - with: - context: ./nginx - file: nginx/Dockerfile-nginx - push: true - tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest - cache-from: type=gha - cache-to: type=gha, mode=max +# - name: Build and push nginx +# uses: docker/build-push-action@v4 +# with: +# context: ./nginx +# file: nginx/Dockerfile-nginx +# push: true +# tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest +# cache-from: type=gha +# cache-to: type=gha, mode=max # appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다. # 실행 시, docker-compose를 사용합니다. @@ -105,11 +105,8 @@ jobs: script: | docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} sudo docker pull {{ secrets.DOCKER_REPOSITORY }}:latest - sudo docker pull {{ secrets.DOCKER_NGINX_REPOSITORY }}:latest docker-compose -f docker-compose-dev.yml down docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose-dev.yml . rm -r src - cp ./nginx/nginx.conf . - rm -r nginx docker-compose -f docker-compose-dev.yml up -d \ No newline at end of file diff --git a/nginx/Dockerfile-nginx b/nginx/Dockerfile-nginx deleted file mode 100644 index 1dcbc75..0000000 --- a/nginx/Dockerfile-nginx +++ /dev/null @@ -1,7 +0,0 @@ -# nginx 빌드를 위한 도커파일 -FROM nginx:latest - -# 가상 공간의 nginx 기본 설정파일 삭제 후 작성한 설정파일로 대체 -RUN rm /etc/nginx/conf.d/default.conf -RUN sudo rm /etc/nginx/conf.d/nginx.conf -COPY nginx.conf /etc/nginx/conf.d/nginx.conf \ No newline at end of file From 994d9d2e49fb1ee75a9930661652393cfd6c4317 Mon Sep 17 00:00:00 2001 From: hoon Date: Thu, 18 Jan 2024 23:58:32 +0900 Subject: [PATCH 21/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index beb7e52..5dbfc0f 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit beb7e52329b87e836759fed9a6bff99a2668c8cd +Subproject commit 5dbfc0fc77a0446c28ea9bbdf84cf9c3f7ded54f From e859c6a05f28d993488f2eec13fe064d3a83843f Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 00:00:35 +0900 Subject: [PATCH 22/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index beb7e52..1da37af 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit beb7e52329b87e836759fed9a6bff99a2668c8cd +Subproject commit 1da37afaa273e8cb6b2065bda4d9318b150269c0 From 317e6c69ca1581b6fc5d904f0a485e28d0dd44f5 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 00:02:01 +0900 Subject: [PATCH 23/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 5dbfc0f..d007e6c 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 5dbfc0fc77a0446c28ea9bbdf84cf9c3f7ded54f +Subproject commit d007e6cd64b78937b24fbdb29fde675e9cda8d77 From c77fbc7e1e0dc346fe497d279e49bfce85e7741a Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 00:08:22 +0900 Subject: [PATCH 24/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index d007e6c..c9238dc 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit d007e6cd64b78937b24fbdb29fde675e9cda8d77 +Subproject commit c9238dc27221d08bf4b697b9d3632c2ccc5b5c2f From 5b6ee2dbaab379d58ab4df003871607ea6572313 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 00:17:14 +0900 Subject: [PATCH 25/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index da06357..3e9c7a8 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -6,7 +6,7 @@ http { # -------------------- spring-boot-dev WAS -------------------- upstream backend { - server 13.124.127.77:8080; + server server; } # Redirect all traffic to HTTPS @@ -21,7 +21,7 @@ http { server_name dev.nainga.store; location / { - proxy_pass http://backend; + proxy_pass http://server; proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 From f6136551a9ef8692b4ef6dbc0f4f5c842a6acd77 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 04:17:42 +0900 Subject: [PATCH 26/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 9 --------- 1 file changed, 9 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 3e9c7a8..00cb3ee 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -13,18 +13,9 @@ http { server { listen 80; server_name dev.nainga.store; - return 308 https://$host$request_uri; - } - - server { - listen 443; - server_name dev.nainga.store; location / { proxy_pass http://server; - proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 - proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 } } } \ No newline at end of file From 7c140235df3f4ae9e78dccc1eb1ce6b0fe4bedb4 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 04:22:18 +0900 Subject: [PATCH 27/46] =?UTF-8?q?feat=20:=20nginx=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 00cb3ee..7c9f0fb 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -6,7 +6,7 @@ http { # -------------------- spring-boot-dev WAS -------------------- upstream backend { - server server; + server server:8080; } # Redirect all traffic to HTTPS From 19562250920086fa7356de8501182adc049020f4 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 05:17:02 +0900 Subject: [PATCH 28/46] =?UTF-8?q?feat=20:=20nginx=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=EC=84=9C=20=EC=B6=94=EA=B0=80=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 15 ++++++++++++++- src/main/resources/backend-submodule | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 7c9f0fb..affee87 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -14,8 +14,21 @@ http { listen 80; server_name dev.nainga.store; + return 308 https://$host$request_uri; + } + + server { + listen 443 ssl; + server_name dev.nainga.store; + + ssl_certificate /etc/cloudflare/origin_cert.pem; + ssl_certificate_key /etc/cloudflare/private_key.pem; + location / { proxy_pass http://server; + proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 + proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 } } -} \ No newline at end of file +} diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index c9238dc..8379a99 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit c9238dc27221d08bf4b697b9d3632c2ccc5b5c2f +Subproject commit 8379a99cabaa661444da3a11da6af99ac7d03a25 From e1c0310cc00ee201c50f575127a516d39647523f Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 05:45:22 +0900 Subject: [PATCH 29/46] =?UTF-8?q?fix=20:=20nginx=20=EC=9E=98=EB=AA=BB?= =?UTF-8?q?=EB=90=9C=20upstream=20=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index affee87..3a6e56f 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -25,7 +25,7 @@ http { ssl_certificate_key /etc/cloudflare/private_key.pem; location / { - proxy_pass http://server; + proxy_pass http://backend; proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 From 4f4f54da68031dc057639242f243145ee654b567 Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 19:22:40 +0900 Subject: [PATCH 30/46] =?UTF-8?q?fix=20:=20cloudflare=20ssl=20->=20certbot?= =?UTF-8?q?,=20letsencrypt=20ssl=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 13 ++++++++++--- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 3a6e56f..f8a19b3 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -14,15 +14,22 @@ http { listen 80; server_name dev.nainga.store; - return 308 https://$host$request_uri; + # certbot 이 소유자임을 확인하는 경로 + location /.well-known/acme-challenge { + root /var/lib/letsencrypt/; # 사용자 인증을 위한 파일이 생성 되는곳 + } + + location / { + return 301 https://$host$request_uri; + } } server { listen 443 ssl; server_name dev.nainga.store; - ssl_certificate /etc/cloudflare/origin_cert.pem; - ssl_certificate_key /etc/cloudflare/private_key.pem; + ssl_certificate /etc/letsencrypt/live/nainga.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/nainga.com/privkey.pem; location / { proxy_pass http://backend; diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index 8379a99..ac45bcc 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 8379a99cabaa661444da3a11da6af99ac7d03a25 +Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index 1da37af..ac3b02c 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit 1da37afaa273e8cb6b2065bda4d9318b150269c0 +Subproject commit ac3b02c9239a685ee51ec4874a6e703414bf183e From 3f1f7e5f325937e008bd3e3ea4096a864b0bfede Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 19 Jan 2024 21:38:43 +0900 Subject: [PATCH 31/46] =?UTF-8?q?fix=20:=20API,=20Service=20=EB=8B=A8?= =?UTF-8?q?=EC=97=90=20(=EA=B2=BD=EB=8F=84,=20=EC=9C=84=EB=8F=84)=20?= =?UTF-8?q?=EC=A2=8C=ED=91=9C=EB=A5=BC=204=EA=B0=9C=20=EB=B0=9B=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/storecertification/api/StoreCertificationApi.java | 4 ++-- .../application/StoreCertificationService.java | 4 ++-- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index f0cad01..6ae5c2f 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -43,8 +43,8 @@ public class StoreCertificationApi { "certificationName: 가게의 인증제 목록
" + "=> 각 인증제별 순서는 보장되지 않습니다.") @GetMapping("api/v1/storecertification/byLocation") - public Result> findStoreCertificationsByLocation(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat) { - List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(new Location(nwLong, nwLat), new Location(seLong, seLat)); + public Result> findStoreCertificationsByLocation(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { + List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); List storeIdsWithMultipleCertifications = storeCertificationService.findStoreIdsWithMultipleCertifications(); //여러 인증제를 가지고 있는 가게의 id 리스트 List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List Map map = new HashMap<>(); //여러 인증제를 가지고 있는 가게들의 response를 임시로 저장하고 있을 map diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index c0b29e7..510eb01 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -16,8 +16,8 @@ @RequiredArgsConstructor public class StoreCertificationService { private final StoreCertificationRepository storeCertificationRepository; - public List findStoreCertificationsByLocation(Location northWestLocation, Location southEastLocation) { - return storeCertificationRepository.findStoreCertificationsByLocation(northWestLocation, southEastLocation); + public List findStoreCertificationsByLocation(Location northWestLocation, Location southWestLocation, Location southEastLocation, Location northEastLocation) { + return storeCertificationRepository.findStoreCertificationsByLocation(northWestLocation, southWestLocation, southEastLocation, northEastLocation); } public List findStoreIdsWithMultipleCertifications() { diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index beb7e52..ac45bcc 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit beb7e52329b87e836759fed9a6bff99a2668c8cd +Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index beb7e52..ac45bcc 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit beb7e52329b87e836759fed9a6bff99a2668c8cd +Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 From 358b86ea834d6f208c7d4cdb9ab4bd67d3519cf4 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 19 Jan 2024 22:27:41 +0900 Subject: [PATCH 32/46] =?UTF-8?q?fix=20:=204=EA=B0=9C=EC=9D=98=20(?= =?UTF-8?q?=EA=B2=BD=EB=8F=84,=20=EC=9C=84=EB=8F=84)=20=EC=A2=8C=ED=91=9C?= =?UTF-8?q?=EB=B0=9B=EC=95=84=20Polygon=20=EC=98=81=EC=97=AD=20=EB=82=B4?= =?UTF-8?q?=20=EA=B0=80=EA=B2=8C=EB=93=A4=20=EB=A6=AC=ED=84=B4=ED=95=98?= =?UTF-8?q?=EB=8A=94=20Query=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/StoreCertificationRepository.java | 10 +++++----- .../application/StoreCertificationServiceTest.java | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java index c7cea75..5f8df13 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/dao/StoreCertificationRepository.java @@ -39,14 +39,14 @@ public Optional findByStoreIdCertificationId(Long storeId, L return result.stream().findAny(); } - //북서쪽 좌표와 남동쪽 좌표를 받아 그 두 좌표로 만들어지는 최소 사각형 내에 위치하는 가게들 리턴 - public List findStoreCertificationsByLocation(Location northWestLocation, Location southEastLocation) { + //북서쪽 좌표, 남서쪽 좌표, 남동쪽 좌표, 북동쪽 좌표를 받아 그 네 좌표로 만들어지는 사각형 영역 내에 위치하는 가게들 리턴 + public List findStoreCertificationsByLocation(Location northWestLocation, Location southWestLocation, Location southEastLocation, Location northEastLocation) { String pointFormat = String.format( - "'LINESTRING(%f %f, %f %f)'", //POINT는 (경도, 위도) 순이다. 즉, (Logitude, Latitude)순 - northWestLocation.getLongitude(), northWestLocation.getLatitude(), southEastLocation.getLongitude(), southEastLocation.getLatitude() + "'POLYGON((%f %f, %f %f, %f %f, %f %f, %f %f))'", //POINT는 (경도, 위도) 순이다. 즉, (Logitude, Latitude)순 + northWestLocation.getLongitude(), northWestLocation.getLatitude(), southWestLocation.getLongitude(), southWestLocation.getLatitude(), southEastLocation.getLongitude(), southEastLocation.getLatitude(), northEastLocation.getLongitude(), northEastLocation.getLatitude(), northWestLocation.getLongitude(), northWestLocation.getLatitude() ); - Query query = em.createNativeQuery("SELECT sc.* " + "FROM store_certification AS sc " + "JOIN store AS s ON sc.store_id = s.store_id " + "JOIN certification AS c ON sc.certification_id = c.certification_id " + "WHERE MBRCONTAINS(ST_LINESTRINGFROMTEXT(" + pointFormat + "), s.location)", StoreCertification.class); + Query query = em.createNativeQuery("SELECT sc.* " + "FROM store_certification AS sc " + "JOIN store AS s ON sc.store_id = s.store_id " + "JOIN certification AS c ON sc.certification_id = c.certification_id " + "WHERE ST_CONTAINS(ST_POLYGONFROMTEXT(" + pointFormat + "), s.location)", StoreCertification.class); return query.getResultList(); } diff --git a/src/test/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationServiceTest.java b/src/test/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationServiceTest.java index 68b9b67..142b24e 100644 --- a/src/test/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationServiceTest.java +++ b/src/test/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationServiceTest.java @@ -55,9 +55,11 @@ void findStoreCertificationsByLocation() { } //when - Location location1 = new Location(minLongitude - 1.0, minLatitude - 1.0); - Location location2 = new Location(maxLongitude + 1.0, maxLatitude + 1.0); - List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(location1, location2); + Location location1 = new Location(minLongitude - 1.0, maxLatitude + 1.0); + Location location2 = new Location(minLongitude - 1.0, minLatitude - 1.0); + Location location3 = new Location(maxLongitude + 1.0, minLatitude - 1.0); + Location location4 = new Location(maxLongitude + 1.0, maxLatitude + 1.0); + List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(location1, location2, location3, location4); //then assertThat(storeCertificationsByLocation.size()).isEqualTo(stores.size()); From 6570136edf397b164612941d800c924d68615f9d Mon Sep 17 00:00:00 2001 From: hoon Date: Fri, 19 Jan 2024 22:32:58 +0900 Subject: [PATCH 33/46] =?UTF-8?q?fix=20:=20cloudflare=20ssl=20->=20certbot?= =?UTF-8?q?,=20letsencrypt=20ssl=20=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index f8a19b3..aa317da 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -4,11 +4,43 @@ events { http { - # -------------------- spring-boot-dev WAS -------------------- + # -------------------- spring-boot-prod WAS -------------------- upstream backend { server server:8080; } + # Redirect all traffic to HTTPS + server { + listen 80; + server_name nainga.store; + + # certbot 이 소유자임을 확인하는 경로 + location /.well-known/acme-challenge { + root /var/lib/letsencrypt/; # 사용자 인증을 위한 파일이 생성 되는곳 + } + + location / { + return 301 https://$host$request_uri; + } + } + + server { + listen 443 ssl; + server_name nainga.store; + + ssl_certificate /etc/letsencrypt/live/nainga.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/nainga.com/privkey.pem; + + location / { + proxy_pass http://backend; + proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 + proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 + } + } + + # -------------------- spring-boot-dev WAS -------------------- + # Redirect all traffic to HTTPS server { listen 80; From 8c7c5295c0388c8aa904db3ce842daf1d2360ed2 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Fri, 19 Jan 2024 23:43:35 +0900 Subject: [PATCH 34/46] =?UTF-8?q?feat=20:=20Google=20Cloud=20Storage=20API?= =?UTF-8?q?=20=EB=AA=85=EC=84=B8=EB=A5=BC=20=EC=9C=84=ED=95=9C=20SwaggerCo?= =?UTF-8?q?nfig=20=EA=B5=AC=ED=98=84=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nainga/global/config/SwaggerConfig.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java diff --git a/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java b/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java new file mode 100644 index 0000000..0472428 --- /dev/null +++ b/src/main/java/com/nainga/nainga/global/config/SwaggerConfig.java @@ -0,0 +1,43 @@ +package com.nainga.nainga.global.config; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; +import io.swagger.v3.oas.models.Paths; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.media.Content; +import io.swagger.v3.oas.models.media.MediaType; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.responses.ApiResponse; +import io.swagger.v3.oas.models.responses.ApiResponses; +import io.swagger.v3.oas.models.tags.Tag; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.List; + +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI customOpenAPI() { + //Google Cloud Storage API는 별도로 Swagger에 명세 + return new OpenAPI() + .paths(new Paths().addPathItem("https://storage.googleapis.com/{BUCKET_NAME}/{IMAGE_NAME}", + new PathItem().get(new Operation().summary("저장된 가게 이미지 제공") + .description("저장된 가게 이미지를 제공하는 API입니다.
" + + "본 API는 Google Cloud Storage에서 제공하는 API로 URL이 위와 같으며 이 정보는 각 가게별 local_photos 필드에 저장되어 있습니다.
" + + "Dev 환경에서 BUCKET_NAME은 kcs-dev-bucket1이고 Prod 환경에서 BUCKET_NAME은 kcs-prod-bucket1입니다.
" + + "가게 이름은 UUID를 활용한 난수로 제공됩니다.
" + + "참고로 Swagger 상에서는 Base URL이 달라 테스트가 불가능합니다.
" + + "만약 테스트를 원하신다면 브라우저 상에서 직접 URL을 입력해주시면 됩니다.
" + + "예) https://storage.googleapis.com/kcs-dev-bucket1/ad06294c-d4ed-42bd-9839-82af8714bd1e") + .tags(List.of("가게 상세 정보")) + .responses(new ApiResponses().addApiResponse("200", + new ApiResponse().description("OK") + .content(new Content().addMediaType("image/jpeg", new MediaType() + .schema(new Schema<>().type("string") + .format("binary"))))))))); + } +} + From a9b372745d6085317a5b03b0f01ce47a65554c23 Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 01:04:41 +0900 Subject: [PATCH 35/46] =?UTF-8?q?fix=20:=20conf=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index aa317da..7e278f7 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -9,39 +9,7 @@ http { server server:8080; } - # Redirect all traffic to HTTPS - server { - listen 80; - server_name nainga.store; - - # certbot 이 소유자임을 확인하는 경로 - location /.well-known/acme-challenge { - root /var/lib/letsencrypt/; # 사용자 인증을 위한 파일이 생성 되는곳 - } - - location / { - return 301 https://$host$request_uri; - } - } - - server { - listen 443 ssl; - server_name nainga.store; - - ssl_certificate /etc/letsencrypt/live/nainga.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/nainga.com/privkey.pem; - - location / { - proxy_pass http://backend; - proxy_set_header Host $host; # 클라이언트가 요청한 호스트의 도메인 - proxy_set_header X-Real-IP $remote_addr; # 클라이언트의 실제 IP 주소 - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 원격 클라이언트의 실제 IP 주소와, 이전에 거친 프록시 서버의 IP 주소들이 쉼표로 구분되어 포함 - } - } - # -------------------- spring-boot-dev WAS -------------------- - - # Redirect all traffic to HTTPS server { listen 80; server_name dev.nainga.store; @@ -51,6 +19,7 @@ http { root /var/lib/letsencrypt/; # 사용자 인증을 위한 파일이 생성 되는곳 } + # Redirect all traffic to HTTPS location / { return 301 https://$host$request_uri; } @@ -60,8 +29,8 @@ http { listen 443 ssl; server_name dev.nainga.store; - ssl_certificate /etc/letsencrypt/live/nainga.com/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/nainga.com/privkey.pem; + ssl_certificate /etc/letsencrypt/live/dev.nainga.store/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/dev.nainga.store/privkey.pem; location / { proxy_pass http://backend; From 1de0e4c494849da7a41676828b7b15e21802b4e6 Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 01:05:47 +0900 Subject: [PATCH 36/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B8=8C=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=EC=B5=9C=EC=8B=A0=ED=99=94=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/backend-submodule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index ac45bcc..ac3b02c 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 +Subproject commit ac3b02c9239a685ee51ec4874a6e703414bf183e From 9a5e810ccac9bd7345e7854c4f6b847f04c2d01f Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 01:44:43 +0900 Subject: [PATCH 37/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B2=84=EB=A1=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=ED=8C=8C=EC=9D=BC=20=EC=A0=84=EC=86=A1=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=20=EA=B0=9C=EC=84=A0=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 463446a..b87de1e 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -44,24 +44,16 @@ jobs: chmod +x ./gradlew ./gradlew clean build -x test - # 도커 컴포즈 설정 파일 서버(EC2)로 전달 - - name: Send docker-compose.yml + # 설정 파일 서버(EC2)로 전달 + - name: Send docker-compose.yml and nginx.conf uses: appleboy/scp-action@master with: username: ubuntu host: ${{ secrets.KCS_HOST_DEV }} key: ${{ secrets.KCS_KEY_DEV }} - source: "src/main/resources/backend-submodule/docker-compose-dev.yml" - target: "/home/ubuntu/" - - # nginx 설정 파일 서버로 전달 - - name: Send nginx.conf - uses: appleboy/scp-action@master - with: - username: ubuntu - host: ${{ secrets.KCS_HOST_DEV }} - key: ${{ secrets.KCS_KEY_DEV }} - source: "./nginx/nginx.conf" + source: | + "src/main/resources/backend-submodule/docker-compose-dev.yml" + "./nginx/nginx.conf" target: "/home/ubuntu/" # Docker hub 로그인 From ce8ae002ec8f56fc2039296bdc61f4fc81e51723 Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 01:48:35 +0900 Subject: [PATCH 38/46] =?UTF-8?q?feat=20:=20=EC=84=9C=EB=B2=84=EB=A1=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=ED=8C=8C=EC=9D=BC=20=EC=A0=84=EC=86=A1=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=20=EA=B0=9C=EC=84=A0=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index b87de1e..80302c8 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -51,9 +51,7 @@ jobs: username: ubuntu host: ${{ secrets.KCS_HOST_DEV }} key: ${{ secrets.KCS_KEY_DEV }} - source: | - "src/main/resources/backend-submodule/docker-compose-dev.yml" - "./nginx/nginx.conf" + source: "src/main/resources/backend-submodule/docker-compose-dev.yml,./nginx/nginx.conf" target: "/home/ubuntu/" # Docker hub 로그인 From f17bd60c4b807f6dcb2d38c25df082fc7701481e Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 02:11:47 +0900 Subject: [PATCH 39/46] =?UTF-8?q?feat=20:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=ED=8A=B8=EB=A6=AC?= =?UTF-8?q?=EA=B1=B0=20=EC=A0=9C=EA=B1=B0=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-develop-cd.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/action-develop-cd.yml b/.github/workflows/action-develop-cd.yml index 80302c8..aef7857 100644 --- a/.github/workflows/action-develop-cd.yml +++ b/.github/workflows/action-develop-cd.yml @@ -5,12 +5,8 @@ on: push: branches: - develop - pull_request: # 테스트 트리거 - branches: - - develop - - feature/** - # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 +# 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: contents: read @@ -72,17 +68,6 @@ jobs: cache-from: type=gha cache-to: type=gha, mode=max - # Docker Hub 에 nginx 푸시 -# - name: Build and push nginx -# uses: docker/build-push-action@v4 -# with: -# context: ./nginx -# file: nginx/Dockerfile-nginx -# push: true -# tags: ${{ secrets.DOCKER_NGINX_REPOSITORY }}:latest -# cache-from: type=gha -# cache-to: type=gha, mode=max - # appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다. # 실행 시, docker-compose를 사용합니다. # useranme : ubuntu 우분투 기반 ec2 일 경우 기본이름 From aac45dcf3c7f5bfab17f334bd2d340b8c0ae748e Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 18:11:39 +0900 Subject: [PATCH 40/46] =?UTF-8?q?refactor=20:=20=EA=B0=9C=EB=B0=9C=20nginx?= =?UTF-8?q?=20=EC=A3=BC=EC=84=9D=20=EC=88=98=EC=A0=95=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 7e278f7..a0f3503 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -4,12 +4,11 @@ events { http { - # -------------------- spring-boot-prod WAS -------------------- + # -------------------- spring-boot-dev WAS -------------------- upstream backend { server server:8080; } - # -------------------- spring-boot-dev WAS -------------------- server { listen 80; server_name dev.nainga.store; From 79c3c9b56c13c02a9d3c1c613b0c43b37290576c Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 18:12:19 +0900 Subject: [PATCH 41/46] =?UTF-8?q?feat=20:=20=EC=9A=B4=EC=98=81=20CD=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 10 +++++++--- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index fff0165..de07f4a 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,6 +5,10 @@ on: push: branches: - main + pull_request: # 테스트 브랜치 + branches: + - develop + - feature/** # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: @@ -40,14 +44,14 @@ jobs: chmod +x ./gradlew ./gradlew clean build -x test - # 도커 컴포즈 설정 파일 서버로 전달 - - name: Send docker-compose.yml + # 설정 파일 서버로 전달 + - name: Send docker-compose.yml and nginx uses: appleboy/scp-action@master with: username: ${{ secrets.KCS_USERNAME_PROD }} host: ${{ secrets.KCS_HOST_PROD }} key: ${{ secrets.KCS_KEY_PROD }} - source: "src/main/resources/backend-submodule/docker-compose.yml" + source: "src/main/resources/backend-submodule/docker-compose.yml, src/main/resources/backend-submodule/nginx/nginx.conf" target: "/home/g22203/" # Docker hub 로그인 diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index ac45bcc..a51ab55 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 +Subproject commit a51ab553892d30f7a7b7afaab5f26740c223af93 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index ac3b02c..614a5b7 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit ac3b02c9239a685ee51ec4874a6e703414bf183e +Subproject commit 614a5b75a7bd04035791b642f83a7c72e21dba6f From 3c5bed89830bdde738426814ca9d9547fafde53d Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 18:37:05 +0900 Subject: [PATCH 42/46] =?UTF-8?q?feat=20:=20=EC=9A=B4=EC=98=81=20CD=20?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index de07f4a..f644a44 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -51,7 +51,7 @@ jobs: username: ${{ secrets.KCS_USERNAME_PROD }} host: ${{ secrets.KCS_HOST_PROD }} key: ${{ secrets.KCS_KEY_PROD }} - source: "src/main/resources/backend-submodule/docker-compose.yml, src/main/resources/backend-submodule/nginx/nginx.conf" + source: "src/main/resources/backend-submodule/docker-compose.yml,src/main/resources/backend-submodule/nginx/nginx.conf" target: "/home/g22203/" # Docker hub 로그인 From 0db70601eae2bb8dd63447d0a2fb8342d1d728a3 Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 18:42:55 +0900 Subject: [PATCH 43/46] =?UTF-8?q?fix=20:=20=EC=9A=B4=EC=98=81=20CD=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20nginx.conf=20=ED=8C=8C=EC=9D=BC=20home=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=B5=EC=82=AC=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index f644a44..58110bb 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -86,5 +86,6 @@ jobs: docker-compose -f docker-compose.yml down docker rmi $(docker images -q) cp -f ./src/main/resources/backend-submodule/docker-compose.yml . + cp -rf ./src/main/resources/backend-submodule/nginx . rm -r src docker-compose -f docker-compose.yml up -d \ No newline at end of file From 8d8495debbd2cf6b531222395ed21090d39fe429 Mon Sep 17 00:00:00 2001 From: hoon Date: Sat, 20 Jan 2024 20:05:10 +0900 Subject: [PATCH 44/46] =?UTF-8?q?fix=20:=20=EC=9A=B4=EC=98=81=20CD=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=ED=8A=B8?= =?UTF-8?q?=EB=A6=AC=EA=B1=B0=20=EC=82=AD=EC=A0=9C=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/action-production-cd.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/action-production-cd.yml b/.github/workflows/action-production-cd.yml index 58110bb..6068852 100644 --- a/.github/workflows/action-production-cd.yml +++ b/.github/workflows/action-production-cd.yml @@ -5,10 +5,6 @@ on: push: branches: - main - pull_request: # 테스트 브랜치 - branches: - - develop - - feature/** # 코드의 내용을 이 파일을 실행하여 action을 수행하는 주체(Github Actions에서 사용하는 VM)가 읽을 수 있도록 권한을 설정 permissions: From c35440683ce63b479404b2fbee4fb29c8882f712 Mon Sep 17 00:00:00 2001 From: sungjindev Date: Sat, 20 Jan 2024 20:55:32 +0900 Subject: [PATCH 45/46] =?UTF-8?q?refactor=20:=20=EC=95=BD=2020=EC=B4=88=20?= =?UTF-8?q?=EB=B3=91=EB=AA=A9=EC=9D=B4=20=EA=B1=B8=EB=A6=AC=EB=8D=98=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=EC=9D=84=20Hash=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EB=A5=BC=20=EC=9D=B4=EC=9A=A9=ED=95=B4=EC=84=9C=200.5=EC=B4=88?= =?UTF-8?q?=EB=A1=9C=20=EA=B0=9C=EC=84=A0=20(#69)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreCertificationService.java | 19 ++++++++++--------- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index 510eb01..48ab22e 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; @@ -22,16 +23,16 @@ public List findStoreCertificationsByLocation(Location north public List findStoreIdsWithMultipleCertifications() { List allStoreCertifications = storeCertificationRepository.findAll(); //중복된 id를 검사하기 위함 - List allStoreIds = new ArrayList<>(); - for (StoreCertification storeCertification : allStoreCertifications) { - allStoreIds.add(storeCertification.getStore().getId()); - } - List duplicatedIds = allStoreIds.stream() - .filter(e -> allStoreIds.indexOf(e) != allStoreIds.lastIndexOf(e)) //중복된 StoreId가 있는 경우 - .distinct() //해당 id를 모아서 1번씩만(중복 제거) 리스트에 담아 전달 - .collect(Collectors.toList()); + HashSet uniqueStoreIds = new HashSet<>(); //조회 성능을 높이기 위해 HashSet으로 저장 + HashSet duplicatedStoreIds = new HashSet<>(); - return duplicatedIds; + for (StoreCertification storeCertification : allStoreCertifications) { + Long storeId = storeCertification.getStore().getId(); + if (!uniqueStoreIds.add(storeId)) { //HashSet에 add를 했을 때 이미 존재하는 데이터면 false가 리턴되는 것을 활용 + duplicatedStoreIds.add(storeId); + } + } + return new ArrayList<>(duplicatedStoreIds); } } diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index ac45bcc..a51ab55 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit ac45bcc38fb66231b0dc339bdfb9a6556bbe3aa3 +Subproject commit a51ab553892d30f7a7b7afaab5f26740c223af93 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index ac3b02c..a51ab55 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit ac3b02c9239a685ee51ec4874a6e703414bf183e +Subproject commit a51ab553892d30f7a7b7afaab5f26740c223af93 From 9650f3abab91157f452fd5f4cefa13e38d019d3c Mon Sep 17 00:00:00 2001 From: sungjindev Date: Sat, 20 Jan 2024 21:18:35 +0900 Subject: [PATCH 46/46] =?UTF-8?q?refactor=20:=20=EB=B0=98=EB=B3=B5?= =?UTF-8?q?=EB=90=A0=20=ED=95=84=EC=9A=94=EA=B0=80=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EB=A1=9C=EC=A7=81=EC=9D=84=20Service?= =?UTF-8?q?=EB=8B=A8=EC=97=90=20PostConstruct=20init=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20(#69)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/StoreCertificationApi.java | 2 +- .../StoreCertificationService.java | 27 ++++++++++++++----- src/main/resources/backend-submodule | 2 +- src/test/resources/backend-submodule | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java index 6ae5c2f..4d4dcad 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/api/StoreCertificationApi.java @@ -45,7 +45,7 @@ public class StoreCertificationApi { @GetMapping("api/v1/storecertification/byLocation") public Result> findStoreCertificationsByLocation(@RequestParam("nwLong") double nwLong, @RequestParam("nwLat") double nwLat, @RequestParam("swLong") double swLong, @RequestParam("swLat") double swLat, @RequestParam("seLong") double seLong, @RequestParam("seLat") double seLat, @RequestParam("neLong") double neLong, @RequestParam("neLat") double neLat) { List storeCertificationsByLocation = storeCertificationService.findStoreCertificationsByLocation(new Location(nwLong, nwLat), new Location(swLong, swLat), new Location(seLong, seLat), new Location(neLong, neLat)); - List storeIdsWithMultipleCertifications = storeCertificationService.findStoreIdsWithMultipleCertifications(); //여러 인증제를 가지고 있는 가게의 id 리스트 + List storeIdsWithMultipleCertifications = storeCertificationService.getDuplicatedStoreIds(); //여러 인증제를 가지고 있는 가게의 id 리스트 List storeCertificationsByLocationResponses = new ArrayList<>(); //반환해줄 StoreCertificationsByLocationResponse들의 List Map map = new HashMap<>(); //여러 인증제를 가지고 있는 가게들의 response를 임시로 저장하고 있을 map diff --git a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java index 48ab22e..1390ef4 100644 --- a/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java +++ b/src/main/java/com/nainga/nainga/domain/storecertification/application/StoreCertificationService.java @@ -3,7 +3,9 @@ import com.nainga.nainga.domain.store.domain.Location; import com.nainga.nainga.domain.storecertification.dao.StoreCertificationRepository; import com.nainga.nainga.domain.storecertification.domain.StoreCertification; +import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -14,25 +16,36 @@ @Service @Transactional(readOnly = true) -@RequiredArgsConstructor public class StoreCertificationService { private final StoreCertificationRepository storeCertificationRepository; - public List findStoreCertificationsByLocation(Location northWestLocation, Location southWestLocation, Location southEastLocation, Location northEastLocation) { - return storeCertificationRepository.findStoreCertificationsByLocation(northWestLocation, southWestLocation, southEastLocation, northEastLocation); + private List duplicatedStoreIds; //여러 인증제를 가지는 중복된 storeId를 담고있는 리스트 + + @Autowired + public StoreCertificationService(StoreCertificationRepository storeCertificationRepository) { + this.storeCertificationRepository = storeCertificationRepository; } - public List findStoreIdsWithMultipleCertifications() { + @PostConstruct + public void init() { //이 Service Bean이 생성된 이후에 한번만 중복된 storeId를 검사해서 Globally하게 저장 List allStoreCertifications = storeCertificationRepository.findAll(); //중복된 id를 검사하기 위함 HashSet uniqueStoreIds = new HashSet<>(); //조회 성능을 높이기 위해 HashSet으로 저장 - HashSet duplicatedStoreIds = new HashSet<>(); + HashSet duplicatedIds = new HashSet<>(); for (StoreCertification storeCertification : allStoreCertifications) { Long storeId = storeCertification.getStore().getId(); if (!uniqueStoreIds.add(storeId)) { //HashSet에 add를 했을 때 이미 존재하는 데이터면 false가 리턴되는 것을 활용 - duplicatedStoreIds.add(storeId); + duplicatedIds.add(storeId); } } - return new ArrayList<>(duplicatedStoreIds); + duplicatedStoreIds = new ArrayList<>(duplicatedIds); + } + + public List findStoreCertificationsByLocation(Location northWestLocation, Location southWestLocation, Location southEastLocation, Location northEastLocation) { + return storeCertificationRepository.findStoreCertificationsByLocation(northWestLocation, southWestLocation, southEastLocation, northEastLocation); + } + + public List getDuplicatedStoreIds() { + return duplicatedStoreIds; } } diff --git a/src/main/resources/backend-submodule b/src/main/resources/backend-submodule index a51ab55..67e3a62 160000 --- a/src/main/resources/backend-submodule +++ b/src/main/resources/backend-submodule @@ -1 +1 @@ -Subproject commit a51ab553892d30f7a7b7afaab5f26740c223af93 +Subproject commit 67e3a628d394ee510efccd846b3e70e63ce63e42 diff --git a/src/test/resources/backend-submodule b/src/test/resources/backend-submodule index a51ab55..67e3a62 160000 --- a/src/test/resources/backend-submodule +++ b/src/test/resources/backend-submodule @@ -1 +1 @@ -Subproject commit a51ab553892d30f7a7b7afaab5f26740c223af93 +Subproject commit 67e3a628d394ee510efccd846b3e70e63ce63e42