Skip to content

Commit de27649

Browse files
committed
refactor: S3 단일 버킷 사용 시 테스트 서버/운영 서버 구분을 위해 프로파일별 prefix 설정 추가
1 parent 110330d commit de27649

File tree

6 files changed

+76
-4
lines changed

6 files changed

+76
-4
lines changed

.github/workflows/prod-server.yml

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
-p $NEW_PORT:8080 \
6060
--name $NEW_CONTAINER \
6161
--network common \
62-
-e SPRING_PROFILES_ACTIVE=server \
62+
-e SPRING_PROFILES_ACTIVE=staging \
6363
# DB
6464
-e SPRING_DATASOURCE_URL="${{secrets.TEST_DB_URL}}" \
6565
-e SPRING_DATASOURCE_USERNAME="${{secrets.TEST_DB_USERNAME}}" \

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
FROM openjdk:21-jdk-slim
22
COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar
33

4-
ENV SPRING_PROFILES_ACTIVE=server
5-
64
ENTRYPOINT ["java","-jar","/app.jar"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.tuna.zoopzoop.backend.global.aspect.time;
2+
3+
import org.aspectj.lang.ProceedingJoinPoint;
4+
import org.aspectj.lang.annotation.Around;
5+
import org.aspectj.lang.annotation.Aspect;
6+
import org.springframework.stereotype.Component;
7+
8+
@Aspect
9+
@Component
10+
public class ExecutionTimeAspect {
11+
12+
@Around("execution(* org.tuna.zoopzoop.backend..*Controller.*(..))")
13+
public Object measureExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
14+
long start = System.currentTimeMillis();
15+
16+
Object result = joinPoint.proceed();
17+
18+
long executionTime = System.currentTimeMillis() - start;
19+
String methodName = joinPoint.getSignature().toShortString();
20+
System.out.println(methodName + " executed in " + executionTime + "ms");
21+
22+
return result;
23+
}
24+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
spring:
2+
datasource:
3+
url: ${SPRING_DATASOURCE_URL}
4+
username: ${SPRING_DATASOURCE_USERNAME}
5+
password: ${SPRING_DATASOURCE_PASSWORD}
6+
7+
jpa:
8+
hibernate:
9+
ddl-auto: update
10+
11+
data: #RedisTemplate 등을 사용하기 위한 직접 연결용
12+
redis:
13+
host: ${REDIS_HOST}
14+
port: 6379
15+
timeout: 6000
16+
password: ${REDIS_PASSWORD}
17+
18+
cache: #Spring Cache를 사용하기 위한 Redis
19+
type: redis
20+
redis:
21+
time-to-live: 300000
22+
cache-null-values: false
23+
24+
security:
25+
oauth2:
26+
client:
27+
registration:
28+
kakao:
29+
redirect-uri: ${KAKAO_REDIRECT_URI}
30+
google:
31+
redirect-uri: ${GOOGLE_REDIRECT_URI}
32+
33+
front:
34+
redirect_domain: ${FRONT_REDIRECT_DOMAIN}
35+
36+
sentry:
37+
# Add data like request headers and IP for users,
38+
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
39+
send-default-pii: true
40+
environment: prod
41+
traces-sample-rate: 0.2
42+
43+
cloud:
44+
aws:
45+
s3:
46+
prefix: prod/

src/main/resources/application-server.yml renamed to src/main/resources/application-staging.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ sentry:
4040
environment: prod
4141
traces-sample-rate: 0.2
4242

43+
cloud:
44+
aws:
45+
s3:
46+
prefix: test/

0 commit comments

Comments
 (0)