Skip to content

Commit 5660eed

Browse files
committed
feat/OPS-377 : 테스트/운영 환경 분리
1 parent 4b746a1 commit 5660eed

File tree

9 files changed

+133
-53
lines changed

9 files changed

+133
-53
lines changed

.github/workflows/prod-server.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
-p $NEW_PORT:8080 \
8383
--name $NEW_CONTAINER \
8484
--network common \
85+
-e SPRING_PROFILES_ACTIVE=prod \
8586
-e SPRING_DATASOURCE_URL="${{secrets.PROD_DB_URL}}" \
8687
-e SPRING_DATASOURCE_USERNAME="${{secrets.PROD_DB_USERNAME}}" \
8788
-e SPRING_DATASOURCE_PASSWORD="${{secrets.PROD_DB_PASSWORD}}" \

.github/workflows/test-server-cd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
-p $NEW_PORT:8080 \
6060
--name $NEW_CONTAINER \
6161
--network common \
62+
-e SPRING_PROFILES_ACTIVE=server \
6263
-e SPRING_DATASOURCE_URL="${{secrets.TEST_DB_URL}}" \
6364
-e SPRING_DATASOURCE_USERNAME="${{secrets.TEST_DB_USERNAME}}" \
6465
-e SPRING_DATASOURCE_PASSWORD="${{secrets.TEST_DB_PASSWORD}}" \

.github/workflows/test-server-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Generate application-secrets.yml
6969
run: |
7070
mkdir -p src/main/resources
71-
echo "${{ secrets.APPLICATION_SECRET_YML }}" > src/main/resources/application-secrets.yml
71+
echo "${{ secrets.APPLICATION_SECRET_YML_V2 }}" > src/main/resources/application-secrets.yml
7272
echo "OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}" >> src/main/resources/application-secrets.yml
7373
7474
echo "spring.cloud.aws.region.static: ${{ secrets.AWS_REGION }}" >> src/main/resources/application-secrets.yml

src/main/java/org/tuna/zoopzoop/backend/domain/auth/handler/OAuth2SuccessHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public class OAuth2SuccessHandler extends SimpleUrlAuthenticationSuccessHandler
4141
@Value("${front.redirect_domain}")
4242
private String redirect_domain;
4343

44-
@Value("${spring.profiles.active:dev}")
45-
private String activeProfile;
44+
private final String SITE_DOMAIN = "zoopzoop.kro.kr";
4645

4746
@Override
4847
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
@@ -112,7 +111,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
112111
.maxAge(jwtProperties.getAccessTokenValidity() / 1000)
113112
// .domain() // 프론트엔드 & 백엔드 상위 도메인
114113
// .secure(true) // https 필수 설정.
115-
.domain(redirect_domain)
114+
.domain(SITE_DOMAIN)
116115
.secure(true)
117116
.sameSite("None")
118117
.build();
@@ -121,7 +120,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
121120
.httpOnly(true)
122121
.path("/")
123122
.maxAge(jwtProperties.getRefreshTokenValidity() / 1000) // RefreshToken 유효기간과 동일하게
124-
.domain(redirect_domain)
123+
.domain(SITE_DOMAIN)
125124
.secure(true)
126125
.sameSite("None")
127126
.build();

src/main/resources/application-dev.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@ spring:
1515
host: localhost
1616
port: 6379
1717
timeout: 6000
18-
cache: #Spring Cache를 사용하기 위한 Redis
19-
type: redis
20-
redis:
21-
time-to-live: 300000
22-
cache-null-values: false
18+
19+
security:
20+
oauth2:
21+
client:
22+
registration:
23+
kakao:
24+
redirect-uri: http://localhost:8080/login/oauth2/code/kakao
25+
google:
26+
redirect-uri: http://localhost:8080/login/oauth2/code/google
2327

2428
app:
2529
seed:
2630
enabled: true
2731

32+
front:
33+
redirect_domain: http://localhost:3000
34+
2835
sentry:
29-
dsn: https://60f1acad189d2994353d59b7895076ee@o4510100579155968.ingest.us.sentry.io/4510100584923136
30-
# Add data like request headers and IP for users,
31-
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
3236
send-default-pii: true
3337
environment: local
3438
traces-sample-rate: 0.0
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
spring:
2+
datasource:
3+
url: ${SPRING_DATASOURCE_URL}
4+
username: ${SPRING_DATASOURCE_USERNAME}
5+
password: ${SPRING_DATASOURCE_PASSWORD}
6+
7+
data: #RedisTemplate 등을 사용하기 위한 직접 연결용
8+
redis:
9+
host: 10.0.1.153
10+
port: 6379
11+
timeout: 6000
12+
password: zoopzoopRedisProd!
13+
14+
security:
15+
oauth2:
16+
client:
17+
registration:
18+
kakao:
19+
redirect-uri: https://api.prod.zoopzoop.kro.kr/login/oauth2/code/kakao
20+
google:
21+
redirect-uri: https://api.prod.zoopzoop.kro.kr/login/oauth2/code/google
22+
23+
front:
24+
redirect_domain: https://www.zoopzoop.kro.kr/
25+
26+
sentry:
27+
send-default-pii: true
28+
environment: prod-server
29+
traces-sample-rate: 0.2

src/main/resources/application-secrets.yml.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,5 @@ jwt:
5252
OPENAI_API_KEY: {OPENAI_API_KEY}
5353

5454
liveblocks:
55-
secret-key: {LIVEBLOCKS_SECRET_KEY}
55+
secret-key: {LIVEBLOCKS_SECRET_KEY}
56+

src/main/resources/application-server.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,27 @@ spring:
44
username: ${SPRING_DATASOURCE_USERNAME}
55
password: ${SPRING_DATASOURCE_PASSWORD}
66

