Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }}
submodules: true

# --- Java, Gradle 설정 ---
- name: Set up JDK 17
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jobs:
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
token: ${{ secrets.SUBMODULE_ACCESS_TOKEN }}
submodules: true

# --- Java, Gradle 설정 ---
- name: Set up JDK 17
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dependencies {
// Etc
implementation platform('software.amazon.awssdk:bom:2.41.4')
implementation 'software.amazon.awssdk:s3'
implementation 'io.awspring.cloud:spring-cloud-aws-starter-parameter-store:3.0.4'
implementation 'org.hibernate.validator:hibernate-validator'
implementation 'org.springframework.boot:spring-boot-starter-websocket'

Expand Down
1 change: 1 addition & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
network_mode: "host"
environment:
- SPRING_PROFILES_ACTIVE=dev
- AWS_REGION=ap-northeast-2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker compose에 리전을 추가하셨는데, EC2의 리전을 추론하도록 하면 어떤 차이가 있을까요 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

명시 안했을 때 이점이 인프라 리전 변경했을 때 자동추론 밖에 없는데 그냥 명시하는 게 안정적일 것 같아 명시했습니다!

- SPRING_DATA_REDIS_HOST=127.0.0.1
- SPRING_DATA_REDIS_PORT=6379
volumes:
Expand Down
1 change: 1 addition & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
network_mode: "host"
environment:
- SPRING_PROFILES_ACTIVE=prod
- AWS_REGION=ap-northeast-2
- SPRING_DATA_REDIS_HOST=127.0.0.1
- SPRING_DATA_REDIS_PORT=6379
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,21 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;

@Configuration
public class AmazonS3Config {

@Value("${cloud.aws.credentials.access-key}")
private String accessKey;

@Value("${cloud.aws.credentials.secret-key}")
private String secretKey;

@Value("${cloud.aws.region.static}")
private String region;

@Bean
public S3Client s3Client() {
AwsBasicCredentials credentials = AwsBasicCredentials.create(accessKey, secretKey);

return S3Client.builder()
.region(Region.of(region))
.credentialsProvider(StaticCredentialsProvider.create(credentials))
.credentialsProvider(DefaultCredentialsProvider.create())
.build();
}
}
29 changes: 29 additions & 0 deletions src/main/resources/application-loadtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
spring:
config:
activate:
on-profile: loadtest

jpa:
show-sql: false
properties:
hibernate:
format_sql: false

datasource:
hikari:
maximum-pool-size: 50
minimum-idle: 20
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

부하 테스트시에는 flyway 사용 안 하니까 명시적으로 false 를 설정해주는게 좋을 거 같습니다 ! true 여도 어차피 stage에서 마이그레이션된 후여서 상관없을 거 같은데, 혹시 모르니까요 ..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니당


websocket:
thread-pool:
inbound:
core-pool-size: 24
max-pool-size: 48
queue-capacity: 4000
outbound:
core-pool-size: 24
max-pool-size: 48
Comment thread
coderabbitai[bot] marked this conversation as resolved.
queue-capacity: 4000
heartbeat:
server-interval: 10000
client-interval: 10000
38 changes: 35 additions & 3 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
spring:
application:
name: solid-connect-server

config:
import:
- classpath:/secret/application-cloud.yml
- classpath:/secret/application-db.yml
- classpath:/secret/application-variable.yml
- optional:classpath:/config/application-cloud.yml
- optional:classpath:/config/application-db.yml
- optional:classpath:/config/application-variable.yml
- optional:aws-parameterstore:/solid-connection/common/

tomcat:
threads:
Expand All @@ -23,3 +27,31 @@ management:
web:
exposure:
include: prometheus

---
spring:
config:
activate:
on-profile: local
import: optional:aws-parameterstore:/solid-connection/local/

---
spring:
config:
activate:
on-profile: dev
import: optional:aws-parameterstore:/solid-connection/dev/

---
spring:
config:
activate:
on-profile: prod
import: optional:aws-parameterstore:/solid-connection/prod/

---
spring:
config:
activate:
on-profile: loadtest
import: optional:aws-parameterstore:/solid-connection/loadtest/
20 changes: 20 additions & 0 deletions src/main/resources/config/application-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
spring:
config:
activate:
on-profile: local, dev, prod, loadtest

cloud:
aws:
region:
static: ${CLOUD_AWS_REGION:ap-northeast-2}
stack:
auto: false
s3:
bucket: ${CLOUD_AWS_S3_BUCKET}
url:
default: ${CLOUD_AWS_S3_URL_DEFAULT}
uploaded: ${CLOUD_AWS_S3_URL_UPLOADED}
cloudFront:
url:
default: ${CLOUD_AWS_CLOUDFRONT_URL_DEFAULT}
uploaded: ${CLOUD_AWS_CLOUDFRONT_URL_UPLOADED}
89 changes: 89 additions & 0 deletions src/main/resources/config/application-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
spring:
data:
redis:
host: ${REDIS_HOST:localhost}
port: ${REDIS_PORT:6379}

---
spring:
config:
activate:
on-profile: prod

jpa:
hibernate:
ddl-auto: none
generate-ddl: false
show-sql: false
database: mysql
defer-datasource-initialization: false

datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}

flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: true
user: ${FLYWAY_DB_USERNAME}
password: ${FLYWAY_DB_PASSWORD}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

---
spring:
config:
activate:
on-profile: dev

jpa:
hibernate:
ddl-auto: validate
generate-ddl: false
show-sql: false
database: mysql
defer-datasource-initialization: false

datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: ${DB_URL}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}

flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: true
user: ${FLYWAY_DB_USERNAME}
password: ${FLYWAY_DB_PASSWORD}

---
spring:
config:
activate:
on-profile: local

jpa:
hibernate:
ddl-auto: create
generate-ddl: true
show-sql: true
database: mysql
defer-datasource-initialization: true
properties:
hibernate:
format_sql: true

sql:
init:
mode: always

datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: ${LOCAL_DB_URL:jdbc:mysql://localhost/solid_connection?serverTimezone=Asia/Seoul&characterEncoding=UTF-8}
username: ${LOCAL_DB_USERNAME}
password: ${LOCAL_DB_PASSWORD}

flyway:
enabled: false
Loading
Loading