From 4b91ceedc4320132198ded41b3744f0657fed8ed Mon Sep 17 00:00:00 2001 From: nnijgnus <76596376+k000927@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:19:57 +0900 Subject: [PATCH 1/8] Update README.md --- README.md | 60 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 3e547f94..1f69f6fc 100644 --- a/README.md +++ b/README.md @@ -24,26 +24,46 @@ docs: 문서 작성 ### 폴더 구조 ```jsx -└── src - ├── apis - │ └── badgeAPI.ts - ├── components - │ └── Header - │ └── index.tsx - ├── constants - │ └── log.ts - │ └── color.ts - ├── contexts - │ └── badgeContext.tsx - ├── hooks - │ └── useFetch.tsx - ├── pages - │ └── Main - │ └── index.tsx - ├── types - │ └── badge.ts - └── utils - └── badge.ts +. +├── main +│   ├── java +│   │   └── JGS +│   │   └── CasperEvent +│   │   ├── domain +│   │   │   ├── event +│   │   │   │   ├── controller +│   │   │   │   │   ├── adminController +│   │   │   │   │   └── eventController +│   │   │   │   ├── dto +│   │   │   │   ├── entity +│   │   │   │   │   ├── admin +│   │   │   │   │   ├── casperBot +│   │   │   │   │   │   └── casperEnum +│   │   │   │   │   ├── event +│   │   │   │   │   └── participants +│   │   │   │   ├── repository +│   │   │   │   │   ├── eventRepository +│   │   │   │   │   └── participantsRepository +│   │   │   │   └── service +│   │   │   │   ├── AdminService +│   │   │   │   └── eventService +│   │   │   ├── health +│   │   │   │   └── api +│   │   │   └── url +│   │   │   ├── controller +│   │   │   ├── entity +│   │   │   ├── repository +│   │   │   └── service +│   │   └── global +│   │   ├── entity +│   │   ├── error +│   │   └── response +│   └── resources +└── test + └── java + └── JGS + └── CasperEvent + └── LotteryEventTests ``` ### 커밋 템플릿 From 2723f1aeab37242785f873a3506505a8a23795ec Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 10:56:37 +0900 Subject: [PATCH 2/8] =?UTF-8?q?chore:=20CICD=EB=A5=BC=20=EC=9C=84=ED=95=9C?= =?UTF-8?q?=20deploy.yml=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/.github/workflows/deploy.yml | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Server/.github/workflows/deploy.yml diff --git a/Server/.github/workflows/deploy.yml b/Server/.github/workflows/deploy.yml new file mode 100644 index 00000000..894c01c4 --- /dev/null +++ b/Server/.github/workflows/deploy.yml @@ -0,0 +1,66 @@ +name: Deploy to EC2 with Docker Compose + +on: + pull_request: + branches: + - dev + +env: + AWS_REGION: ap-northeast-2 + DOCKER_HUB_REPOSITORY: baeeejw/jgs-spring-boot + working-directory: ./Server + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: JDK 17 설치 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'corretto' + + - name: gradlew에 실행 권한 부여 + run: chmod +x gradlew + working-directory: ${{ env.working-directory }} + + - name: 프로젝트 빌드 + run: ./gradlew clean build -x test + working-directory: ${{ env.working-directory }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Build and push Docker image + run: | + docker buildx build --push --tag ${{ env.DOCKER_HUB_REPOSITORY }}:latest . + working-directory: ${{ env.working-directory }} + + - name: SSH into EC2 and deploy with Docker Compose + uses: appleboy/ssh-action@v0.1.8 + with: + host: ${{ secrets.EC2_HOST }} + username: ubuntu + key: ${{ secrets.EC2_SECRET }} + script: | + cd /home/ubuntu/spring-boot + docker-compose pull + docker-compose up -d From aad9ddc623bc8a5712fade714f8031b400c3e4df Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 10:59:37 +0900 Subject: [PATCH 3/8] =?UTF-8?q?chore:=20=EB=B0=B0=ED=8F=AC=ED=95=A0=20?= =?UTF-8?q?=EB=95=8C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20Dockerfile=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 --- Server/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Server/Dockerfile diff --git a/Server/Dockerfile b/Server/Dockerfile new file mode 100644 index 00000000..1351a605 --- /dev/null +++ b/Server/Dockerfile @@ -0,0 +1,7 @@ +FROM amazoncorretto:17 +# FROM openjdk:17-jdk +ARG JAR_FILE=build/libs/*.jar +COPY ${JAR_FILE} jgs-spring-boot.jar +# COPY build/libs/*.jar my-project.jar +ENTRYPOINT ["java","-jar","/jgs-spring-boot.jar"] +RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime From 40c02432e4fc6993f79c085393b975b9cdeca669 Mon Sep 17 00:00:00 2001 From: Jungwoo Bae <51515170+wjddn2165@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:04:46 +0900 Subject: [PATCH 4/8] Update issue templates --- .github/ISSUE_TEMPLATE/custom.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/custom.md diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 00000000..544721c3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,18 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + +## 🖥️ Preview + +close #{issue number} + +## ✏️ 한 일 + +## ❗️ 발생한 이슈 (해결 방안) + +## ❓ 논의가 필요한 사항 From 60c61a276cdf2363b125ad19ef6b6894f0cf6260 Mon Sep 17 00:00:00 2001 From: Jungwoo Bae <51515170+wjddn2165@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:09:38 +0900 Subject: [PATCH 5/8] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 12 ++++++++++++ .github/ISSUE_TEMPLATE/custom.md | 18 ------------------ .github/ISSUE_TEMPLATE/feature_request.md | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/custom.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..f28ff3ea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,12 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +## 🖥️ 어떤 버그인가요? + +## ❗️ 참고 자료 (선택) diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md deleted file mode 100644 index 544721c3..00000000 --- a/.github/ISSUE_TEMPLATE/custom.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Custom issue template -about: Describe this issue template's purpose here. -title: '' -labels: '' -assignees: '' - ---- - -## 🖥️ Preview - -close #{issue number} - -## ✏️ 한 일 - -## ❗️ 발생한 이슈 (해결 방안) - -## ❓ 논의가 필요한 사항 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..5bef5ce3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +## 🖥️ 어떤 기능인가요? + +## ✏️ 작업 상세 내용 + +## ❗️ 참고 자료 (선택) From ba0e779785630e34ea1fde2e9e907b157095b62b Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 11:09:59 +0900 Subject: [PATCH 6/8] =?UTF-8?q?chore:=20PR=20=ED=85=9C=ED=94=8C=EB=A6=BF?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=B4=20?= =?UTF-8?q?md=20=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/.github/PULL_REQUEST_TEMPLATE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Server/.github/PULL_REQUEST_TEMPLATE.md diff --git a/Server/.github/PULL_REQUEST_TEMPLATE.md b/Server/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..d887bab7 --- /dev/null +++ b/Server/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,9 @@ +## 🖥️ Preview + +close #{issue number} + +## ✏️ 한 일 + +## ❗️ 발생한 이슈 (해결 방안) + +## ❓ 논의가 필요한 사항 \ No newline at end of file From 31f4a6d9d1b4720e8d17c3b844c739ce379a721d Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 11:29:32 +0900 Subject: [PATCH 7/8] =?UTF-8?q?chore:=20.github=20=EB=94=94=EB=A0=89?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {Server/.github => .github}/PULL_REQUEST_TEMPLATE.md | 0 {Server/.github => .github}/workflows/deploy.yml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {Server/.github => .github}/PULL_REQUEST_TEMPLATE.md (100%) rename {Server/.github => .github}/workflows/deploy.yml (100%) diff --git a/Server/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from Server/.github/PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/Server/.github/workflows/deploy.yml b/.github/workflows/deploy.yml similarity index 100% rename from Server/.github/workflows/deploy.yml rename to .github/workflows/deploy.yml From 12a323c9e7218fbad845886471bb1f8d5c526ac9 Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 14:29:06 +0900 Subject: [PATCH 8/8] =?UTF-8?q?feat:=20Swagger=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20config=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/build.gradle | 1 + .../global/config/SwaggerConfig.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java diff --git a/Server/build.gradle b/Server/build.gradle index abf90c48..cec2906e 100644 --- a/Server/build.gradle +++ b/Server/build.gradle @@ -22,6 +22,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' } tasks.named('test') { diff --git a/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java b/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java new file mode 100644 index 00000000..388701b2 --- /dev/null +++ b/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java @@ -0,0 +1,24 @@ +package JGS.CasperEvent.global.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + @Bean + public OpenAPI openAPI() { + return new OpenAPI() + .components(new Components()) + .info(apiInfo()); + } + + private Info apiInfo() { + return new Info() + .title("API Test") // API의 제목 + .description("Let's practice Swagger UI") // API에 대한 설명 + .version("1.0.0"); // API의 버전 + } +}