7-
jpa:
8-
hibernate:
9-
ddl-auto: update
10-
117
data: #RedisTemplate 등을 사용하기 위한 직접 연결용
128
redis:
139
host: 10.0.1.246
1410
port: 6379
1511
timeout: 6000
1612
password: zoopzoopRedisTest!
17-
cache: #Spring Cache를 사용하기 위한 Redis
18-
type: redis
19-
redis:
20-
time-to-live: 300000
21-
cache-null-values: false
2213

23-
management:
24-
endpoints:
25-
web:
26-
exposure:
27-
include: health,info
28-
endpoint:
29-
health:
30-
show-details: always
14+
security:
15+
oauth2:
16+
client:
17+
registration:
18+
kakao:
19+
redirect-uri: https://api.test.zoopzoop.kro.kr/login/oauth2/code/kakao
20+
google:
21+
redirect-uri: https://api.test.zoopzoop.kro.kr/login/oauth2/code/google
22+
23+
front:
24+
redirect_domain: http://localhost:3000
3125

3226
sentry:
33-
dsn: https://60f1acad189d2994353d59b7895076ee@o4510100579155968.ingest.us.sentry.io/4510100584923136
34-
# Add data like request headers and IP for users,
35-
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
3627
send-default-pii: true
37-
environment: prod
28+
environment: prod-server
3829
traces-sample-rate: 0.2
30+

src/main/resources/application.yml

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
11
spring:
22
application:
33
name: back
4+
45
profiles:
56
active: dev
7+
68
output:
79
ansi:
810
enabled: always
11+
912
datasource:
1013
hikari:
1114
auto-commit: false
12-
jackson:
15+
16+
jackson: #Jackson 설정
1317
serialization:
1418
fail-on-empty-beans: false
15-
jpa:
19+
20+
jpa: #Hibernate JPA 설정.
1621
show-sql: true
1722
hibernate:
18-
ddl-auto: create-drop
23+
ddl-auto: update
1924
properties:
2025
hibernate:
2126
format_sql: true
2227
highlight_sql: true
2328
use_sql_comments: true
24-
config:
29+
30+
config: #application-secrets의 값을 바로 받아올 수 있게.
2531
import: optional:classpath:application-secrets.yml
26-
servlet:
32+
33+
servlet: #
2734
multipart:
2835
max-file-size: 10MB
2936
max-request-size: 10MB
30-
ai:
37+
38+
ai: #Spring AI 설정
3139
openai:
3240
base-url: https://api.groq.com/openai # 내부 서버를 groq으로
3341
api-key: ${OPENAI_API_KEY}
3442
chat:
3543
options:
3644
model: meta-llama/llama-4-scout-17b-16e-instruct
3745
temperature: 0
38-
rabbitmq:
46+
47+
rabbitmq: #RabbitMQ 설정
3948
host: ${SPRING_RABBITMQ_HOST:localhost}
4049
port: 5672
4150
username: ${SPRING_RABBITMQ_USERNAME:guest}
@@ -46,19 +55,54 @@ spring:
4655
enabled: true
4756
initial-interval: 2000
4857
max-attempts: 3
49-
data: #RedisTemplate 등을 사용하기 위한 직접 연결용
50-
redis:
51-
host: localhost
52-
port: 6379
53-
timeout: 6000
58+
5459
cache: #Spring Cache를 사용하기 위한 Redis
5560
type: redis
5661
redis:
5762
time-to-live: 300000
5863
cache-null-values: false
59-
key-prefix:
6064

61-
springdoc:
65+
security: #OAuth2 범용 설정
66+
oauth2:
67+
client:
68+
registration:
69+
kakao:
70+
client-id: ${kakao.client-id}
71+
scope:
72+
- profile_nickname
73+
- profile_image
74+
authorization-grant-type: authorization_code
75+
google:
76+
client-id: ${google.client-id}
77+
client-secret: ${google.client-secret}
78+
scope:
79+
- profile
80+
authorization-grant-type: authorization_code
81+
provider:
82+
kakao:
83+
authorization-uri: https://kauth.kakao.com/oauth/authorize
84+
token-uri: https://kauth.kakao.com/oauth/token
85+
user-info-uri: https://kapi.kakao.com/v2/user/me
86+
user-name-attribute: id
87+
google:
88+
authorization-uri: https://accounts.google.com/o/oauth2/v2/auth
89+
token-uri: https://oauth2.googleapis.com/token
90+
user-info-uri: https://www.googleapis.com/oauth2/v3/userinfo
91+
user-name-attribute: sub
92+
93+
cloud: #S3 설정
94+
aws:
95+
credentials:
96+
access-key: ${aws.access-key}
97+
secret-key: ${aws.secret-key}
98+
region:
99+
static: ap-northeast-2
100+
s3:
101+
bucket: ${aws.bucket}
102+
stack:
103+
auto: false
104+
105+
springdoc: #Spring doc 설정.
62106
default-produces-media-type: application/json;charset=UTF-8
63107
logging:
64108
level:
@@ -68,9 +112,18 @@ logging:
68112
com.back: DEBUG
69113
org.springframework.retry: DEBUG
70114

71-
server:
72-
port: 8080
73-
74115
app:
75116
seed:
76-
enabled: true
117+
enabled: true
118+
119+
management:
120+
endpoints:
121+
web:
122+
exposure:
123+
include: health,info
124+
endpoint:
125+
health:
126+
show-details: always
127+
128+
sentry: #Sentry 모니터렁 기본 설정.
129+
dsn: ${sentry-dsn}

0 commit comments

Comments
 (0)