Skip to content

Commit

Permalink
Merge pull request #460 from Kernel360/develop
Browse files Browse the repository at this point in the history
prod 서버 배포
  • Loading branch information
minson96 authored Mar 8, 2024
2 parents 55faa52 + 8a0a70e commit bbd76d1
Show file tree
Hide file tree
Showing 933 changed files with 60,906 additions and 9,974 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/이길어때-버그-리포트🐞.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: "이길어때 버그 리포트\U0001F41E"
about: 버그 제보를 통해 서비스를 개선해주세요.
title: "[BUG]"
labels: "\U0001F41EBUG"
assignees: minson96

---

📜 버그 제보
버그에 대한 간단한 설명을 제공해주세요.

👟 발생 경위
1. 버그가 발생하게 된 경위를 설명해주세요
2. 스크린샷 등 추가적인 정보가 있으면 더 빠르게 대응할 수 있어요

👍 예상 동작
해당 경위를 통해 기대했던 예상 동작에 대해서 설명해주세요

👎 실제 동작
버그와 함께 동작한 실제 화면을 설명해주세요. (스크린샷이 첨부되면 더 좋아요)

🖥️ 사용 기기
버그가 발생된 환경의 기기를 간단히 설명해주세요. (예: 아이폰 14, 맥북 m1에어, 갤럭시북...)

🛜 브라우저 환경
서비스에 접속한 브라우저 환경에 대해 설명해주세요. (예: 크롬, 사파리, 파이어폭스...)

📋 추가정보
서비스 개선을 위해 전달해주실 추가적인 정보가 있다면 제공해주세요!

👀 비슷한 버그가 이미 발견되어 이슈화되었는지 확인하셨나요?
- [ ] 네 비슷한 버그가 아직 보고되지 않은 것을 확인했습니다.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 이길어때 이슈 템플릿⭐️
about: 이길어때 개발 시 진행사항 공유를 위한 이슈 템플릿
title: ''
labels: ''
assignees: ''
assignees: stoneHee99, minson96

---

Expand Down
2 changes: 0 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
## Motivation 🧐

-

<br>

## Key Changes 🔑
Expand Down
78 changes: 0 additions & 78 deletions .github/workflows/cd.yml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/ci.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/cr.yml

This file was deleted.

140 changes: 140 additions & 0 deletions .github/workflows/dev-backend-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# 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: Java CD with Gradle
on:
pull_request:
types: ["closed"]
branches: [ "develop" ]
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: ./backend
jobs:
build:
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged == true &&
contains(join(github.event.pull_request.labels.*.name, ','), '🛜Backend')
steps:

