-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 최근 접속 시간 조회 기능 구현 * chore: GetMemberActivityResponse에서 변수명 수정 * chore: RedisConfig 통합 및 objectMapper 관련 변경 * chore: RecentActivityDto 생성 및 적용 * chore: dev, prod에 redis 컨테이너 추가 * chore: infra > development > redis.conf 추가 * fix: dev > docker-compose.yaml volume 정보 * fix: redis에도 network 정보 추가 * fix: dev > nginx.conf 수정 --------- Co-authored-by: mikekks <[email protected]>
- Loading branch information
Showing
24 changed files
with
396 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
push: | ||
branches: | ||
- develop | ||
- feat/LA-20_3 | ||
- feat/LA-27-2 | ||
|
||
env: | ||
REGISTRY: "docker.io" | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
# - feat/LA-27-2 | ||
|
||
env: | ||
REGISTRY: "docker.io" | ||
|
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
7 changes: 7 additions & 0 deletions
7
layer-admin/src/main/java/org/layer/common/exception/AdminException.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,7 @@ | ||
package org.layer.common.exception; | ||
|
||
public class AdminException extends BaseCustomException { | ||
public AdminException(ExceptionType exceptionType) { | ||
super(exceptionType); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
layer-admin/src/main/java/org/layer/config/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,68 @@ | ||
package org.layer.config; | ||
|
||
import com.fasterxml.jackson.databind.DeserializationFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator; | ||
import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator; | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration; | ||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories; | ||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; | ||
import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
|
||
|
||
@Configuration | ||
@EnableRedisRepositories | ||
public class RedisConfig { | ||
@Value("${spring.data.redis.host}") | ||
private String host; | ||
|
||
@Value("${spring.data.redis.port}") | ||
private int port; | ||
|
||
@Value("${spring.data.redis.password}") | ||
private String password; | ||
|
||
// prod에서 최근 서비스 이용 시점 기록 - 1번 데이터베이스 | ||
@Bean | ||
public RedisConnectionFactory redisConnectionFactory() { | ||
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); | ||
redisStandaloneConfiguration.setHostName(host); | ||
redisStandaloneConfiguration.setPort(port); | ||
redisStandaloneConfiguration.setDatabase(1); // 1번 데이터베이스 | ||
|
||
return new LettuceConnectionFactory(redisStandaloneConfiguration); | ||
|
||
} | ||
|
||
@Bean | ||
public RedisTemplate<String, Object> redisTemplate() { | ||
RedisTemplate<String, Object> template = new RedisTemplate<>(); | ||
template.setConnectionFactory(redisConnectionFactory()); | ||
|
||
PolymorphicTypeValidator typeValidator = BasicPolymorphicTypeValidator | ||
.builder() | ||
.allowIfSubType(Object.class) | ||
.build(); | ||
|
||
ObjectMapper objectMapper = new ObjectMapper() | ||
.findAndRegisterModules() | ||
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) | ||
.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false) | ||
.activateDefaultTyping(typeValidator, ObjectMapper.DefaultTyping.NON_FINAL) | ||
.registerModule(new JavaTimeModule()); | ||
|
||
template.setKeySerializer(new StringRedisSerializer()); | ||
template.setValueSerializer(new GenericJackson2JsonRedisSerializer(objectMapper)); | ||
|
||
return template; | ||
} | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
layer-admin/src/main/java/org/layer/member/controller/dto/GetMemberActivityResponse.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
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
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,34 @@ | ||
server: | ||
port: 3000 | ||
|
||
spring: | ||
config: | ||
import: application-secret.properties | ||
datasource: | ||
driver-class-name: org.h2.Driver | ||
url: jdbc:h2:mem:layer-local-db;DATABASE_TO_UPPER=FALSE;mode=mysql # H2 접속 정보 (전부 소문자로 지정) | ||
username: sa | ||
password: | ||
h2: | ||
console: | ||
enabled: true | ||
path: /h2-console | ||
jpa: | ||
database-platform: org.hibernate.dialect.H2Dialect | ||
hibernate: | ||
ddl-auto: create | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
show_sql: true | ||
open-in-view: false | ||
defer-datasource-initialization: true | ||
|
||
data: | ||
redis: | ||
host: localhost | ||
port: 6379 | ||
password: | ||
|
||
admin: | ||
password: ${ADMIN_PASSWORD} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Base image | ||
FROM redis:latest | ||
|
||
# Copy custom Redis configuration | ||
COPY redis.conf /usr/local/etc/redis/redis.conf | ||
|
||
# Command to run Redis with the custom configuration | ||
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"] |
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
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,20 @@ | ||
# Save the DB snapshot every 180 seconds if at least 1 key changes | ||
save 180 1 | ||
|
||
# Specify the filename for the RDB file | ||
dbfilename dump.rdb | ||
|
||
# Directory where the RDB snapshot will be saved | ||
dir /data | ||
|
||
# Enable RDB snapshot logging (optional for debugging) | ||
loglevel notice | ||
|
||
# Disable AOF (if you want only RDB persistence) | ||
appendonly no | ||
|
||
# Compression for RDB files (enabled by default) | ||
rdbcompression yes | ||
|
||
# Checksum verification for RDB files (enabled by default) | ||
rdbchecksum yes |
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,8 @@ | ||
# Base image | ||
FROM redis:latest | ||
|
||
# Copy custom Redis configuration | ||
COPY redis.conf /usr/local/etc/redis/redis.conf | ||
|
||
# Command to run Redis with the custom configuration | ||
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"] |
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
Oops, something went wrong.