From 8be6794c15ecc9b37484c77efca9f14bee369789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A7=80=EC=B2=A0?= Date: Thu, 3 Apr 2025 10:57:02 +0900 Subject: [PATCH] =?UTF-8?q?Config=20=EC=84=A4=EC=A0=95=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/application.yml | 39 ++++++++++++ config/attach-service.yml | 95 +++++++++++++++++++++++++++++ config/board-service-test.yml | 46 ++++++++++++++ config/board-service.yml | 43 +++++++++++++ config/cms-service.yml | 88 +++++++++++++++++++++++++++ config/fastreg/cms-service.yml | 101 +++++++++++++++++++++++++++++++ config/user-service-test.yml | 107 +++++++++++++++++++++++++++++++++ config/user-service.yml | 51 ++++++++++++++++ 8 files changed, 570 insertions(+) create mode 100644 config/application.yml create mode 100644 config/attach-service.yml create mode 100644 config/board-service-test.yml create mode 100644 config/board-service.yml create mode 100644 config/cms-service.yml create mode 100644 config/fastreg/cms-service.yml create mode 100644 config/user-service-test.yml create mode 100644 config/user-service.yml diff --git a/config/application.yml b/config/application.yml new file mode 100644 index 0000000..43695a4 --- /dev/null +++ b/config/application.yml @@ -0,0 +1,39 @@ +# 2시간(7,200,000), 1일(86,400,000) jwt token +token: + expiration_time: 7200000 + refresh_time: 86400000 + secret: 'token_secret' +db: + hostname: dev.onasys.co.kr +eureka: + instance: + instance-id: ${spring.application.name}:${spring.application.instance_id:${random.value}} # random port 사용시 eureka server에 인스턴스가 각각 표시되지 않는다 + preferIpAddress: true # 서비스간 통신 시 hostname 보다 ip 를 우선 + client: + register-with-eureka: true # eureka 서버에 등록 + fetch-registry: true # 외부 검색 가능 + service-url: + defaultZone: http://admin:admin@${eureka.instance.hostname:localhost}:8761/eureka + +# file attach location - messages{lang}.properties 도 이 경로에 위치한다. +file: + directory: ${app.home:${user.home}}/msa-attach-volume # url 사용시에는 사용되지 않는다 + url: http://${file.hostname:localhost}:8080 # nginx 로 파일 다운로드 처리 +messages: + directory: ${file.directory}/messages + +apigateway: + host: http://${apigateway.hostname:localhost}:${server.port} + +# rabbitmq server +spring: + rabbitmq: + host: ${rabbitmq.hostname:localhost} + port: 5672 + username: guest + password: guest + zipkin: + base-url: http://${zipkin.hostname:localhost}:${zipkin.port:9411} + +egov: + message: hello diff --git a/config/attach-service.yml b/config/attach-service.yml new file mode 100644 index 0000000..64584c7 --- /dev/null +++ b/config/attach-service.yml @@ -0,0 +1,95 @@ +database: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + +spring: + datasource: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + username: msaportal + password: msaportal + driver-class-name: org.postgresql.Driver + hikari: + minimum-idle: 5 # 너무 많은 유휴 연결 방지 + maximum-pool-size: 20 # DB 부하와 병목 최소화 + idle-timeout: 30000 # 30초 후 유휴 연결 제거 + max-lifetime: 1800000 # 30분 후 커넥션 재생성 + connection-timeout: 5000 # 커넥션 요청 타임아웃 (5초) + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 512 + prepStmtCacheSqlLimit: 4096 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + generate-ddl: true + hibernate: + ddl-auto: update + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + format_sql: true + globally_quoted_identifiers: false + default_batch_fetch_size: 1000 + show-sql: true + defer-datasource-initialization: true + servlet: + multipart: + enabled: true + max-file-size: -1 + max-request-size: -1 + cloud: + bus: + destination: springCloudBus + stream: + function: + definition: attachmentEntity;busConsumer # 첨부파일 entity 정보 업데이트 하기 위한 이벤트에 대한 consumer function & springcloudbus consumer function + bindings: + busConsumer-in-0: + destination: ${spring.cloud.bus.destination} + attachmentEntity-in-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: attachment-entity.topic # queue name + group: attachment + attachmentEntity-out-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: attachment-entity.topic # queue name + group: attachment + sql: + init: + mode: always + platform: postgresql + session: + store-type: redis + redis: + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + username: ${REDIS_USERNAME:} + password: ${REDIS_PASSWORD:egovframe} +app: + file: + storage: + path: ${user.home}/egovframe-msa-edu/files/cms + allowed-extensions: jpg,jpeg,gif,png,pdf,doc,docx,xls,xlsx,ppt,pptx,txt + max-file-size: 104857600 # 100MB + temp-file-retention: 7 +# Swagger 설정 +springdoc: + swagger-ui: + path: /swagger-ui.html + groups-order: DESC + operations-sorter: method + disable-swagger-default-url: true + api-docs: + path: /v3/api-docs + show-actuator: true + default-consumes-media-type: application/json + default-produces-media-type: application/json + paths-to-match: /api/** # Actuator 제외하고 문서화할 경로만 포함 +# tus 분할 파일 업로드 관련 path 설정 +tus: + data: + path: /files/tus/temp + expiration: 60000 + save: + path: /files/upload +ffmpeg: + path: /opt/homebrew/bin/ffmpeg +ffprobe: + path: /opt/homebrew/bin/ffprobe diff --git a/config/board-service-test.yml b/config/board-service-test.yml new file mode 100644 index 0000000..f230e8d --- /dev/null +++ b/config/board-service-test.yml @@ -0,0 +1,46 @@ +spring: + application: + name: board-service + + datasource: + url: jdbc:h2:mem:testdb;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false + username: sa + password: + driver-class-name: org.h2.Driver + jpa: +# database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + hibernate: + generate-ddl: true + ddl-auto: create-drop +# dialect: org.hibernate.dialect.MySQL5InnoDBDialect + properties: + hibernate: + format_sql: true + default_batch_fetch_size: 1000 # 1:N 관계를 해결하기 위해 필요 + show-sql: true + h2: + console: + enabled: true + path: /h2 + + logging.level: + org.hibernate.SQL: debug + +file: + directory: ${user.home}/msa-attach-volume +messages: + directory: ${file.directory}/messages + +# jwt token +token: + secret: egovframe_user_token + +# ftp server +ftp: + enabled: false # ftp 사용 여부, FTP 서버에 최상위 디렉토리 자동 생성 및 구현체를 결정하게 된다. + +# eureka 가 포함되면 eureka server 도 등록되므로 해제한다. +eureka: + client: + register-with-eureka: false + fetch-registry: false diff --git a/config/board-service.yml b/config/board-service.yml new file mode 100644 index 0000000..eb92c03 --- /dev/null +++ b/config/board-service.yml @@ -0,0 +1,43 @@ +database: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + +spring: + datasource: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + username: msaportal + password: msaportal + driver-class-name: org.postgresql.Driver + hikari: + minimum-idle: 5 # 너무 많은 유휴 연결 방지 + maximum-pool-size: 20 # DB 부하와 병목 최소화 + idle-timeout: 30000 # 30초 후 유휴 연결 제거 + max-lifetime: 1800000 # 30분 후 커넥션 재생성 + connection-timeout: 5000 # 커넥션 요청 타임아웃 (5초) + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 512 + prepStmtCacheSqlLimit: 4096 + useServerPrepStmts: true + cloud: + stream: + bindings: + attachmentEntity-out-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: attachment-entity.topic # queue name + group: attachment + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + generate-ddl: true + hibernate: + ddl-auto: none + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + format_sql: true + globally_quoted_identifiers: false + default_batch_fetch_size: 1000 + show-sql: true + defer-datasource-initialization: true + sql: + init: + mode: always + platform: postgresql diff --git a/config/cms-service.yml b/config/cms-service.yml new file mode 100644 index 0000000..34fedf3 --- /dev/null +++ b/config/cms-service.yml @@ -0,0 +1,88 @@ +database: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + +spring: + datasource: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + username: msaportal + password: msaportal + driver-class-name: org.postgresql.Driver + hikari: + minimum-idle: 5 # 너무 많은 유휴 연결 방지 + maximum-pool-size: 20 # DB 부하와 병목 최소화 + idle-timeout: 30000 # 30초 후 유휴 연결 제거 + max-lifetime: 1800000 # 30분 후 커넥션 재생성 + connection-timeout: 5000 # 커넥션 요청 타임아웃 (5초) + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 512 + prepStmtCacheSqlLimit: 4096 + useServerPrepStmts: true + cloud: + stream: + bindings: + attachmentEntity-out-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: attachment-entity.topic # queue name + group: attachment + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + generate-ddl: true + hibernate: + ddl-auto: none + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + format_sql: true + globally_quoted_identifiers: false + default_batch_fetch_size: 1000 + show-sql: true + defer-datasource-initialization: true + servlet: + multipart: + enabled: true + max-file-size: -1 + max-request-size: -1 + sql: + init: + mode: always + platform: postgresql + +app: + file: + storage: + path: ${user.home}/egovframe-msa-edu/files/cms + allowed-extensions: jpg,jpeg,gif,png,pdf,doc,docx,xls,xlsx,ppt,pptx,txt + max-file-size: 104857600 # 100MB + temp-file-retention: 7 + +info: + app: + name: CMS Service + description: 컨텐츠 관리 기능을 제공 + java: + version: ${java.version} + spring: + framework: + version: ${spring-framework.version} + boot: + version: ${spring-boot.version} + +# Swagger 설정 +springdoc: + swagger-ui: + path: /swagger-ui.html + groups-order: DESC + operations-sorter: method + disable-swagger-default-url: true + api-docs: + path: /v3/api-docs + show-actuator: true + default-consumes-media-type: application/json + default-produces-media-type: application/json + paths-to-match: /api/** # Actuator 제외하고 문서화할 경로만 포함 +logging: + level: + root: INFO + org.egovframe: DEBUG + org.hibernate.SQL: DEBUG + org.hibernate.type.descriptor.sql.BasicBinder: TRACE diff --git a/config/fastreg/cms-service.yml b/config/fastreg/cms-service.yml new file mode 100644 index 0000000..b30c147 --- /dev/null +++ b/config/fastreg/cms-service.yml @@ -0,0 +1,101 @@ +eureka: # Eureka Server 정보로 실제 서비스 시점에는 이부분은 지워야 한다. + instance: + lease-renewal-interval-in-seconds: 5 # 서비스 갱신 주기 (기본 30초) + lease-expiration-duration-in-seconds: 10 # 서비스 종료 판단 시간 (기본 90초) + metadata-map: + startup: ${random.int} # 인스턴스 ID가 고유하도록 보장 + client: + registry-fetch-interval-seconds: 5 # 레지스트리 정보 갱신 주기 (기본 30초) + +spring: + datasource: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + username: msaportal + password: msaportal + driver-class-name: org.postgresql.Driver + hikari: + minimum-idle: 5 # 너무 많은 유휴 연결 방지 + maximum-pool-size: 20 # DB 부하와 병목 최소화 + idle-timeout: 30000 # 30초 후 유휴 연결 제거 + max-lifetime: 1800000 # 30분 후 커넥션 재생성 + connection-timeout: 5000 # 커넥션 요청 타임아웃 (5초) + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 512 + prepStmtCacheSqlLimit: 4096 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + generate-ddl: true + hibernate: + ddl-auto: none + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + format_sql: true + globally_quoted_identifiers: false + default_batch_fetch_size: 1000 + show-sql: true + defer-datasource-initialization: true + servlet: + multipart: + enabled: true + max-file-size: -1 + max-request-size: -1 + cloud: + stream: + function: + definition: atflMngEntity;busConsumer # 첨부파일 entity 정보 업데이트 하기 위한 이벤트에 대한 consumer function & springcloudbus consumer function + bindings: + busConsumer-in-0: + destination: ${spring.cloud.bus.destination} + atflMngEntity-in-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: atfl-mng-entity.topic # queue name + group: atfl-mng + atflMngEntity-out-0: # 첨부파일 entity 정보 업데이트 하기 위한 이벤트 + destination: atfl-mng-entity.topic # queue name + group: atfl-mng + sql: + init: + mode: always + platform: postgresql + +app: + file: + storage: + path: ${user.home}/egovframe-msa-edu/files/cms + allowed-extensions: jpg,jpeg,gif,png,pdf,doc,docx,xls,xlsx,ppt,pptx,txt + max-file-size: 104857600 # 100MB + temp-file-retention: 7 + +info: + app: + name: CMS Service + description: 컨텐츠 관리 기능을 제공 + java: + version: ${java.version} + spring: + framework: + version: ${spring-framework.version} + boot: + version: ${spring-boot.version} + +# Swagger 설정 +springdoc: + swagger-ui: + path: /swagger-ui.html + groups-order: DESC + operations-sorter: method + disable-swagger-default-url: true + api-docs: + path: /v3/api-docs + show-actuator: true + default-consumes-media-type: application/json + default-produces-media-type: application/json + paths-to-match: /api/** # Actuator 제외하고 문서화할 경로만 포함 +logging: + level: + root: INFO + org.egovframe: DEBUG + org.hibernate.SQL: DEBUG + org.hibernate.type.descriptor.sql.BasicBinder: TRACE diff --git a/config/user-service-test.yml b/config/user-service-test.yml new file mode 100644 index 0000000..6a8ad80 --- /dev/null +++ b/config/user-service-test.yml @@ -0,0 +1,107 @@ +spring: + application: + name: user-service + + datasource: + url: jdbc:h2:mem:testdb;MODE=MYSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false + username: sa + password: + driver-class-name: org.h2.Driver + initialization-mode: always +# schema: classpath:h2/schema.sql + data: classpath:h2/data.sql + jpa: + hibernate: + generate-ddl: true + ddl-auto: create-drop + dialect: org.hibernate.dialect.MySQL5Dialect + properties: + hibernate: + format_sql: true + default_batch_fetch_size: 1000 # 1:N 관계를 해결하기 위해 필요 + show-sql: true + h2: + console: + enabled: true + path: /h2 + cache: + jcache: + config: classpath:ehcache.xml + mail: # 비밀번호 변경 이메일 발송 + host: smtp.gmail.com # smtp host + port: 587 # smtp port + username: email_username # 계정 + password: 'email_password' # 비밀번호 - 구글 보안 2단계 인증 해제, 보안 수준이 낮은 앱의 액세스 허용(https://myaccount.google.com/lesssecureapps) + properties: + mail: + smtp: + auth: true + starttls: + enable: true + required: true + security: + # oauth2 를 사용하려면 아래 google, naver, kakao 의 client-id, client-secret 을 발급받아야 한다. + oauth2: + client: + registration: + # /oauth2/authorization/google + google: + client-id: google_client_id # TODO + client-secret: google_client_secret # TODO + scope: profile,email + # 네이버는 Spring Security를 공식 지원하지 않기 때문에 CommonOAuth2Provider 에서 해주는 값들을 수동으로 입력한다. + # /oauth2/authorization/naver + naver: + client-id: naver_client_id # TODO + client-secret: naver_client_secret # TODO + redirect_uri: "{baseUrl}/{action}/oauth2/code/{registrationId}" + authorization_grant_type: authorization_code + scope: name,email,profile_image + client-name: Naver + # /oauth2/authorization/kakao + kakao: + client-id: kakao_client_id # TODO + client-secret: kakao_client_secret # TODO + redirect-uri: "{baseUrl}/{action}/oauth2/code/{registrationId}" + client-authentication-method: POST + authorization-grant-type: authorization_code + scope: profile_nickname, account_email + client-name: Kakao + provider: + naver: + authorization_uri: https://nid.naver.com/oauth2.0/authorize + token_uri: https://nid.naver.com/oauth2.0/token + user-info-uri: https://openapi.naver.com/v1/nid/me + # 기준이 되는 user_name 의 이름을 네이버에서는 response로 지정해야한다. (네이버 회원 조회시 반환되는 JSON 형태 때문이다) + # response를 user_name으로 지정하고 이후 자바 코드로 response의 id를 user_name으로 지정한다. (스프링 시큐리티에서 하위 필드를 명시할 수 없기 때문) + user_name_attribute: response + kakao: + authorization_uri: https://kauth.kakao.com/oauth/authorize + token_uri: https://kauth.kakao.com/oauth/token + user-info-uri: https://kapi.kakao.com/v2/user/me + user_name_attribute: id + + logging.level: + org.hibernate.SQL: debug + org.hibernate.type: trace + +file: + directory: ${user.home}/msa-attach-volume +messages: + directory: ${file.directory}/messages + +# jwt token +token: + expiration_time: 7200000 + refresh_time: 86400000 + secret: egovframe_token_secret + +# ftp server +ftp: + enabled: false # ftp 사용 여부, FTP 서버에 최상위 디렉토리 자동 생성 및 구현체를 결정하게 된다. + +# eureka 가 포함되면 eureka server 도 등록되므로 해제한다. +eureka: + client: + register-with-eureka: false + fetch-registry: false diff --git a/config/user-service.yml b/config/user-service.yml new file mode 100644 index 0000000..bc8d322 --- /dev/null +++ b/config/user-service.yml @@ -0,0 +1,51 @@ +database: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + +spring: + datasource: + url: jdbc:postgresql://${db.hostname:localhost}:5432/CS0227 + username: msaportal + password: msaportal + driver-class-name: org.postgresql.Driver + hikari: + minimum-idle: 5 # 너무 많은 유휴 연결 방지 + maximum-pool-size: 20 # DB 부하와 병목 최소화 + idle-timeout: 30000 # 30초 후 유휴 연결 제거 + max-lifetime: 1800000 # 30분 후 커넥션 재생성 + connection-timeout: 5000 # 커넥션 요청 타임아웃 (5초) + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 512 + prepStmtCacheSqlLimit: 4096 + useServerPrepStmts: true + jpa: + database-platform: org.hibernate.dialect.PostgreSQLDialect + open-in-view: false + generate-ddl: true + hibernate: + ddl-auto: none + properties: + hibernate: + format_sql: true + default_batch_fetch_size: 1000 + jdbc: + lob: + non_contextual_creation: true + show-sql: true + defer-datasource-initialization: true + sql: + init: + mode: always + platform: postgresql + mail: # 비밀번호 변경 이메일 발송 + host: smtp.gmail.com # smtp host + port: 587 # smtp port + username: email_username # 계정 + password: 'email_password' # 비밀번호 - 구글 보안 2단계 인증 해제, 보안 수준이 낮은 앱의 액세스 허용(https://myaccount.google.com/lesssecureapps) + properties: + mail: + smtp: + auth: true + starttls: + enable: true + required: true