mirror of
https://github.com/ktds-dg0501/kt-event-marketing.git
synced 2025-12-06 08:46:23 +00:00
Compare commits
2 Commits
a58d345f7b
...
82086fcf64
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82086fcf64 | ||
|
|
bd4cd83fa0 |
12
.github/workflows/backend-cicd.yaml
vendored
12
.github/workflows/backend-cicd.yaml
vendored
@ -9,12 +9,12 @@ on:
|
||||
# - '*-service/**'
|
||||
# - '.github/workflows/backend-cicd.yaml'
|
||||
# - '.github/kustomize/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
paths:
|
||||
- '*-service/**'
|
||||
# pull_request:
|
||||
# branches:
|
||||
# - develop
|
||||
# - main
|
||||
# paths:
|
||||
# - '*-service/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
|
||||
@ -7,6 +7,9 @@ RUN java -Djarmode=layertools -jar app.jar extract
|
||||
FROM eclipse-temurin:21-jre-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# Install gcompat for Snappy compression library compatibility
|
||||
RUN apk add --no-cache gcompat
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -S spring && adduser -S spring -G spring
|
||||
USER spring:spring
|
||||
|
||||
@ -9,7 +9,7 @@ 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.RedisSentinelConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@ -17,6 +17,7 @@ import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSeriali
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Redis 설정
|
||||
@ -29,11 +30,11 @@ import java.time.Duration;
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Value("${spring.data.redis.host}")
|
||||
private String redisHost;
|
||||
@Value("${spring.data.redis.sentinel.master:mymaster}")
|
||||
private String sentinelMaster;
|
||||
|
||||
@Value("${spring.data.redis.port}")
|
||||
private int redisPort;
|
||||
@Value("${spring.data.redis.sentinel.nodes}")
|
||||
private String sentinelNodes;
|
||||
|
||||
@Value("${spring.data.redis.password}")
|
||||
private String redisPassword;
|
||||
@ -45,17 +46,26 @@ public class RedisConfig {
|
||||
private long redisTimeout;
|
||||
|
||||
/**
|
||||
* Redis 연결 팩토리 설정
|
||||
* Redis 연결 팩토리 설정 (Sentinel 모드)
|
||||
*/
|
||||
@Bean
|
||||
public RedisConnectionFactory redisConnectionFactory() {
|
||||
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
|
||||
config.setHostName(redisHost);
|
||||
config.setPort(redisPort);
|
||||
RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration()
|
||||
.master(sentinelMaster);
|
||||
|
||||
// Sentinel 노드 추가 (콤마로 구분된 host:port 형식)
|
||||
Arrays.stream(sentinelNodes.split(","))
|
||||
.map(String::trim)
|
||||
.forEach(node -> {
|
||||
String[] parts = node.split(":");
|
||||
sentinelConfig.sentinel(parts[0], Integer.parseInt(parts[1]));
|
||||
});
|
||||
|
||||
if (redisPassword != null && !redisPassword.isEmpty()) {
|
||||
config.setPassword(redisPassword);
|
||||
sentinelConfig.setPassword(redisPassword);
|
||||
sentinelConfig.setSentinelPassword(redisPassword);
|
||||
}
|
||||
config.setDatabase(redisDatabase);
|
||||
sentinelConfig.setDatabase(redisDatabase);
|
||||
|
||||
// Lettuce Client 설정: Timeout 및 Connection 옵션
|
||||
SocketOptions socketOptions = SocketOptions.builder()
|
||||
@ -73,8 +83,7 @@ public class RedisConfig {
|
||||
.clientOptions(clientOptions)
|
||||
.build();
|
||||
|
||||
// afterPropertiesSet() 제거: Spring이 자동으로 호출함
|
||||
return new LettuceConnectionFactory(config, clientConfig);
|
||||
return new LettuceConnectionFactory(sentinelConfig, clientConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -25,6 +25,11 @@ public class AIJobMessage {
|
||||
*/
|
||||
private String jobId;
|
||||
|
||||
/**
|
||||
* 사용자 ID (UUID String)
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 이벤트 ID (Event Service에서 생성)
|
||||
*/
|
||||
|
||||
@ -2,14 +2,16 @@ spring:
|
||||
application:
|
||||
name: ai-service
|
||||
|
||||
# Redis Configuration
|
||||
# Redis Configuration with Sentinel
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:20.214.210.71}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:Hi5Jessica!}
|
||||
database: ${REDIS_DATABASE:3}
|
||||
timeout: ${REDIS_TIMEOUT:3000}
|
||||
sentinel:
|
||||
master: ${REDIS_SENTINEL_MASTER:mymaster}
|
||||
nodes: ${REDIS_SENTINEL_NODES:redis-node-0.redis-headless.kt-event-marketing.svc.cluster.local:26379,redis-node-1.redis-headless.kt-event-marketing.svc.cluster.local:26379}
|
||||
password: ${REDIS_PASSWORD:Hi5Jessica!}
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: ${REDIS_POOL_MAX:8}
|
||||
|
||||
@ -30,7 +30,40 @@ spec:
|
||||
port:
|
||||
number: 80
|
||||
|
||||
# Event Service
|
||||
# Event Service - Swagger UI (must be before /api/v1/events path)
|
||||
- path: /api/v1/swagger-ui
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: event-service
|
||||
port:
|
||||
number: 80
|
||||
|
||||
- path: /api/v1/swagger-ui.html
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: event-service
|
||||
port:
|
||||
number: 80
|
||||
|
||||
- path: /api/v1/v3/api-docs
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: event-service
|
||||
port:
|
||||
number: 80
|
||||
|
||||
- path: /api/v1/api-docs
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: event-service
|
||||
port:
|
||||
number: 80
|
||||
|
||||
# Event Service - API endpoints
|
||||
- path: /api/v1/events
|
||||
pathType: Prefix
|
||||
backend:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user