Skip to content

Commit

Permalink
Merge branch 'main' into #10-auth-service
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwoo7 authored Jul 31, 2024
2 parents 59c38f9 + fabef52 commit bee4686
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature Template
about: 기능 추가 이슈 템플릿
title: ''
title: '[feat] '
labels: ''
assignees: ''

Expand Down
9 changes: 4 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
## #️⃣ 연관된 이슈
#이슈번호

- [ ] #


## 📝 작업 내용
이번 PR에서 작업한 내용을 간략히 설명해주세요
- [ ]

### 스크린샷 (선택)

### 스크린샷 (선택)


## 💬 리뷰 요구사항(선택)
리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?
>
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: Docker Build and Push
on:
push:
branches:
- '#4-setting'
paths:
- '/' # 트리거 설정
- 'main'

jobs:
build-and-push:
Expand All @@ -30,9 +28,7 @@ jobs:
run: ./gradlew build
working-directory: ./
env: # application.yml 에 들어갈 값
DB_IP: ${{ secrets.GLOBAL_DB_IP }}
DB_SCHEMA: ${{ secrets.GLOBAL_DB_SCHEMA }}
DB_SETTINGS: ${{ secrets.GLOBAL_DB_SETTINGS }}
DB_URL: ${{ secrets.GLOBAL_DB_URL }}
DB_USERNAME: ${{ secrets.GLOBAL_DB_USERNAME }}
DB_PASSWORD: ${{ secrets.GLOBAL_DB_PASSWORD }}
# JWT_SECRETKEY : ${{secrets.JWT_SECRETKEY}}
Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-websocket'

// flyway
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'
// // flyway
// implementation 'org.flywaydb:flyway-core'
// implementation 'org.flywaydb:flyway-mysql'

// swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
Expand Down
21 changes: 21 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# 스크립트 실행 시 발생할 수 있는 오류에 대해 즉시 스크립트를 중단
set -e

# 전체 컨테이너 재시작
############################################
echo "<< 전체 컨테이너 삭제 >>"
sudo docker compose down

echo "<< 전체 이미지 삭제 >>"
sudo docker rmi -f $(sudo docker images -q)

echo "<< spring app 빌드 >>"
sudo chmod +x gradlew
sudo ./gradlew build

echo "<< 전체 재배포 >>"
sudo docker compose up -d

echo "<< 배포 성공 !! >>"
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
spring-service:
env_file:
Expand Down
17 changes: 12 additions & 5 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
server:
port: 8080
address: 0.0.0.0

spring:
application:
name: backend

datasource:
url: ${DB_IP}+${DB_SCHEMA}+${DB_SETTINGS}
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
hibernate:
ddl-auto: create
ddl-auto: create # entity 기반 스키마 생성

properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
format_sql: true
open-in-view: false
defer-datasource-initialization: true # ddl-auto 실행 후 data.sql 로 데이터 삽입

flyway:
enabled: true
baseline-on-migrate: true
sql: #data.sql 의 DDL 실행
init:
mode: always
3 changes: 3 additions & 0 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
insert into user (login_id, password, sex, birth_date, email, phone, reg_date)
values ('user1', 'useruser1!', '1', '1990-01-01', '[email protected]', '010-1111-1111', '2024-06-10'),
('user2', 'useruser2!', '2', '2000-03-16', '[email protected]', '010-2222-2222', '2024-07-22');

0 comments on commit bee4686

Please sign in to comment.