-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BSVR-212] AWS ElastiCache Redis 세팅 #145
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e26791
build: redis dependency 추가
EunjiShin c1721b1
refactor: InfrastructureConfig 병합
EunjiShin 6bfb957
build: redisson dependency 추가
EunjiShin b6c186e
feat: redis properties 생성
EunjiShin f4edbc1
feat: Redisson을 활용해 redis 설정파일 추가
EunjiShin 1635ba3
build: ci-cd 스크립트에 redis 환경변수 추가
EunjiShin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 2 additions & 11 deletions
13
...ion/src/main/java/org/depromeet/spot/application/common/config/SpotApplicationConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
package org.depromeet.spot.application.common.config; | ||
|
||
import org.depromeet.spot.infrastructure.aws.AwsConfig; | ||
import org.depromeet.spot.infrastructure.cache.config.CacheConfig; | ||
import org.depromeet.spot.infrastructure.jpa.config.JpaConfig; | ||
import org.depromeet.spot.infrastructure.InfrastructureConfig; | ||
import org.depromeet.spot.usecase.config.UsecaseConfig; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
|
||
@ComponentScan(basePackages = {"org.depromeet.spot.application"}) | ||
@Configuration | ||
@Import( | ||
value = { | ||
UsecaseConfig.class, | ||
JpaConfig.class, | ||
AwsConfig.class, | ||
CacheConfig.class, | ||
SwaggerConfig.class | ||
}) | ||
@Import(value = {UsecaseConfig.class, SwaggerConfig.class, InfrastructureConfig.class}) | ||
public class SpotApplicationConfig {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
infrastructure/src/main/java/org/depromeet/spot/infrastructure/InfrastructureConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.depromeet.spot.infrastructure; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.ComponentScan; | ||
|
||
@EnableConfigurationProperties | ||
@ConfigurationPropertiesScan(basePackages = {"org.depromeet.spot.infrastructure"}) | ||
@ComponentScan(basePackages = {"org.depromeet.spot.infrastructure"}) | ||
public class InfrastructureConfig {} |
30 changes: 30 additions & 0 deletions
30
infrastructure/src/main/java/org/depromeet/spot/infrastructure/redis/RedisConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.depromeet.spot.infrastructure.redis; | ||
|
||
import org.redisson.Redisson; | ||
import org.redisson.api.RedissonClient; | ||
import org.redisson.config.Config; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class RedisConfig { | ||
|
||
private static final String REDISSON_HOST_PREFIX = "redis://"; | ||
private final RedisProperties redisProperties; | ||
|
||
@Bean | ||
public RedissonClient redissonClient() { | ||
Config redissonConfig = new Config(); | ||
redissonConfig | ||
.useSingleServer() | ||
.setAddress( | ||
REDISSON_HOST_PREFIX | ||
+ redisProperties.host() | ||
+ ":" | ||
+ redisProperties.port()); | ||
return Redisson.create(redissonConfig); | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
infrastructure/src/main/java/org/depromeet/spot/infrastructure/redis/RedisProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.depromeet.spot.infrastructure.redis; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "aws.redis") | ||
public record RedisProperties(String host, int port) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
java에서 쓸 수 있는 레디스 클라이언트는 대표적으로 redisson이랑 lettuce가 있어요.
SPOT에서는 redis를 분산락 관리 목적으로 도입했기 때문에, 해당 목적에 초점을 맞추고 아래와 같이 비교했어요.
성능과 구현 복잡도를 고려하여 Redisson 라이브러리를 최종 선택했습니당