From 71fbde7af1a79f3f9de995212331051070976b57 Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 01:44:14 +0900 Subject: [PATCH 1/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20workflow?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ebextensions_dev/00-makeFiles.config | 0 .ebextensions_dev/01-set-timezone.config | 0 .github/workflows/dev_deploy.yml | 62 +++++++++++++++++++ .platform/nginx.conf | 0 .../nginx/conf.d/client_max_body_size.conf | 0 Procfile | 0 6 files changed, 62 insertions(+) create mode 100644 .ebextensions_dev/00-makeFiles.config create mode 100644 .ebextensions_dev/01-set-timezone.config create mode 100644 .github/workflows/dev_deploy.yml create mode 100644 .platform/nginx.conf create mode 100644 .platform/nginx/conf.d/client_max_body_size.conf create mode 100644 Procfile diff --git a/.ebextensions_dev/00-makeFiles.config b/.ebextensions_dev/00-makeFiles.config new file mode 100644 index 00000000..e69de29b diff --git a/.ebextensions_dev/01-set-timezone.config b/.ebextensions_dev/01-set-timezone.config new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml new file mode 100644 index 00000000..9e28cd58 --- /dev/null +++ b/.github/workflows/dev_deploy.yml @@ -0,0 +1,62 @@ +name: TheGoods Dev CI/CD + +on: + pull_request: + types: [ closed ] # 1. pr close 발생 시 + workflow_dispatch: # 2. 수동 실행 가능하도록 + +jobs: + build: + runs-on: ubuntu-latest # 3. OS 환경 + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev' + + steps: + - name: Checkout + uses: actions/checkout@v2 # 4. 코드 checkout + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 # 5. 자바 설치 + distribution: 'adopt' + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash # 6.권한 부여 + + - name: Build with Gradle + run: ./gradlew clean build -x test + shell: bash # 7. build 시작 + + - name: Get current time + uses: 1466587594/get-current-time@v2 + id: current-time + with: + format: YYYY-MM-DDTHH-mm-ss + utcOffset: "+09:00" # 8. build 시점의 시간 정보 + + - name: Show Current Time + run: echo "CurrentTime=$" + shell: bash # 9. 시간 보여주기 + + - name: Generate deployment package + run: | + mkdir -p deploy + cp build/libs/*.jar deploy/application.jar + cp Procfile deploy/Procfile + cp -r .ebextensions_dev deploy/.ebextensions + cp -r .platform deploy/.platform + cd deploy && zip -r deploy.zip . + + - name: Beanstalk Deploy + uses: einaregilsson/beanstalk-deploy@v20 + with: + aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} + aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} + application_name: breifing-dev + environment_name: Breifing-dev-env + version_label: github-action-${{ steps.current-time.outputs.formattedTime }} + region: ap-northeast-1 + deployment_package: deploy/deploy.zip + wait_for_deployment: false + diff --git a/.platform/nginx.conf b/.platform/nginx.conf new file mode 100644 index 00000000..e69de29b diff --git a/.platform/nginx/conf.d/client_max_body_size.conf b/.platform/nginx/conf.d/client_max_body_size.conf new file mode 100644 index 00000000..e69de29b diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..e69de29b From e54b0662d59eb3799680eaebf939367775aab2df Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 01:44:45 +0900 Subject: [PATCH 2/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20ebextens?= =?UTF-8?q?ions=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ebextensions_dev/00-makeFiles.config | 12 ++++++++++++ .ebextensions_dev/01-set-timezone.config | 3 +++ 2 files changed, 15 insertions(+) diff --git a/.ebextensions_dev/00-makeFiles.config b/.ebextensions_dev/00-makeFiles.config index e69de29b..18716a6e 100644 --- a/.ebextensions_dev/00-makeFiles.config +++ b/.ebextensions_dev/00-makeFiles.config @@ -0,0 +1,12 @@ +files: + "/sbin/appstart": + mode: "000755" + owner: webapp + group: webapp + content: | + #!/usr/bin/env bash + JAR_PATH=/var/app/current/application.jar + + # run app + killall java + java -Dfile.encoding=UTF-8 -jar $JAR_PATH diff --git a/.ebextensions_dev/01-set-timezone.config b/.ebextensions_dev/01-set-timezone.config index e69de29b..9eb35961 100644 --- a/.ebextensions_dev/01-set-timezone.config +++ b/.ebextensions_dev/01-set-timezone.config @@ -0,0 +1,3 @@ +commands: + set_time_zone: + command: ln -f -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime From 6c77beafaf757cdac654a267e9d19a6f02c6b022 Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 01:50:13 +0900 Subject: [PATCH 3/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20nginx=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .platform/nginx.conf | 63 +++++++++++++++++++ .../nginx/conf.d/client_max_body_size.conf | 1 + 2 files changed, 64 insertions(+) diff --git a/.platform/nginx.conf b/.platform/nginx.conf index e69de29b..471a08ed 100644 --- a/.platform/nginx.conf +++ b/.platform/nginx.conf @@ -0,0 +1,63 @@ +user nginx; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +worker_processes auto; +worker_rlimit_nofile 33282; + +events { + use epoll; + worker_connections 1024; + multi_accept on; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + include conf.d/*.conf; + + map $http_upgrade $connection_upgrade { + default "upgrade"; + } + + upstream springboot { + server 127.0.0.1:8080; + keepalive 1024; + } + + server { + listen 80 default_server; + listen [::]:80 default_server; + + location / { + proxy_pass http://springboot; + # CORS 관련 헤더 추가 + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; + add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type'; + proxy_http_version 1.1; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Upgrade $http_upgrade; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + access_log /var/log/nginx/access.log main; + + client_header_timeout 60; + client_body_timeout 60; + keepalive_timeout 60; + gzip off; + gzip_comp_level 4; + + # Include the Elastic Beanstalk generated locations + include conf.d/elasticbeanstalk/healthd.conf; + } +} diff --git a/.platform/nginx/conf.d/client_max_body_size.conf b/.platform/nginx/conf.d/client_max_body_size.conf index e69de29b..af9b1927 100644 --- a/.platform/nginx/conf.d/client_max_body_size.conf +++ b/.platform/nginx/conf.d/client_max_body_size.conf @@ -0,0 +1 @@ +client_max_body_size:200M; From 04af2bf016a47677a4b36aec18556f7ea982ae81 Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 01:50:49 +0900 Subject: [PATCH 4/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20Procfile?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80,=20application.yml=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Procfile | 1 + build.gradle | 4 ++++ src/main/resources/application.yml | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/Procfile b/Procfile index e69de29b..d7df372f 100644 --- a/Procfile +++ b/Procfile @@ -0,0 +1 @@ +web: appstart diff --git a/build.gradle b/build.gradle index eaa03c35..ce4092d0 100644 --- a/build.gradle +++ b/build.gradle @@ -50,3 +50,7 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +jar { + enabled = false +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 17a87c2c..596edd62 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -45,3 +45,9 @@ logging: jwt: token: secret: "secretKey" + +servlet: + multipart: + enabled: true + maxFileSize: 200MB + maxRequestSize: 300MB From 1e639ef0b09093992d87d5e4306fb5f541891fea Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 02:02:51 +0900 Subject: [PATCH 5/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20deploy?= =?UTF-8?q?=20=ED=8C=8C=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/dev_deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 9e28cd58..2d02c28b 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -53,10 +53,10 @@ jobs: with: aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} - application_name: breifing-dev - environment_name: Breifing-dev-env + application_name: thegoods-dev + environment_name: Thegoods-dev-env version_label: github-action-${{ steps.current-time.outputs.formattedTime }} - region: ap-northeast-1 + region: ap-northeast-2 deployment_package: deploy/deploy.zip wait_for_deployment: false From 04ae89adcdeb39db4ad28c5c1929e84051838889 Mon Sep 17 00:00:00 2001 From: Eunjin Kim Date: Tue, 6 Feb 2024 02:10:43 +0900 Subject: [PATCH 6/6] =?UTF-8?q?:construction=5Fworker:=20CI/CD:=20healthCh?= =?UTF-8?q?eck=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/TheGoods/web/controller/RootController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/com/umc/TheGoods/web/controller/RootController.java diff --git a/src/main/java/com/umc/TheGoods/web/controller/RootController.java b/src/main/java/com/umc/TheGoods/web/controller/RootController.java new file mode 100644 index 00000000..e601869e --- /dev/null +++ b/src/main/java/com/umc/TheGoods/web/controller/RootController.java @@ -0,0 +1,12 @@ +package com.umc.TheGoods.web.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RootController { + @GetMapping("/health") + public String healthCheck() { + return "OK, healthy!"; + } +}