-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: ApiFolderErrorCode 오타 수정 (#468) * [REFACTOR] 픽 리팩토링, 검색 테스트 구현 (#474) * refactor: FolderType label 수정 * refactor: 파라미터 idList -> pickIdList 명시적으로 변경 * refactor: folder 내부에 있는 pick_order 리스트에 pickId가 중복 생성되는 문제 해결 * refactor: root folder 검색 못하도록 예외 처리 * refactor: pick controller 메서드명 수정 * refactor: DB fleid 함수를 이용하여 정렬된 픽 리스트 조회할 수 있는 메서드 구현 * refactor: 픽 검색 시 폴더 리스트가 null인 경우 검증하지 않도록 변경, tag 검증 추가 * refactor: 테스트 코드 작성 * refactor: 테스트 코드 ParameterizedTest로 리팩토링 (#476) * [FIX] 픽 수정 리팩토링 및 검증로직 개선 (#477) * refactor: 불필요한 초기값 제거 * fix: 엔티티를 list로 조회시 존재하지 않는 엔티티를 조회하려고 하면 NOT_FOUND 예외 발생 * fix: pick update시 부모폴더 id도 변경 가능하도록 수정, 누락된 검증 로직 추가 * fix: 기능 변경에 의한 테스트 코드 수정 * fix: idList로 폴더 조회시 존재하지 않는 폴더id로 조회하면 예외 발생 * refactor: 파라미터명 명확하게 수정 idList -> folderIdList * feat: 폴더 응답에 생성 수정 일자 추가 (#485) * cicd: aws 배포 action 추가 --------- Co-authored-by: Sangwon Yang <[email protected]>
- Loading branch information
1 parent
abc3c9f
commit d53ce07
Showing
20 changed files
with
856 additions
and
255 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,102 @@ | ||
name: Tech-pick Api-Module CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release" # 배포 대상 브랜치 | ||
paths: | ||
- 'backend/techpick-core/**' | ||
- 'backend/techpick-api/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
api-version: 'v2' | ||
|
||
steps: | ||
# 저장소 Checkout | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
# Gradle 실행 권한 부여 | ||
- name: Grant execute permission to gradlew | ||
run: chmod +x ./backend/gradlew | ||
|
||
# JDK 설치 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
# Spring boot application, Docker image 빌드 | ||
- name: Build and Deploy techpick-api Module | ||
run: | | ||
echo "Building and deploying techpick-api..." | ||
./backend/gradlew -p backend/techpick-api clean build -x test | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-api-${{ github.sha }} backend/techpick-api | ||
- # Docker hub 로그인 | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- # Docker hub 업로드 | ||
name: Publish to docker hub | ||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-api-${{ github.sha }} | ||
|
||
- name: Deploy on AWS | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.AWS_API_SERVER_IP }} | ||
port: 22 | ||
username: ${{ secrets.AWS_USERNAME }} | ||
key: ${{ secrets.AWS_ACCESS_KEY }} | ||
script: | | ||
echo "Login to Docker Hub for private repository access on bastion..." | ||
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | ||
echo "Pulling Docker image on bastion..." | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-api-${{ github.sha }} | ||
echo "Tagging Docker image..." | ||
docker tag minkyeki/techpick:${{ env.api-version }}-api-${{ github.sha }} techpick:${{ env.api-version }}-api-staging | ||
cd /home/ubuntu | ||
rm -rf .env | ||
touch .env | ||
echo "DOCKER_MYSQL_USERNAME=${{ secrets.DOCKER_MYSQL_USERNAME }}" >> .env | ||
echo "DOCKER_MYSQL_PASSWORD=${{ secrets.DOCKER_MYSQL_PASSWORD }}" >> .env | ||
echo "DOCKER_MYSQL_DATABASE=${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}" >> .env | ||
echo "DOCKER_MYSQL_URL=jdbc:mysql://techpick-mysql:3306/${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}?createDatabaseIfNotExist=true" >> .env | ||
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env | ||
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" >> .env | ||
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env | ||
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env | ||
echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env | ||
echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> .env | ||
echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env | ||
echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env | ||
echo "Restarting techpick-api service..." | ||
docker-compose stop techpick-api | ||
docker-compose rm -f techpick-api | ||
docker-compose up -d techpick-api | ||
echo "Cleanup Images..." | ||
docker image prune -af | ||
- name: Discord Webhook Notification | ||
uses: sarisia/[email protected] | ||
if: always() | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
status: ${{ job.status }} | ||
title: "TechPick ${{ env.api-version }} - Api Deployment Result" | ||
description: "AWS 배포가 완료되었습니다." | ||
color: 0xff91a4 | ||
url: "https://github.com/sarisia/actions-status-discord" | ||
username: GitHub Actions |
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,102 @@ | ||
name: Tech-pick Batch-Module CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release" # 배포 대상 브랜치 | ||
paths: | ||
- 'backend/techpick-core/**' | ||
- 'backend/techpick-batch/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
api-version: 'v2' | ||
|
||
steps: | ||
# 저장소 Checkout | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
# Gradle 실행 권한 부여 | ||
- name: Grant execute permission to gradlew | ||
run: chmod +x ./backend/gradlew | ||
|
||
# JDK 설치 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
# Spring boot application, Docker image 빌드 | ||
- name: Build and Deploy techpick-batch Module | ||
run: | | ||
echo "Building and deploying techpick-batch..." | ||
./backend/gradlew -p backend/techpick-batch clean build -x test | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-batch-${{ github.sha }} backend/techpick-batch | ||
- # Docker hub 로그인 | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- # Docker hub 업로드 | ||
name: Publish to docker hub | ||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-batch-${{ github.sha }} | ||
|
||
- name: Deploy on AWS | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.AWS_API_SERVER_IP }} | ||
port: 22 | ||
username: ${{ secrets.AWS_USERNAME }} | ||
key: ${{ secrets.AWS_ACCESS_KEY }} | ||
script: | | ||
echo "Login to Docker Hub for private repository access on bastion..." | ||
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | ||
echo "Pulling Docker image on bastion..." | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/techpick:${{ env.api-version }}-batch-${{ github.sha }} | ||
echo "Tagging Docker image..." | ||
docker tag minkyeki/techpick:${{ env.api-version }}-batch-${{ github.sha }} techpick:${{ env.api-version }}-batch-staging | ||
cd /home/ubuntu | ||
rm -rf .env | ||
touch .env | ||
echo "DOCKER_MYSQL_USERNAME=${{ secrets.DOCKER_MYSQL_USERNAME }}" >> .env | ||
echo "DOCKER_MYSQL_PASSWORD=${{ secrets.DOCKER_MYSQL_PASSWORD }}" >> .env | ||
echo "DOCKER_MYSQL_DATABASE=${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}" >> .env | ||
echo "DOCKER_MYSQL_URL=jdbc:mysql://techpick-mysql:3306/${{ secrets.DOCKER_MYSQL_DATABASE }}_${{ env.api-version }}?createDatabaseIfNotExist=true" >> .env | ||
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env | ||
echo "JWT_ISSUER=${{ secrets.JWT_ISSUER }}" >> .env | ||
echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env | ||
echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env | ||
echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env | ||
echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> .env | ||
echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env | ||
echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env | ||
echo "Restarting techpick-batch service..." | ||
docker-compose stop techpick-batch | ||
docker-compose rm -f techpick-batch | ||
docker-compose up -d techpick-batch | ||
echo "Cleanup Images..." | ||
docker image prune -af | ||
- name: Discord Webhook Notification | ||
uses: sarisia/[email protected] | ||
if: always() | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||
status: ${{ job.status }} | ||
title: "TechPick ${{ env.api-version }} - Batch Deployment Result" | ||
description: "AWS 배포가 완료되었습니다." | ||
color: 0xff91a4 | ||
url: "https://github.com/sarisia/actions-status-discord" | ||
username: GitHub Actions |
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
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
Oops, something went wrong.