Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR] 멀티 모듈 및 SQS를 활용한 API 서버와 푸시알림 서버 분리 #92

Merged
merged 37 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4190c57
[REFACTOR] 멀티 모듈 생성 #82
ddongseop Aug 8, 2023
7391292
[REFACTOR] common 모듈 분리 #82
ddongseop Aug 8, 2023
a4ccbbb
[REFACTOR] external 모듈 분리 #82
ddongseop Aug 8, 2023
0357a5e
[REFACTOR] domain 모듈 분리 #82
jun02160 Aug 8, 2023
5ccdc81
Merge pull request #83 from Team-Umbba/refactor/#82-multi_module_comm…
ddongseop Aug 8, 2023
16cce32
[MERGE] 병합 충돌 해결
jun02160 Aug 8, 2023
17814d7
[MERGE] merge conflict solve
jun02160 Aug 8, 2023
c9f8f82
Merge pull request #84 from Team-Umbba/refactor/#82-multi_module_domain
jun02160 Aug 8, 2023
d2e3f87
[REFACTOR] Notification 서버 로직 분리 #82
jun02160 Aug 8, 2023
4daac0d
Merge pull request #85 from Team-Umbba/refactor/#82-multi_module_noti…
jun02160 Aug 8, 2023
a863c51
[REFACTOR] api 모듈 분리 #82
ddongseop Aug 8, 2023
bdd468d
Merge remote-tracking branch 'origin/refactor/#82-multi_module' into …
ddongseop Aug 8, 2023
9d4616f
[MERGE] 병합 충돌 해결
ddongseop Aug 8, 2023
2c1aaf6
Merge pull request #86 from Team-Umbba/refactor/#82-multi_module_api
ddongseop Aug 8, 2023
4fbe1f9
[CHORE] 디렉토리 구조 최적화 #82
jun02160 Aug 8, 2023
5ad7fef
[REFACTOR] import 경로 변경 문제 해결 #82
ddongseop Aug 8, 2023
bc931fa
[FIX] import 에러 해결 #82
jun02160 Aug 8, 2023
7295759
[FIX] 빌드 오류 해결 #82
ddongseop Aug 8, 2023
451908d
Merge remote-tracking branch 'origin/refactor/#82-multi_module' into …
ddongseop Aug 8, 2023
ab1c0bc
[CHORE] 의존성 중복 제거
jun02160 Aug 8, 2023
7a9dba5
[DOCS] 미사용 dependency 제거 #82
ddongseop Aug 8, 2023
55a71af
[FIX] import 에러 해결 #82
jun02160 Aug 8, 2023
e9c78ed
[DOCS] 서버 실행시 발생 오류 해결 #82
ddongseop Aug 8, 2023
0326a29
[MERGE] 병합 충돌 해결
jun02160 Aug 8, 2023
00abc93
[FEAT] SQSConsmer, SQSProducer 추가 #87
jun02160 Aug 10, 2023
b0c0f08
[FEAT] Notification 서비스 API 서버에서 처리 #87
jun02160 Aug 11, 2023
865d05d
[CHORE] 서버 이중화를 위한 CI/CD 코드 수정 #82
ddongseop Aug 12, 2023
f2495ea
[FIX] EntityManager close 추가 #88
ddongseop Aug 12, 2023
60b1ea3
[ADD] develop 브랜치 hotfix 수정사항 반영 #87
jun02160 Aug 12, 2023
fca32ea
[FEAT] SQS 대기열을 통한 푸시알림 기능 #87
jun02160 Aug 12, 2023
a0d1036
[CHORE] 500 에러 핸들링 주석처리 제거
jun02160 Aug 12, 2023
bd75121
[CHORE] 불필요한 파일 제거
jun02160 Aug 12, 2023
95015cf
Merge pull request #91 from Team-Umbba/feat/#87-sqs_push_notification
jun02160 Aug 12, 2023
43dbd94
Merge remote-tracking branch 'origin/develop' into refactor/#82-multi…
ddongseop Aug 12, 2023
fc828fd
[MERGE] 병합 충돌 해결
ddongseop Aug 12, 2023
4c14870
[CHORE] yml 생성 경로 수정 #82
ddongseop Aug 12, 2023
549320d
[CHORE] CI 스크립트 실패 해결 #82
ddongseop Aug 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions .github/workflows/CD.yml → .github/workflows/api-CD.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# 워크플로우의 이름 지정
name: Umbba-Server CD
name: Umbba API Server CD

# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정
on:
push:
branches: [ develop ] # develop branch로 push 될 때 실행됩니다.
branches: [ "develop" ]
paths:
- umbba-api/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**
pull_request:
branches: [ "develop" ]
paths:
- umbba-api/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**

env:
S3_BUCKET_NAME: umbba-storage
Expand Down Expand Up @@ -37,7 +49,7 @@ jobs:
aws-region: ap-northeast-2

# 3) 환경변수 파일 생성
- name: make application.properties 파일 생성
- name: make application.yml 파일 생성
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

폴더링 변경 부탁드려욥

run: |
# application.yml 파일 생성
cd ./src/main/resources
Expand All @@ -51,42 +63,38 @@ jobs:
# 생성된 파일 확인
cat ./application.yml

####################################

# FCM secret key 폴더 생성
mkdir ./firebase
cd ./firebase

aws s3 cp --region ap-northeast-2 s3://${{ secrets.S3_BUCKET_NAME }}/json/umbba-fcm-firebase-adminsdk.json .

cat umbba-fcm-firebase-adminsdk.json


shell: bash

# 이 워크플로우는 gradle build
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew build -x test
run: ./gradlew umbba-api:bootJar -x test

# 디렉토리 생성
- name: Make Directory
run: mkdir -p deploy

