diff --git a/.github/ISSUE_TEMPLATE/issue_template.md b/.github/ISSUE_TEMPLATE/issue_template.md new file mode 100644 index 0000000..8f9da6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue_template.md @@ -0,0 +1,17 @@ +--- +name: issue_template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + +## ✨ About Issue ✨ + + +
+ +## ✅ Todo + +- [ ] todo ! diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..93b8f10 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,25 @@ +## 🚩 관련 이슈 +- close # + +## 📋 구현 기능 명세 +- [x] + +## 📌 PR Point +- 무슨 이유로 어떻게 코드를 변경했는지 + + +- 어떤 부분에 리뷰어가 집중해야 하는지 + + +- 개발하면서 어떤 점이 궁금했는지 + +## 📸 결과물 스크린샷 +```java +결과 예시 사진 첨부 +``` + +## 🛠️ 테스트 +- [x] 테스트 + +## 🚀 API Endpoint +- diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000..e982631 --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,63 @@ +name: CD + +on: + push: + branches: [ "develop" ] + +jobs: + deploy-ci: + runs-on: ubuntu-22.04 + env: + working-directory: linkmind + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: application.yaml 생성 + run: | + cd src/main/resources + echo "${{ secrets.APPLICATION }}" > ./application-dev.yaml + working-directory: ${{ env.working-directory }} + + - name: 빌드 + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash + + - name: docker build 가능하도록 환경 설정 + uses: docker/setup-buildx-action@v2.9.1 + + - name: docker hub에로그인 + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} + password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} + + - name: docker image 빌드 및 푸시 + run: | + docker build --platform linux/amd64 -t mmihye/toaster . + docker push mmihye/toaster + working-directory: ${{ env.working-directory }} + + deploy-cd: + needs: deploy-ci + runs-on: ubuntu-22.04 + + steps: + - name: 도커 컨테이너 실행 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.RELEASE_SERVER_IP }} + username: ${{ secrets.RELEASE_SERVER_USER }} + key: ${{ secrets.RELEASE_SERVER_KEY }} + script: | + cd ~ + ./deploy.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..14beae2 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,34 @@ +name: CI + +on: + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-22.04 + env: + working-directory: linkmind + + steps: + - name: 체크아웃 + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: '17' + + - name: application.yaml 생성 + run: | + cd src/main/resources + echo "${{ secrets.APPLICATION }}" > ./application.yaml + working-directory: ${{ env.working-directory }} + + - name: 빌드 + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash diff --git a/linkmind/.gitignore b/linkmind/.gitignore index 3c661c1..e5d8bad 100644 --- a/linkmind/.gitignore +++ b/linkmind/.gitignore @@ -37,3 +37,7 @@ out/ .vscode/ application-dev.yml application-local.yml +/src/test/resources/application-dev.yml +/src/test/resources/application-local.yml +/src/main/resources/application-dev.yml +/src/main/resources/application-local.yml diff --git a/linkmind/Dockerfile b/linkmind/Dockerfile new file mode 100644 index 0000000..82d38d0 --- /dev/null +++ b/linkmind/Dockerfile @@ -0,0 +1,7 @@ +FROM amd64/amazoncorretto:17 + +WORKDIR /app + +COPY ./build/libs/toaster-0.0.1-SNAPSHOT.jar /app/toaster.jar + +CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "toaster.jar"] diff --git a/linkmind/build.gradle b/linkmind/build.gradle index cd8d605..65e0363 100644 --- a/linkmind/build.gradle +++ b/linkmind/build.gradle @@ -26,11 +26,13 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'mysql:mysql-connector-java:8.0.32' compileOnly 'org.projectlombok:lombok' - implementation 'org.springframework.boot:spring-boot-starter-security' - testImplementation 'org.springframework.security:spring-security-test' + //implementation 'org.springframework.boot:spring-boot-starter-security' + //testImplementation 'org.springframework.security:spring-security-test' + implementation 'org.springframework.boot:spring-boot-starter-actuator' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' runtimeOnly 'com.mysql:mysql-connector-j' + implementation 'org.springframework.boot:spring-boot-starter-actuator' } tasks.named('test') { diff --git a/linkmind/settings.gradle b/linkmind/settings.gradle index 2f29581..2b45373 100644 --- a/linkmind/settings.gradle +++ b/linkmind/settings.gradle @@ -1 +1 @@ -rootProject.name = 'linkmind' +rootProject.name = 'toaster' diff --git a/linkmind/src/main/java/com/app/linkmind/config/.gitkeep b/linkmind/src/main/java/com/app/linkmind/config/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/controller/.gitkeep b/linkmind/src/main/java/com/app/linkmind/controller/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/domain/.gitkeep b/linkmind/src/main/java/com/app/linkmind/domain/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/external/client/aws/.gitkeep b/linkmind/src/main/java/com/app/linkmind/external/client/aws/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/infrastructure/.gitkeep b/linkmind/src/main/java/com/app/linkmind/infrastructure/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/service/.gitkeep b/linkmind/src/main/java/com/app/linkmind/service/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/linkmind/src/main/java/com/app/linkmind/LinkmindApplication.java b/linkmind/src/main/java/com/app/toaster/ToasterApplication.java similarity index 61% rename from linkmind/src/main/java/com/app/linkmind/LinkmindApplication.java rename to linkmind/src/main/java/com/app/toaster/ToasterApplication.java index 2c59189..3ecea32 100644 --- a/linkmind/src/main/java/com/app/linkmind/LinkmindApplication.java +++ b/linkmind/src/main/java/com/app/toaster/ToasterApplication.java @@ -1,13 +1,13 @@ -package com.app.linkmind; +package com.app.toaster; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class LinkmindApplication { +public class ToasterApplication { public static void main(String[] args) { - SpringApplication.run(LinkmindApplication.class, args); + SpringApplication.run(ToasterApplication.class, args); } } diff --git a/linkmind/src/main/java/com/app/linkmind/common/advice/ControllerExceptionAdvice.java b/linkmind/src/main/java/com/app/toaster/common/advice/ControllerExceptionAdvice.java similarity index 85% rename from linkmind/src/main/java/com/app/linkmind/common/advice/ControllerExceptionAdvice.java rename to linkmind/src/main/java/com/app/toaster/common/advice/ControllerExceptionAdvice.java index a63dd5b..0ddbf1a 100644 --- a/linkmind/src/main/java/com/app/linkmind/common/advice/ControllerExceptionAdvice.java +++ b/linkmind/src/main/java/com/app/toaster/common/advice/ControllerExceptionAdvice.java @@ -1,12 +1,12 @@ -package com.app.linkmind.common.advice; +package com.app.toaster.common.advice; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import com.app.linkmind.common.dto.ApiResponse; -import com.app.linkmind.exception.model.CustomException; +import com.app.toaster.common.dto.ApiResponse; +import com.app.toaster.exception.model.CustomException; import lombok.NoArgsConstructor; diff --git a/linkmind/src/main/java/com/app/linkmind/common/dto/ApiResponse.java b/linkmind/src/main/java/com/app/toaster/common/dto/ApiResponse.java similarity index 87% rename from linkmind/src/main/java/com/app/linkmind/common/dto/ApiResponse.java rename to linkmind/src/main/java/com/app/toaster/common/dto/ApiResponse.java index cd3ffb2..466c4b9 100644 --- a/linkmind/src/main/java/com/app/linkmind/common/dto/ApiResponse.java +++ b/linkmind/src/main/java/com/app/toaster/common/dto/ApiResponse.java @@ -1,7 +1,7 @@ -package com.app.linkmind.common.dto; +package com.app.toaster.common.dto; -import com.app.linkmind.exception.Error; -import com.app.linkmind.exception.Success; +import com.app.toaster.exception.Error; +import com.app.toaster.exception.Success; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/linkmind/src/main/java/com/app/toaster/controller/HealthCheckController.java b/linkmind/src/main/java/com/app/toaster/controller/HealthCheckController.java new file mode 100644 index 0000000..3582b1f --- /dev/null +++ b/linkmind/src/main/java/com/app/toaster/controller/HealthCheckController.java @@ -0,0 +1,13 @@ +package com.app.toaster.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HealthCheckController { + + @GetMapping("/health") + public String healthCheck() { + return "OK"; + } +} diff --git a/linkmind/src/main/java/com/app/linkmind/exception/Error.java b/linkmind/src/main/java/com/app/toaster/exception/Error.java similarity index 95% rename from linkmind/src/main/java/com/app/linkmind/exception/Error.java rename to linkmind/src/main/java/com/app/toaster/exception/Error.java index b42157d..c08a4b5 100644 --- a/linkmind/src/main/java/com/app/linkmind/exception/Error.java +++ b/linkmind/src/main/java/com/app/toaster/exception/Error.java @@ -1,4 +1,4 @@ -package com.app.linkmind.exception; +package com.app.toaster.exception; import org.springframework.http.HttpStatus; diff --git a/linkmind/src/main/java/com/app/linkmind/exception/Success.java b/linkmind/src/main/java/com/app/toaster/exception/Success.java similarity index 95% rename from linkmind/src/main/java/com/app/linkmind/exception/Success.java rename to linkmind/src/main/java/com/app/toaster/exception/Success.java index c6986a7..12a6995 100644 --- a/linkmind/src/main/java/com/app/linkmind/exception/Success.java +++ b/linkmind/src/main/java/com/app/toaster/exception/Success.java @@ -1,4 +1,4 @@ -package com.app.linkmind.exception; +package com.app.toaster.exception; import org.springframework.http.HttpStatus; diff --git a/linkmind/src/main/java/com/app/linkmind/exception/model/CustomException.java b/linkmind/src/main/java/com/app/toaster/exception/model/CustomException.java similarity index 77% rename from linkmind/src/main/java/com/app/linkmind/exception/model/CustomException.java rename to linkmind/src/main/java/com/app/toaster/exception/model/CustomException.java index b0657a8..ea0a02f 100644 --- a/linkmind/src/main/java/com/app/linkmind/exception/model/CustomException.java +++ b/linkmind/src/main/java/com/app/toaster/exception/model/CustomException.java @@ -1,6 +1,6 @@ -package com.app.linkmind.exception.model; +package com.app.toaster.exception.model; -import com.app.linkmind.exception.Error; +import com.app.toaster.exception.Error; import lombok.Getter; diff --git a/linkmind/src/main/java/com/app/linkmind/exception/model/NotFoundException.java b/linkmind/src/main/java/com/app/toaster/exception/model/NotFoundException.java similarity index 63% rename from linkmind/src/main/java/com/app/linkmind/exception/model/NotFoundException.java rename to linkmind/src/main/java/com/app/toaster/exception/model/NotFoundException.java index 7040e49..ec9d965 100644 --- a/linkmind/src/main/java/com/app/linkmind/exception/model/NotFoundException.java +++ b/linkmind/src/main/java/com/app/toaster/exception/model/NotFoundException.java @@ -1,6 +1,6 @@ -package com.app.linkmind.exception.model; +package com.app.toaster.exception.model; -import com.app.linkmind.exception.Error; +import com.app.toaster.exception.Error; public class NotFoundException extends CustomException { public NotFoundException(Error error, String message) { diff --git a/linkmind/src/main/resources/data.sql b/linkmind/src/main/resources/data.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/linkmind/src/main/resources/data.sql @@ -0,0 +1 @@ + diff --git a/linkmind/src/test/java/com/app/linkmind/LinkmindApplicationTests.java b/linkmind/src/test/java/com/app/toaster/ToasterApplicationTests.java similarity index 71% rename from linkmind/src/test/java/com/app/linkmind/LinkmindApplicationTests.java rename to linkmind/src/test/java/com/app/toaster/ToasterApplicationTests.java index 8d024c1..1dce7bf 100644 --- a/linkmind/src/test/java/com/app/linkmind/LinkmindApplicationTests.java +++ b/linkmind/src/test/java/com/app/toaster/ToasterApplicationTests.java @@ -1,10 +1,10 @@ -package com.app.linkmind; +package com.app.toaster; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -class LinkmindApplicationTests { +class ToasterApplicationTests { @Test void contextLoads() {