Skip to content

Commit

Permalink
feat: MySQL 도입 및 배포 관련 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
lja3723 committed Nov 11, 2024
1 parent ac9965c commit c3c8c58
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ name: CI/CD Github Action
on:
push:
branches: [ "Master", "Weekly/*" ]
pull_request_target:
branches: [ "Master", "Weekly/*" ]

permissions:
contents: read

env:
DATASOURCE_URL : ${{ secrets.ENV_DATASOURCE_URL }}
DATASOURCE_USERNAME : ${{ secrets.ENV_DATASOURCE_USERNAME }}
DATASOURCE_PASSWORD : ${{ sccrets.ENV_DATASOURCE_PASSWORD }}
GOOGLE_CLIENT_ID : ${{ secrets.ENV_GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.ENV_GOOGLE_CLIENT_SECRET }}
GOOGLE_REDIRECT_URI : ${{ secrets.ENV_GOOGLE_REDIRECT_URI }}
Expand Down Expand Up @@ -137,7 +138,10 @@ jobs:
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" > ~/.env
echo "DATASOURCE_URL=${{ secrets.ENV_DATASOURCE_URL }}" > ~/.env
echo "DATASOURCE_USERNAME=${{ secrets.ENV_DATASOURCE_USERNAME }}" >> ~/.env
echo "DATASOURCE_PASSWORD=${{ sccrets.ENV_DATASOURCE_PASSWORD }}" >> ~/.env
echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" >> ~/.env
echo "GOOGLE_CLIENT_SECRET=${{ secrets.ENV_GOOGLE_CLIENT_SECRET }}" >> ~/.env
echo "GOOGLE_REDIRECT_URI=${{ secrets.ENV_GOOGLE_REDIRECT_URI }}" >> ~/.env
echo "JWT_SECRET=${{ secrets.ENV_JWT_SECRET }}" >> ~/.env
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'com.h2database:h2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.fasterxml.jackson.core:jackson-databind'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ spring:
activate:
on-profile: create
jpa:
show-sql: true
hibernate:
ddl-auto: create
6 changes: 1 addition & 5 deletions src/main/resources/application-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@ spring:
activate:
on-profile: deploy
jpa:
show-sql: false
hibernate:
ddl-auto: create

# log4j log level setting
logging.level.org.ktc2.cokaen.wouldyouin: info
ddl-auto: update
3 changes: 1 addition & 2 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ spring:
activate:
on-profile: dev
jpa:
show-sql: true
hibernate:
ddl-auto: update
ddl-auto: create-drop
17 changes: 8 additions & 9 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spring:
max-file-size: 10MB
max-request-size: 10MB

# 임시 프로젝트 url
profiles:
default: dev

Expand All @@ -22,22 +21,22 @@ spring:
restart:
enabled: false

# h2 database settings
h2:
console:
enabled: true

datasource:
url: jdbc:h2:mem:test
driver-class-name: org.h2.Driver
driver-class-name: com.mysql.cj.jdbc.Driver
# jdbc:mysql://localhost:3306/would_you_in
# jdbc:mysql://would-you-in-db.ctu2qyeiusxz.ap-northeast-2.rds.amazonaws.com:3306/would_you_in
url: ${DATASOURCE_URL}?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}

jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQLDialect
properties:
hibernate:
format_sql: true
default_batch_fetch_size: 100
show-sql: true
hibernate.ddl-auto: create

# log4j log level setting
logging.level.org.ktc2.cokaen.wouldyouin: debug
Expand Down

0 comments on commit c3c8c58

Please sign in to comment.