# Jar 파일 복사
- name: Copy Jar
run: cp ./build/libs/*.jar ./deploy
run: cp ./umbba-api/build/libs/*.jar ./deploy
# run: cp -r src/main/* ./deploy

# appspec.yml 파일 복사
- name: Copy appspec.yml
run: cp appspec.yml ./deploy

# script files 복사
- name: Copy script
run: cp ./scripts/*.sh ./deploy
# appspec.yml, script files 파일 복사
- name: Copy files
run: cp ./scripts/umbba-api/* ./deploy

- name: Make zip file
run: zip -r ./umbba_server.zip ./deploy
run: zip -r ./umbba-api.zip ./deploy
shell: bash

- name: Configure AWS credentials
Expand All @@ -97,7 +105,7 @@ jobs:
aws-region: ap-northeast-2

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./umbba_server.zip s3://$S3_BUCKET_NAME/
run: aws s3 cp --region ap-northeast-2 ./umbba-api.zip s3://$S3_BUCKET_NAME/

# Deploy
- name: Deploy
Expand All @@ -107,7 +115,7 @@ jobs:
run:
aws deploy create-deployment
--application-name umbba-server-codedeploy
--deployment-group-name umbba-server-codedeploy-group
--deployment-group-name umbba-api-server-codedeploy-group
--file-exists-behavior OVERWRITE
--s3-location bucket=umbba-storage,bundleType=zip,key=umbba_server.zip
--s3-location bucket=umbba-storage,bundleType=zip,key=umbba-api.zip
--region ap-northeast-2
25 changes: 22 additions & 3 deletions .github/workflows/gradle.yml → .github/workflows/api-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,23 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Umbba-Server CI
name: Umbba API Server CI

on:
push:
branches: [ "develop" ]
paths:
- umbba-api/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**
pull_request:
branches: [ "develop" ]
paths:
- umbba-api/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**

permissions:
contents: read
Expand All @@ -41,7 +51,7 @@ jobs:
distribution: 'temurin'

# 3) 환경변수 파일 생성
- name: make application.properties 파일 생성
- name: make application.yml 파일 생성
run: |
## create application.yml
cd ./src/main/resources
Expand All @@ -55,11 +65,20 @@ jobs:

# application.yml 파일 확인
cat ./application.yml

####################################

# FCM secret key 폴더 생성
mkdir ./firebase
cd ./firebase

aws s3 cp --region ap-northeast-2 s3://${{ secrets.S3_BUCKET_NAME }}/json/umbba-fcm-firebase-adminsdk.json .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기도 umbba-api/로 해야할듯요 !!


shell: bash

# 이 워크플로우는 gradle build
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew build -x test
run: ./gradlew umbba-api:bootJar -x test
121 changes: 121 additions & 0 deletions .github/workflows/notification-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# 워크플로우의 이름 지정
name: Umbba Notification Server CD

# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정
on:
push:
branches: [ "develop" ]
paths:
- umbba-notification/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**
pull_request:
branches: [ "develop" ]
paths:
- umbba-notification/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**

env:
S3_BUCKET_NAME: umbba-storage

jobs:
build:
name: Code deployment

# 실행 환경
runs-on: ubuntu-latest

steps:

# 1) 워크플로우 실행 전 기본적으로 체크아웃 필요
- name: checkout
uses: actions/checkout@v3

# 2) JDK 11버전 설치, 다른 JDK 버전을 사용하다면 수정
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2

# 3) 환경변수 파일 생성
- name: make application.yml 파일 생성
run: |
# application.yml 파일 생성
cd ./src/main/resources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기두 ./ -> umbba-notification/

rm application.yaml

touch ./application.yml

# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
echo "${{ secrets.UMBBA_SECRET }}" >> ./application.yml

# 생성된 파일 확인
cat ./application.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 !!


####################################

# FCM secret key 폴더 생성
mkdir ./firebase
cd ./firebase
Comment on lines +62 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도!


aws s3 cp --region ap-northeast-2 s3://${{ secrets.S3_BUCKET_NAME }}/json/umbba-fcm-firebase-adminsdk.json .

shell: bash

# 이 워크플로우는 gradle build
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew umbba-notification:bootJar -x test

# 디렉토리 생성
- name: Make Directory
run: mkdir -p deploy

# Jar 파일 복사
- name: Copy Jar
run: cp ./umbba-notification/build/libs/*.jar ./deploy
# run: cp -r src/main/* ./deploy

# appspec.yml, script files 파일 복사
- name: Copy files
run: cp ./scripts/umbba-notification/* ./deploy

- name: Make zip file
run: zip -r ./umbba-notification.zip ./deploy
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./umbba-notification.zip s3://$S3_BUCKET_NAME/

# Deploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
run:
aws deploy create-deployment
--application-name umbba-server-codedeploy
--deployment-group-name umbba-notification-server-codedeploy-group
--file-exists-behavior OVERWRITE
--s3-location bucket=umbba-storage,bundleType=zip,key=umbba-notification.zip
--region ap-northeast-2
84 changes: 84 additions & 0 deletions .github/workflows/notification-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Umbba Notification Server CI

on:
push:
branches: [ "develop" ]
paths:
- umbba-notification/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**
pull_request:
branches: [ "develop" ]
paths:
- umbba-notification/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:

# 1) 워크플로우 실행 전 기본적으로 체크아웃 필요
- name: checkout
uses: actions/checkout@v3

# 2) JDK 11버전 설치, 다른 JDK 버전을 사용하다면 수정
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

# 3) 환경변수 파일 생성
- name: make application.yml 파일 생성
run: |
## create application.yml
cd ./src/main/resources
rm application.yaml

# application.yml 파일 생성
touch ./application.yml

# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
echo "${{ secrets.UMBBA_SECRET }}" >> ./application.yml

# application.yml 파일 확인
cat ./application.yml

####################################

# FCM secret key 폴더 생성
mkdir ./firebase
cd ./firebase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 폴더링 변경 부탁드려요 ~~


aws s3 cp --region ap-northeast-2 s3://${{ secrets.S3_BUCKET_NAME }}/json/umbba-fcm-firebase-adminsdk.json .

shell: bash

# 이 워크플로우는 gradle build
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew umbba-notification:bootJar -x test
Loading