# jdk setting
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
# application secrets 값 주입
- name: Set application.yml
run: |
sed -i "s|@MASTER_DB_URL@|${{ secrets.MASTER_DB_URL }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@MASTER_DB_USERNAME@|${{ secrets.MASTER_DB_USERNAME }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@MASTER_DB_PASSWORD@|${{ secrets.MASTER_DB_PASSWORD }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_URL@|${{ secrets.SLAVE_DB_URL }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_USERNAME@|${{ secrets.SLAVE_DB_USERNAME }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_PASSWORD@|${{ secrets.SLAVE_DB_PASSWORD }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@REDIS_HOST@|${{ secrets.REDIS_HOST }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@REDIS_PORT@|${{ secrets.REDIS_PORT }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@S3_BUCKET@|${{ secrets.S3_BUCKET }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@AWS_ACCESS_KEY@|${{ secrets.AWS_ACCESS_KEY }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@AWS_SECRET_KEY@|${{ secrets.AWS_SECRET_KEY }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@SLACK_WEBHOOK_URI@|${{ secrets.SLACK_WEBHOOK_URI }}|g" ./yigil-api/src/main/resources/application.yml
sed -i "s|@YIGIL_API_PORT@|${{ secrets.YIGIL_API_PORT }}|g" ./yigil-api/src/main/resources/application.yml
- name: Set admin application.yml
run: |
sed -i "s|@MASTER_DB_URL@|${{ secrets.MASTER_DB_URL }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MASTER_DB_USERNAME@|${{ secrets.MASTER_DB_USERNAME }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MASTER_DB_PASSWORD@|${{ secrets.MASTER_DB_PASSWORD }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_URL@|${{ secrets.SLAVE_DB_URL }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_USERNAME@|${{ secrets.SLAVE_DB_USERNAME }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@SLAVE_DB_PASSWORD@|${{ secrets.SLAVE_DB_PASSWORD }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@REDIS_HOST@|${{ secrets.REDIS_HOST }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@REDIS_PORT@|${{ secrets.REDIS_PORT }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@S3_BUCKET@|${{ secrets.S3_BUCKET }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@AWS_ACCESS_KEY@|${{ secrets.AWS_ACCESS_KEY }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@AWS_SECRET_KEY@|${{ secrets.AWS_SECRET_KEY }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@SLACK_WEBHOOK_URI@|${{ secrets.SLACK_WEBHOOK_URI }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@YIGIL_ADMIN_PORT@|${{ secrets.YIGIL_ADMIN_PORT }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@JWT_SECRET@|${{ secrets.JWT_SECRET }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MAIL_HOST@|${{ secrets.MAIL_HOST }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MAIL_PORT@|${{ secrets.MAIL_PORT }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MAIL_USERNAME@|${{ secrets.MAIL_USERNAME }}|g" ./yigil-admin/src/main/resources/application.yml
sed -i "s|@MAIL_PASSWORD@|${{ secrets.MAIL_PASSWORD }}|g" ./yigil-admin/src/main/resources/application.yml
- name: Set admin application.yml
run: |
sed -i "s|@MASTER_DB_URL@|${{ secrets.MASTER_DB_URL }}|g" ./place-region-batch/src/main/resources/application.yml
sed -i "s|@MASTER_DB_USERNAME@|${{ secrets.MASTER_DB_USERNAME }}|g" ./place-region-batch/src/main/resources/application.yml
sed -i "s|@MASTER_DB_PASSWORD@|${{ secrets.MASTER_DB_PASSWORD }}|g" ./place-region-batch/src/main/resources/application.yml
sed -i "s|@SLACK_WEBHOOK_URI@|${{ secrets.SLACK_WEBHOOK_URI }}|g" ./place-region-batch/src/main/resources/application.yml
sed -i "s|@PLACE_REGION_BATCH_PORT@|${{ secrets.PLACE_REGION_BATCH_PORT }}|g" ./place-region-batch/src/main/resources/application.yml
# Dockerfile secrets 값 주입
- name: Set Dockerfile
run: |
sed -i "s|@YIGIL_API_PORT@|${{ secrets.YIGIL_API_PORT }}|g" ./yigil-api/Dockerfile
sed -i "s|@YIGIL_ADMIN_PORT@|${{ secrets.YIGIL_ADMIN_PORT }}|g" ./yigil-admin/Dockerfile
# Gradle Build를 위한 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Gradle Build (test 제외)
- name: Build with Gradle
run: ./gradlew clean build
# AWS 로그인
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ap-northeast-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
# Docker 이미지 빌드
- name: Docker image build
run : |
cd yigil-api
docker build -t ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_API_BACK }} . --platform=linux/amd64
- name: Docker image build
run : |
cd yigil-admin
docker build -t ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_ADMIN_BACK }} . --platform=linux/amd64
- name: Docker image build
run : |
cd support
docker build -t ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_SUPPORT }} . --platform=linux/amd64
- name: Docker image build
run : |
cd place-region-batch
docker build -t ${{ secrets.AWS_ECR }}/${{ secrets.PLACE_REGION_BATCH }} . --platform=linux/amd64
- name: Docker image push
run : |
cd yigil-api
docker push ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_API_BACK }}
- name: Docker image push
run : |
cd yigil-admin
docker push ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_ADMIN_BACK }}
- name: Docker image push
run : |
cd support
docker push ${{ secrets.AWS_ECR }}/${{ secrets.YIGIL_SUPPORT }}
- name: Docker image push
run : |
cd place-region-batch
docker push ${{ secrets.AWS_ECR }}/${{ secrets.PLACE_REGION_BATCH }}
# EC2 인스턴스 접속 및 애플리케이션 실행
- name: Application Run
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}

script: |
sh ./gitaction.sh
Loading

0 comments on commit bbd76d1

Please sign in to comment.