Skip to content

Commit

Permalink
Merge pull request #147 from Team-Umbba/develop
Browse files Browse the repository at this point in the history
[DEPLOY] 운영서버 v1.0.1 배포
  • Loading branch information
ddongseop authored Apr 20, 2024
2 parents f57987a + 644d423 commit fdf7b97
Show file tree
Hide file tree
Showing 164 changed files with 9,355 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- -
❗️ 이슈 제목은 아래의 형식을 맞춰주세요
- [FEAT] : 기능 추가
- [FIX] : 에러 수정, 버그 수정
- [CHORE] : gradle 세팅, 위의 것 이외에 거의 모든 것
- [DOCS] : README, 문서
- [REFACTOR] : 코드 리펙토링 (기능 변경 없이 코드만 수정할 때)
- [MODIFY] : 코드 수정 (기능의 변화가 있을 때)
-->

## ✨ 이슈 내용

-

## ✅ 체크리스트

- [ ] Assignees / Labels / Milestone 선택
- [ ]
- [ ]
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- -
❗️ PR 제목은 아래의 형식을 맞춰주세요
- [FEAT] : 기능 추가
- [FIX] : 에러 수정, 버그 수정
- [CHORE] : gradle 세팅, 위의 것 이외에 거의 모든 것
- [DOCS] : README, 문서
- [REFACTOR] : 코드 리펙토링 (기능 변경 없이 코드만 수정할 때)
- [MODIFY] : 코드 수정 (기능의 변화가 있을 때)
-->

## 📌 관련 이슈
<!-- 관련있는 이슈 번호(#000)을 적어주세요.
해당 pull request merge와 함께 이슈를 닫으려면
closed #Issue_number를 적어주세요 -->

## ✨ 어떤 이유로 변경된 내용인지
<!-- 어떤 기능을 만들기 위한 내용인지 적어주세요 -->
<!-- 그게 아닌 경우에는 어떤 문제를 해결하기 위한 것인지 적어주세요 -->

## 🙏 검토 혹은 리뷰어에게 남기고 싶은 말
105 changes: 105 additions & 0 deletions .github/workflows/api-CD-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# 워크플로우의 이름 지정
name: Umbba API Server CD (Develop)

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

env:
S3_BUCKET_NAME: umbba-develop-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@v2
with:
aws-access-key-id: ${{ secrets.AWS_DEVELOP_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_DEVELOP_SECRET_KEY }}
aws-region: ap-northeast-2

# 3) AWS Secrets Manger 환경변수 사용
- name: Read secrets from AWS Secrets Manager into environment variables
uses: abhilash1in/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVELOP_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_DEVELOP_SECRET_KEY }}
aws-region: ap-northeast-2
secrets: /secret/umbba-secret
parse-json: false

# 4) FCM secret key 파일 생성
- name: FCM secret key 파일 생성
run: |
cd ./umbba-api/src/main/resources
mkdir ./firebase
cd ./firebase
aws s3 cp --region ap-northeast-2 s3://${{ secrets.S3_DEVELOP_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-api:bootJar -x test

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

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

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

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

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

# Deploy
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_DEVELOP_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_DEVELOP_SECRET_KEY }}
run:
aws deploy create-deployment
--application-name umbba-develop-server-codedeploy
--deployment-group-name umbba-api-server-codedeploy-group
--file-exists-behavior OVERWRITE
--s3-location bucket=umbba-develop-storage,bundleType=zip,key=umbba-api.zip
--region ap-northeast-2
105 changes: 105 additions & 0 deletions .github/workflows/api-CD-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# 워크플로우의 이름 지정
name: Umbba API Server CD (Production)

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

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@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2

# 3) AWS Secrets Manger 환경변수 사용
- name: Read secrets from AWS Secrets Manager into environment variables
uses: abhilash1in/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2
secrets: /secret/umbba-secret
parse-json: false

# 4) FCM secret key 파일 생성
- name: FCM secret key 파일 생성
run: |
cd ./umbba-api/src/main/resources
mkdir ./firebase
cd ./firebase
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-api:bootJar -x test

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

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

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

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

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./umbba-api.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-api-server-codedeploy-group
--file-exists-behavior OVERWRITE
--s3-location bucket=umbba-storage,bundleType=zip,key=umbba-api.zip
--region ap-northeast-2
55 changes: 55 additions & 0 deletions .github/workflows/api-CI-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Umbba API Server CI (Develop)

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

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) AWS Secrets Manger 환경변수 사용
- name: Read secrets from AWS Secrets Manager into environment variables
uses: abhilash1in/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_DEVELOP_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_DEVELOP_SECRET_KEY }}
aws-region: ap-northeast-2
secrets: /secret/umbba-secret
parse-json: false

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

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew umbba-api:bootJar -x test
55 changes: 55 additions & 0 deletions .github/workflows/api-CI-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Umbba API Server CI (Production)

on:
push:
branches: [ "main" ]
paths:
- umbba-api/**
- umbba-domain/**
- umbba-common/**
- umbba-external/**
pull_request:
branches: [ "main" ]
paths:
- umbba-api/**
- 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) AWS Secrets Manger 환경변수 사용
- name: Read secrets from AWS Secrets Manager into environment variables
uses: abhilash1in/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2
secrets: /secret/umbba-secret
parse-json: false

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

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

0 comments on commit fdf7b97

Please sign in to comment.