%주의% 하이폰(-)이 붙은 부분은 깃허브에 올라가면 안된다!

이 파일들은 WAS의 /home/ubuntu/deploy 폴더에 작성해 둔다.

(application-db.yml, application-jwt.yml)

application.yml 파일을 아래와 같이 수정한다.

application.yml

gradle springboot 2.4이상일 때의 설정 방식이다.

spring:
  profiles:
    group:
      prod:
        - db
        - jwt
        - client-secret
      local:
        - jwt
        - client-secret

  jpa:
    properties:
      hibernate.default_batch_fetch_size: 500
  h2:
    console:
      enabled: false

  flyway:
    enabled: false

server:
  shutdown: graceful

security:
  jwt:
    token:
      secret-key: cvi_secret_key
      expire-length: 3600000
  auth:
    naver:
      client-secret: client-secret
  public:
    data:
      vaccination: {secret-value 입력}
---
spring:
  config:
    activate:
      on-profile: local,test
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;
    username: sa
    password:

  h2:
    console:
      enabled: true
  jpa:
    hibernate:
      ddl-auto: create-drop
    properties:
      hibernate:
        format_sql: true
    generate-ddl: true

logging:
  level:
    org.hibernate.SQL: debug
    org.hibernate.type: trace
---
spring:
  config:
    activate:
      on-profile: deploy1

server:
  port: 8081
---
spring:
  config:
    activate:
      on-profile: deploy2

server:
  port: 8082

WAS에 두어야 할 설정 파일들

WAS 에 있는 application-prod.yml 파일을 삭제한다.

application-db.yml 파일을 새로 생성하고, 아래와 같이 작성한다.

application-db.yml

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://192.168.1.121:3306/cvi?serverTimezone=Asia/Seoul&useUnicode=yes&characterEncoding=UTF-8
    username: {username 입력}
    password: {password 입력}