Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
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
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();
}
}
32 changes: 32 additions & 0 deletions src/main/resources/application-loadtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
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
Contributor Author

Choose a reason for hiding this comment

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

확인했습니당


flyway:
enabled: false

websocket:
thread-pool:
inbound:
core-pool-size: 24
max-pool-size: 48
queue-capacity: 4000
outbound:
core-pool-size: 24
max-pool-size: 48
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
- 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: aws-parameterstore:/solid-connection/local/

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

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

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

cloud:
aws:
stack:
auto: false
70 changes: 70 additions & 0 deletions src/main/resources/config/application-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
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

flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: false
Copy link
Member

Choose a reason for hiding this comment

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

기존에는 baseline-on-migratetrue 인데 false로 설정하신 이유가 있나요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

baseline을 true로 할 이유가 없다고 판단했습니다! 지금 어차피 flyway적용 중인 상태라 DB를 옮기는 게 아니면 baseline이 거의 필요 없는 상황이라서요! DB를 옮기는 등 특수한 상황이면 수동으로 실행하는 게 안전하다고 생각했습니당


---
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

flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: false

---
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

flyway:
enabled: false
154 changes: 154 additions & 0 deletions src/main/resources/config/application-variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
view:
count:
scheduling:
delay: 3000

websocket:
thread-pool:
inbound:
core-pool-size: 6
max-pool-size: 12
queue-capacity: 1000
outbound:
core-pool-size: 6
max-pool-size: 12
queue-capacity: 1000
heartbeat:
server-interval: 15000
client-interval: 15000

oauth:
apple:
token-url: "https://appleid.apple.com/auth/token"
client-secret-audience-url: "https://appleid.apple.com"
public-key-url: "https://appleid.apple.com/auth/keys"
kakao:
token-url: "https://kauth.kakao.com/oauth/token"
user-info-url: "https://kapi.kakao.com/v2/user/me"
Copy link
Member

Choose a reason for hiding this comment

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

사소하긴 한데요, test 설정 파일에는 user-info_url 로 되어 있습니다. 이 부분도 통일 가능할까요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

통일하겠습니당


sentry:
send-default-pii: false
Copy link
Member

Choose a reason for hiding this comment

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

기존에는 true 였는데 false 로 설정하신 이유가 있나요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이거 보안이랑 개인정보 관련해서 좀 민감한 부분이라 일단 false로 돌렸습니당... 실무에서도 필요한 필드만 따로 설정해서 수동 전송한다고 하더라구요

traces-sample-rate: 1.0
exception-resolver-order: -2147483647

management:
server:
port: 8081

token:
access:
storage-key-prefix: "ACCESS"
expire-time: 1h
refresh:
storage-key-prefix: "REFRESH"
expire-time: 90d
sign-up:
storage-key-prefix: "SIGN_UP"
expire-time: 10m
black-list:
storage-key-prefix: "BLACKLIST"
expire-time: 1h

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

websocket:
thread-pool:
inbound:
core-pool-size: 16
max-pool-size: 32
queue-capacity: 2000
outbound:
core-pool-size: 16
max-pool-size: 32
queue-capacity: 2000
heartbeat:
server-interval: 10000
client-interval: 10000

cors:
allowed-origins:
- "https://www.solid-connection.com"
- "https://api.solid-connection.com"
- "https://admin.solid-connection.com"

sentry:
environment: "production"
traces-sample-rate: 0.1
Copy link
Member

Choose a reason for hiding this comment

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

이전에는 prod에도 sentry trace rate가 1.0이었는데, 0.1로 변경하신 이유가 있나요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1.0은 오버헤드가 크다고해서 줄여봤습니다...! 실무에서는 보통 0.05~0.2를 사용한다고 하네요 문제 있으면 수정하겠습니다!

Copy link
Member

Choose a reason for hiding this comment

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

그대로 가도 좋을 거 같아요 !


token:
refresh:
cookie-domain: ".solid-connection.com"

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

websocket:
thread-pool:
inbound:
core-pool-size: 4
max-pool-size: 8
queue-capacity: 500
outbound:
core-pool-size: 4
max-pool-size: 8
queue-capacity: 500
heartbeat:
server-interval: 15000
client-interval: 15000

cors:
allowed-origins:
- "https://www.stage.solid-connection.com"
- "https://api.stage.solid-connection.com"
- "https://www.stage.admins.solid-connection.com"
- "http://localhost:3000"
- "https://localhost:3000"
- "http://localhost:5173"

sentry:
environment: "dev"

token:
refresh:
cookie-domain: ".stage.solid-connection.com"

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

websocket:
thread-pool:
inbound:
core-pool-size: 4
max-pool-size: 8
queue-capacity: 500
outbound:
core-pool-size: 4
max-pool-size: 8
queue-capacity: 500
heartbeat:
server-interval: 15000
client-interval: 15000

cors:
allowed-origins:
- "http://localhost:8080"
- "http://localhost:3000"
- "http://localhost:5173"
- "https://localhost:3000"

sentry:
environment: "development"

token:
refresh:
cookie-domain: "localhost"
Loading
Loading