Skip to content

Commit

Permalink
add: cd 파이프라인 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wonlog-g committed Jul 7, 2024
1 parent 2e44ef2 commit de9aae5
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .ebextensions/healthcheck.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
option_settings:
aws:elasticbeanstalk:application:
Application Healthcheck URL: "/health"
56 changes: 56 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CD
on:
push:
branches:
- release/**

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: 소스 코드 다운로드
uses: actions/checkout@v3

- name: JDK 다운로드
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21

- name: 빌드 캐싱
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: 현재 시간 가져오기
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"

- name: 빌드
run: chmod +x gradlew && ./gradlew bootJar

- name: 배포 압축 파일 생성
run: |
sed -i 's/{JASYPT_SECRET}/${{ secrets.JASYPT_ENCRYPTOR_PASSWORD }}/' ./deploy/Procfile
cp ./api/build/libs/api-1.0.0.jar ./deploy/application.jar
cd deploy && zip -r deploy.zip .
- name: 배포
uses: einaregilsson/beanstalk-deploy@v22
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
application_name: dojo-backend-eb-app
environment_name: dojo-backend-eb-env
version_label: dojo-${{ vars.GITHUB_SHA }}-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: ./deploy/deploy.zip
wait_for_deployment: true
14 changes: 14 additions & 0 deletions api/src/main/kotlin/com/mashup/dojo/HealthController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mashup.dojo

import io.swagger.v3.oas.annotations.Hidden
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class HealthController {
@Hidden
@GetMapping("/health")
fun health(): String {
return "OK"
}
}
1 change: 1 addition & 0 deletions deploy/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=prod -Dserver.port=5000 -DJASYPT_ENCRYPTOR_PASSWORD={JASYPT_SECRET} ./application.jar

0 comments on commit de9aae5

Please sign in to comment.