-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
472d8d8
commit 0295f93
Showing
7 changed files
with
285 additions
and
11 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,70 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_and_deploy: | ||
name: Deploy CD | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 레포지토리를 가져온다 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 자바 17을 설치한다 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Gradle 명령 실행을 위해 권한을 부여한다 | ||
run: chmod +x gradlew | ||
|
||
- name: Gradle 로 build 를 수행한다 | ||
run: ./gradlew clean build | ||
|
||
- name: Docker Hub 로그인 | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: 환경변수 파일 생성 | ||
run: echo "${{ secrets.APPLICATION_ENV }}" > ./.env | ||
|
||
- name: 환경변수 파일을 서버로 전송한다 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
port: ${{ secrets.PORT }} | ||
source: "./.env" | ||
target: "./" | ||
|
||
|
||
- name: Docker image build | ||
run: docker build -t ${{ secrets.DOCKER_NAME }}/devops_study:latest . | ||
|
||
- name: docker Hub 푸쉬 | ||
run: docker push ${{ secrets.DOCKER_NAME }}/devops_study:latest | ||
|
||
- name: Deploy with push | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
key: ${{ secrets.PRIVATE_KEY }} | ||
port: ${{ secrets.PORT }} | ||
# 이미 멈춰있어서 발생하는 예외를 방지하기 위해 || true 설정 | ||
script: | | ||
sudo docker stop devops_study || true | ||
sudo docker container prune -f | ||
sudo docker pull ${{ secrets.DOCKER_NAME }}/devops_study:latest | ||
sudo docker run -d --log-driver=syslog --env-file .env \ | ||
-p 8080:9000 --name devops_study \ | ||
${{ secrets.DOCKER_NAME }}/devops_study:latest | ||
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,48 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
test: | ||
name: CI | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: 레포지토리를 가져온다 | ||
uses: actions/checkout@v4 | ||
|
||
- name: 자바 17을 설치한다 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Gradle 명령 실행을 위해 권한을 부여한다 | ||
run: chmod +x gradlew | ||
|
||
- name: Gradle 로 테스트를 실행한다 | ||
run: ./gradlew test | ||
|
||
- name: 테스트 결과를 PR 에 반영한다 | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
files: '**/build/test-results/test/TEST-*.xml' | ||
|
||
# 테스트 코드를 새로 작성하면 재설정 | ||
# - name: Add coverage to PR | ||
# id: jacoco | ||
# if: always() | ||
# uses: madrapps/[email protected] | ||
# with: | ||
# paths: ${{ github.workspace }}/build/jacoco/jacocoTestReports.xml | ||
# token: ${{ secrets.GIT_TOKEN }} | ||
# title: Code Coverage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.addLombokGeneratedAnnotation = true |
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,83 @@ | ||
server: | ||
port: 8080 | ||
|
||
spring: | ||
datasource: | ||
driver-class-name: org.h2.Driver | ||
url: jdbc:h2:mem:test_db;MODE=MySQL; | ||
username: sa | ||
password: | ||
h2: | ||
console: | ||
enabled: true | ||
|
||
jpa: | ||
hibernate: | ||
ddl-auto: create | ||
|
||
properties: | ||
hibernate: | ||
default_batch_fetch_size: 100 | ||
show_sql: true | ||
format_sql: true | ||
|
||
open-in-view: false | ||
|
||
mail: | ||
host: smtp.gmail.com | ||
port: 587 | ||
username: ${MAIL} | ||
password: ${MAIL_PW} | ||
protocol: smtp | ||
properties: | ||
mail: | ||
smtp: | ||
starttls: | ||
enable: true | ||
auth: true | ||
|
||
servlet: | ||
multipart: | ||
max-file-size: 10MB | ||
|
||
# 포인트 메일 수신자 # | ||
mail: | ||
point-mail-receiver: ${POINT_MAIL} | ||
|
||
# Flask domain # | ||
flask: | ||
domain: ${FLASK_DOMAIN} | ||
|
||
# 서버 런시 발생하는 에러 로그 방지 | ||
logging: | ||
level: | ||
com: | ||
amazonaws: | ||
util: | ||
EC2MetadataUtils: error | ||
|
||
#p6spy 설정 | ||
decorator: | ||
datasource: | ||
p6spy: | ||
enable-logging: true | ||
|
||
#JWT key | ||
jwt: | ||
secret-key: ${JWT_SECRET_KEY} | ||
access-token-validity: ${ACCESS_TOKEN_VALIDITY} | ||
refresh-token-validity: ${REFRESH_TOKEN_VALIDITY} | ||
|
||
# 네이버 클라우드 오브젝트 스토리지 | ||
cloud: | ||
aws: | ||
credentials: | ||
access-key: ${S3_ACCESS_KEY} | ||
secret-key: ${S3_SECRET_KEY} | ||
stack: | ||
auto: false | ||
region: | ||
static: ap-northeast-2 | ||
s3: | ||
endpoint: https://kr.object.ncloudstorage.com | ||
bucket: ${BUCKET_NAME} |
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 |
---|---|---|
@@ -1,3 +1,79 @@ | ||
spring: | ||
profiles: | ||
default: dev | ||
server: | ||
port: 8080 | ||
|
||
spring: | ||
datasource: | ||
url: jdbc:mysql://localhost:3306/wish_hair_db | ||
username: root | ||
password: 1234! | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
jpa: | ||
hibernate: | ||
ddl-auto: create | ||
|
||
properties: | ||
hibernate: | ||
default_batch_fetch_size: 100 | ||
show_sql: true | ||
format_sql: true | ||
|
||
open-in-view: false | ||
|
||
mail: | ||
host: smtp.gmail.com | ||
port: 587 | ||
username: ${MAIL} # [email protected] | ||
password: ${MAIL_PW} # qkvpxhpgyuywcbgh | ||
protocol: smtp | ||
properties: | ||
mail: | ||
smtp: | ||
starttls: | ||
enable: true | ||
auth: true | ||
|
||
servlet: | ||
multipart: | ||
max-file-size: 10MB | ||
|
||
# 포인트 메일 수신자 # | ||
mail: | ||
point-mail-receiver: ${POINT_MAIL} #[email protected] | ||
|
||
# Flask domain # | ||
flask: | ||
domain: ${FLASK_DOMAIN} | ||
|
||
# 서버 런시 발생하는 에러 로그 방지 | ||
logging: | ||
level: | ||
com: | ||
amazonaws: | ||
util: | ||
EC2MetadataUtils: error | ||
|
||
#p6spy 설정 | ||
decorator: | ||
datasource: | ||
p6spy: | ||
enable-logging: true | ||
|
||
#JWT key | ||
jwt: | ||
secret-key: ${JWT_SECRET_KEY} # wishhairOiJIUzI1NiIvLoAR5cCI6IkpXSCJ9.eyJzdWIiOiIiLCLoCP1lIjoiSm9obiBEV9UiLCJpYXBCusE1MTYyMzkwMjJ9.163aevla8s7d6f987qweahqwculaoxce80k1i2o387tg | ||
access-token-validity: ${ACCESS_TOKEN_VALIDITY} # 1800000 | ||
refresh-token-validity: ${REFRESH_TOKEN_VALIDITY} # 259200000 | ||
|
||
# 네이버 클라우드 오브젝트 스토리지 | ||
cloud: | ||
aws: | ||
credentials: | ||
access-key: ${S3_ACCESS_KEY} # N3JCSJUtgse4alKEaOqX | ||
secret-key: ${S3_SECRET_KEY} #rRamLrfUV8v6ZziJFEN4CVLjE9rl4kCBnEOLje5f | ||
stack: | ||
auto: false | ||
region: | ||
static: ap-northeast-2 | ||
s3: | ||
endpoint: https://kr.object.ncloudstorage.com | ||
bucket: ${BUCKET_NAME} # wswh-storage |