-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/#60
- Loading branch information
Showing
129 changed files
with
3,150 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
permissions: | ||
contents: write # Docker 이미지 푸시 및 배포 시 사용 | ||
|
||
jobs: | ||
CI-CD: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./backend | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('backend/**/*.gradle*', 'backend/**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build with Gradle | ||
run: ./gradlew build -x test -DPROD_SERVER_URL=${{ secrets.PROD_SERVER_URL }} -Pspring.profiles.active=prod | ||
|
||
- name: Docker build & push to prod | ||
if: contains(github.ref, 'develop') | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} | ||
- name: Deploy to prod | ||
uses: appleboy/[email protected] # 최신 릴리스 버전을 명시하는 것 | ||
id: deploy-prod | ||
if: contains(github.ref, 'develop') | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
envs: GITHUB_SHA | ||
script: | | ||
sudo docker stop ${{ secrets.DOCKER_REPOSITORY }} || true | ||
sudo docker rm ${{ secrets.DOCKER_REPOSITORY }} || true | ||
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} | ||
sudo docker run -d -p 8080:8080 \ | ||
--network ${{ secrets.DOCKER_NERWORK }} \ | ||
-e DB_HOST=${{ secrets.DB_HOST }} \ | ||
-e DB_NAME=${{ secrets.DB_NAME }} \ | ||
-e DB_PORT=${{ secrets.DB_PORT }} \ | ||
-e DB_USERNAME=${{ secrets.DB_USERNAME }} \ | ||
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \ | ||
-e REDIS_HOST=${{ secrets.REDIS_HOST }} \ | ||
-e REDIS_PORT=${{ secrets.REDIS_PORT }} \ | ||
-e JWT_SECRET=${{ secrets.JWT_SECRET }} \ | ||
-e JWT_ACCESS_TOKEN_TIME=${{ secrets.JWT_ACCESS_TOKEN_TIME }} \ | ||
-e JWT_REFRESH_TOKEN_TIME=${{ secrets.JWT_REFRESH_TOKEN_TIME }} \ | ||
-e KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }} \ | ||
-e KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }} \ | ||
-e NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }} \ | ||
-e NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }} \ | ||
-e ODSAY_CLIENT_API_KEY=${{ secrets.ODSAY_CLIENT_API_KEY }} \ | ||
-e PROD_SERVER_URL=${{ secrets.PROD_SERVER_URL }} \ | ||
--name ${{ secrets.DOCKER_REPOSITORY }} \ | ||
${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} | ||
sudo docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/.idea/workspace.xml | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# open jdk 17 버전의 환경을 구성 | ||
FROM openjdk:17 | ||
|
||
# build가 되는 시점에 JAR_FILE이라는 변수 명에 build/libs/*.jar 선언 | ||
# build/libs - gradle로 빌드했을 때 jar 파일이 생성되는 경로 | ||
ARG JAR_FILE=build/libs/*.jar | ||
|
||
# JAR_FILE을 app.jar로 복사 | ||
COPY ${JAR_FILE} app.jar | ||
|
||
# 운영 및 개발에서 사용되는 환경 설정을 분리 | ||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/com/dubu/backend/global/domain/PageResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.dubu.backend.global.domain; | ||
|
||
public record PageResponse<T>(boolean hasNext, Long nextCursor, T data) { | ||
public record PageResponse<C, T>(boolean hasNext, C nextCursor, T data) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
backend/src/main/java/com/dubu/backend/plan/api/PlanController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.dubu.backend.plan.api; | ||
|
||
import com.dubu.backend.global.domain.SuccessResponse; | ||
import com.dubu.backend.plan.application.PlanService; | ||
import com.dubu.backend.plan.dto.request.PlanSaveRequest; | ||
import com.dubu.backend.plan.dto.response.PlanRecentResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/plans") | ||
public class PlanController { | ||
private final PlanService planService; | ||
|
||
@ResponseStatus(HttpStatus.CREATED) | ||
@PostMapping | ||
public void savePlan( | ||
@RequestAttribute("memberId") Long memberId, | ||
@RequestBody PlanSaveRequest planSaveRequest | ||
) { | ||
planService.savePlan(memberId, planSaveRequest); | ||
} | ||
|
||
@GetMapping("/recent") | ||
public SuccessResponse<PlanRecentResponse> getRecentPlan( | ||
@RequestAttribute("memberId") Long memberId | ||
) { | ||
PlanRecentResponse response = planService.findRecentPlan(memberId); | ||
|
||
return new SuccessResponse<>(response); | ||
} | ||
|
||
@ResponseStatus(HttpStatus.NO_CONTENT) | ||
@DeleteMapping | ||
public void deletePlan( | ||
@RequestAttribute("memberId") Long memberId, | ||
@RequestParam("planId") Long planId | ||
){ | ||
planService.removePlan(memberId, planId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.