mirror of
https://github.com/won-ktds/smarketing-backend.git
synced 2025-12-06 15:16:23 +00:00
Merge branch 'main' of https://github.com/won-ktds/smarketing-backend into poster-content
This commit is contained in:
commit
1c79ea0834
84
smarketing-java/deployment/Jenkinsfile
vendored
84
smarketing-java/deployment/Jenkinsfile
vendored
@ -176,37 +176,43 @@ podTemplate(
|
|||||||
sh """
|
sh """
|
||||||
echo "=== 환경변수 설정 ==="
|
echo "=== 환경변수 설정 ==="
|
||||||
export namespace=${namespace}
|
export namespace=${namespace}
|
||||||
export allowed_origins=${props.allowed_origins}
|
export allowed_origins='${props.allowed_origins}'
|
||||||
export jwt_secret_key=${props.jwt_secret_key}
|
export jwt_secret_key='${props.jwt_secret_key}'
|
||||||
export postgres_user=${props.postgres_user}
|
export postgres_user='${props.POSTGRES_USER}'
|
||||||
export postgres_password=${props.postgres_password}
|
export postgres_password='${props.POSTGRES_PASSWORD}'
|
||||||
export replicas=${props.replicas}
|
export replicas=${props.replicas}
|
||||||
|
|
||||||
# PostgreSQL 환경변수 추가
|
# PostgreSQL 환경변수 추가 (문자열로)
|
||||||
export postgres_host=${props.POSTGRES_HOST}
|
export postgres_host='${props.POSTGRES_HOST}'
|
||||||
export postgres_port=${props.POSTGRES_PORT:-5432}
|
export postgres_port='5432'
|
||||||
export postgres_db_member=member
|
export postgres_db_member='member'
|
||||||
export postgres_db_store=store
|
export postgres_db_store='store'
|
||||||
export postgres_db_marketing_content=marketing_content
|
export postgres_db_marketing_content='marketing_content'
|
||||||
export postgres_db_ai_recommend=AiRecommendationDB
|
export postgres_db_ai_recommend='AiRecommendationDB'
|
||||||
|
|
||||||
# Redis 환경변수 추가
|
# Redis 환경변수 추가 (문자열로)
|
||||||
export redis_host=${props.REDIS_HOST}
|
export redis_host='${props.REDIS_HOST}'
|
||||||
export redis_port=${props.REDIS_PORT}
|
export redis_port='6380'
|
||||||
export redis_password=${props.REDIS_PASSWORD}
|
export redis_password='${props.REDIS_PASSWORD}'
|
||||||
|
|
||||||
|
# 리소스 요구사항
|
||||||
# 리소스 요구사항 조정 (작게)
|
export resources_requests_cpu='${props.resources_requests_cpu}'
|
||||||
export resources_requests_cpu=100m
|
export resources_requests_memory='${props.resources_requests_memory}'
|
||||||
export resources_requests_memory=128Mi
|
export resources_limits_cpu='${props.resources_limits_cpu}'
|
||||||
export resources_limits_cpu=500m
|
export resources_limits_memory='${props.resources_limits_memory}'
|
||||||
export resources_limits_memory=512Mi
|
|
||||||
|
|
||||||
# 이미지 경로 환경변수 설정
|
# 이미지 경로 환경변수 설정
|
||||||
export member_image_path=${props.registry}/${props.image_org}/member:${imageTag}
|
export member_image_path='${props.registry}/${props.image_org}/member:${imageTag}'
|
||||||
export store_image_path=${props.registry}/${props.image_org}/store:${imageTag}
|
export store_image_path='${props.registry}/${props.image_org}/store:${imageTag}'
|
||||||
export marketing_content_image_path=${props.registry}/${props.image_org}/marketing-content:${imageTag}
|
export marketing_content_image_path='${props.registry}/${props.image_org}/marketing-content:${imageTag}'
|
||||||
export ai_recommend_image_path=${props.registry}/${props.image_org}/ai-recommend:${imageTag}
|
export ai_recommend_image_path='${props.registry}/${props.image_org}/ai-recommend:${imageTag}'
|
||||||
|
|
||||||
|
echo "=== 환경변수 확인 ==="
|
||||||
|
echo "postgres_host: \$postgres_host"
|
||||||
|
echo "postgres_port: \$postgres_port"
|
||||||
|
echo "redis_host: \$redis_host"
|
||||||
|
echo "redis_port: \$redis_port"
|
||||||
|
echo "postgres_user: \$postgres_user"
|
||||||
|
|
||||||
echo "=== Manifest 생성 ==="
|
echo "=== Manifest 생성 ==="
|
||||||
envsubst < smarketing-java/deployment/${manifest}.template > smarketing-java/deployment/${manifest}
|
envsubst < smarketing-java/deployment/${manifest}.template > smarketing-java/deployment/${manifest}
|
||||||
@ -223,30 +229,42 @@ podTemplate(
|
|||||||
kubectl config current-context
|
kubectl config current-context
|
||||||
kubectl cluster-info | head -3
|
kubectl cluster-info | head -3
|
||||||
|
|
||||||
|
echo "=== 기존 ConfigMap 삭제 (타입 충돌 해결) ==="
|
||||||
|
kubectl delete configmap member-config store-config marketing-content-config ai-recommend-config -n ${namespace} --ignore-not-found=true
|
||||||
|
|
||||||
echo "=== PostgreSQL 서비스 확인 ==="
|
echo "=== PostgreSQL 서비스 확인 ==="
|
||||||
kubectl get svc -n ${namespace} | grep postgresql || echo "PostgreSQL 서비스가 없습니다. 먼저 설치해주세요."
|
kubectl get svc -n ${namespace} | grep postgresql || echo "PostgreSQL 서비스가 없습니다."
|
||||||
|
|
||||||
echo "=== Manifest 적용 ==="
|
echo "=== Manifest 적용 ==="
|
||||||
kubectl apply -f smarketing-java/deployment/${manifest}
|
kubectl apply -f smarketing-java/deployment/${manifest}
|
||||||
|
|
||||||
echo "=== 배포 상태 확인 (60초 대기) ==="
|
echo "=== 배포 상태 확인 (30초 대기) ==="
|
||||||
|
sleep 30
|
||||||
kubectl -n ${namespace} get deployments
|
kubectl -n ${namespace} get deployments
|
||||||
kubectl -n ${namespace} get pods
|
kubectl -n ${namespace} get pods
|
||||||
|
|
||||||
echo "=== 각 서비스 배포 대기 (60초 timeout) ==="
|
echo "=== ConfigMap 확인 ==="
|
||||||
timeout 60 kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=60s || echo "member deployment 대기 타임아웃"
|
kubectl -n ${namespace} get configmap ai-recommend-config -o yaml
|
||||||
timeout 60 kubectl -n ${namespace} wait --for=condition=available deployment/store --timeout=60s || echo "store deployment 대기 타임아웃"
|
|
||||||
timeout 60 kubectl -n ${namespace} wait --for=condition=available deployment/marketing-content --timeout=60s || echo "marketing-content deployment 대기 타임아웃"
|
echo "=== 각 서비스 배포 대기 (90초 timeout) ==="
|
||||||
timeout 60 kubectl -n ${namespace} wait --for=condition=available deployment/ai-recommend --timeout=60s || echo "ai-recommend deployment 대기 타임아웃"
|
timeout 90 kubectl -n ${namespace} wait --for=condition=available deployment/member --timeout=90s || echo "member deployment 대기 타임아웃"
|
||||||
|
timeout 90 kubectl -n ${namespace} wait --for=condition=available deployment/store --timeout=90s || echo "store deployment 대기 타임아웃"
|
||||||
|
timeout 90 kubectl -n ${namespace} wait --for=condition=available deployment/marketing-content --timeout=90s || echo "marketing-content deployment 대기 타임아웃"
|
||||||
|
timeout 90 kubectl -n ${namespace} wait --for=condition=available deployment/ai-recommend --timeout=90s || echo "ai-recommend deployment 대기 타임아웃"
|
||||||
|
|
||||||
echo "=== 최종 상태 ==="
|
echo "=== 최종 상태 ==="
|
||||||
kubectl -n ${namespace} get all
|
kubectl -n ${namespace} get all
|
||||||
|
|
||||||
|
echo "=== Pod 로그 확인 (ai-recommend) ==="
|
||||||
|
kubectl -n ${namespace} logs deployment/ai-recommend --tail=50 || echo "ai-recommend 로그를 가져올 수 없습니다"
|
||||||
|
|
||||||
echo "=== 실패한 Pod 상세 정보 ==="
|
echo "=== 실패한 Pod 상세 정보 ==="
|
||||||
for pod in \$(kubectl -n ${namespace} get pods --field-selector=status.phase!=Running -o name 2>/dev/null || true); do
|
for pod in \$(kubectl -n ${namespace} get pods --field-selector=status.phase!=Running -o name 2>/dev/null || true); do
|
||||||
if [ ! -z "\$pod" ]; then
|
if [ ! -z "\$pod" ]; then
|
||||||
echo "=== 실패한 Pod: \$pod ==="
|
echo "=== 실패한 Pod: \$pod ==="
|
||||||
kubectl -n ${namespace} describe \$pod | tail -20
|
kubectl -n ${namespace} describe \$pod | tail -30
|
||||||
|
echo "=== Pod 로그: \$pod ==="
|
||||||
|
kubectl -n ${namespace} logs \$pod --tail=20 || echo "로그를 가져올 수 없습니다"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -8,16 +8,11 @@ data:
|
|||||||
ALLOWED_ORIGINS: ${allowed_origins}
|
ALLOWED_ORIGINS: ${allowed_origins}
|
||||||
JPA_DDL_AUTO: update
|
JPA_DDL_AUTO: update
|
||||||
JPA_SHOW_SQL: 'true'
|
JPA_SHOW_SQL: 'true'
|
||||||
# 🔧 강화된 Actuator 설정
|
# Actuator 설정
|
||||||
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: '*'
|
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: '*'
|
||||||
MANAGEMENT_ENDPOINT_HEALTH_SHOW_DETAILS: always
|
MANAGEMENT_ENDPOINT_HEALTH_SHOW_DETAILS: always
|
||||||
MANAGEMENT_ENDPOINT_HEALTH_ENABLED: 'true'
|
MANAGEMENT_ENDPOINT_HEALTH_ENABLED: 'true'
|
||||||
MANAGEMENT_ENDPOINTS_WEB_BASE_PATH: /actuator
|
MANAGEMENT_ENDPOINTS_WEB_BASE_PATH: /actuator
|
||||||
MANAGEMENT_SERVER_PORT: '8080'
|
|
||||||
# Spring Security 비활성화 (Actuator용)
|
|
||||||
SPRING_AUTOCONFIGURE_EXCLUDE: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
|
|
||||||
# 또는 Management port를 main port와 동일하게
|
|
||||||
MANAGEMENT_SERVER_PORT: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
@ -28,10 +23,10 @@ metadata:
|
|||||||
data:
|
data:
|
||||||
SERVER_PORT: '8081'
|
SERVER_PORT: '8081'
|
||||||
POSTGRES_HOST: ${postgres_host}
|
POSTGRES_HOST: ${postgres_host}
|
||||||
POSTGRES_PORT: ${postgres_port}
|
POSTGRES_PORT: '5432'
|
||||||
POSTGRES_DB: ${postgres_db_ai_recommend}
|
POSTGRES_DB: ${postgres_db_member}
|
||||||
REDIS_HOST: ${redis_host}
|
REDIS_HOST: ${redis_host}
|
||||||
REDIS_PORT: ${redis_port}
|
REDIS_PORT: '6380'
|
||||||
JPA_DDL_AUTO: 'create-drop'
|
JPA_DDL_AUTO: 'create-drop'
|
||||||
JPA_SHOW_SQL: 'true'
|
JPA_SHOW_SQL: 'true'
|
||||||
|
|
||||||
@ -44,10 +39,10 @@ metadata:
|
|||||||
data:
|
data:
|
||||||
SERVER_PORT: '8082'
|
SERVER_PORT: '8082'
|
||||||
POSTGRES_HOST: ${postgres_host}
|
POSTGRES_HOST: ${postgres_host}
|
||||||
POSTGRES_PORT: ${postgres_port}
|
POSTGRES_PORT: '5432'
|
||||||
POSTGRES_DB: ${postgres_db_ai_recommend}
|
POSTGRES_DB: ${postgres_db_store}
|
||||||
REDIS_HOST: ${redis_host}
|
REDIS_HOST: ${redis_host}
|
||||||
REDIS_PORT: ${redis_port}
|
REDIS_PORT: '6380'
|
||||||
JPA_DDL_AUTO: 'create-drop'
|
JPA_DDL_AUTO: 'create-drop'
|
||||||
JPA_SHOW_SQL: 'true'
|
JPA_SHOW_SQL: 'true'
|
||||||
|
|
||||||
@ -60,14 +55,13 @@ metadata:
|
|||||||
data:
|
data:
|
||||||
SERVER_PORT: '8083'
|
SERVER_PORT: '8083'
|
||||||
POSTGRES_HOST: ${postgres_host}
|
POSTGRES_HOST: ${postgres_host}
|
||||||
POSTGRES_PORT: ${postgres_port}
|
POSTGRES_PORT: '5432'
|
||||||
POSTGRES_DB: ${postgres_db_ai_recommend}
|
POSTGRES_DB: ${postgres_db_marketing_content}
|
||||||
REDIS_HOST: ${redis_host}
|
REDIS_HOST: ${redis_host}
|
||||||
REDIS_PORT: ${redis_port}
|
REDIS_PORT: '6380'
|
||||||
JPA_DDL_AUTO: 'create-drop'
|
JPA_DDL_AUTO: 'create-drop'
|
||||||
JPA_SHOW_SQL: 'true'
|
JPA_SHOW_SQL: 'true'
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
@ -77,10 +71,10 @@ metadata:
|
|||||||
data:
|
data:
|
||||||
SERVER_PORT: '8084'
|
SERVER_PORT: '8084'
|
||||||
POSTGRES_HOST: ${postgres_host}
|
POSTGRES_HOST: ${postgres_host}
|
||||||
POSTGRES_PORT: ${postgres_port}
|
POSTGRES_PORT: '5432'
|
||||||
POSTGRES_DB: ${postgres_db_ai_recommend}
|
POSTGRES_DB: ${postgres_db_ai_recommend}
|
||||||
REDIS_HOST: ${redis_host}
|
REDIS_HOST: ${redis_host}
|
||||||
REDIS_PORT: ${redis_port}
|
REDIS_PORT: '6380'
|
||||||
JPA_DDL_AUTO: 'create-drop'
|
JPA_DDL_AUTO: 'create-drop'
|
||||||
JPA_SHOW_SQL: 'true'
|
JPA_SHOW_SQL: 'true'
|
||||||
|
|
||||||
@ -189,35 +183,25 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: member-secret
|
name: member-secret
|
||||||
startupProbe:
|
startupProbe:
|
||||||
exec:
|
tcpSocket:
|
||||||
command:
|
port: 8081
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- "nc -z member-postgresql 5432"
|
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
failureThreshold: 10
|
failureThreshold: 10
|
||||||
# 🔧 개선된 Health Check 설정
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health
|
path: /actuator/health
|
||||||
port: 8081
|
port: 8081
|
||||||
httpHeaders:
|
initialDelaySeconds: 120
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 120 # 2분으로 증가
|
|
||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health/readiness
|
path: /actuator/health
|
||||||
port: 8081
|
port: 8081
|
||||||
httpHeaders:
|
initialDelaySeconds: 60
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 60 # 1분으로 증가
|
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
@ -265,11 +249,8 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: store-secret
|
name: store-secret
|
||||||
startupProbe:
|
startupProbe:
|
||||||
exec:
|
tcpSocket:
|
||||||
command:
|
port: 8082
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- "nc -z store-postgresql 5432"
|
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -278,20 +259,14 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health
|
path: /actuator/health
|
||||||
port: 8082
|
port: 8082
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 120
|
initialDelaySeconds: 120
|
||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health/readiness
|
path: /actuator/health
|
||||||
port: 8082
|
port: 8082
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 60
|
initialDelaySeconds: 60
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -340,11 +315,8 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: marketing-content-secret
|
name: marketing-content-secret
|
||||||
startupProbe:
|
startupProbe:
|
||||||
exec:
|
tcpSocket:
|
||||||
command:
|
port: 8083
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- "nc -z marketing-content-postgresql 5432"
|
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -353,20 +325,14 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health
|
path: /actuator/health
|
||||||
port: 8083
|
port: 8083
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 120
|
initialDelaySeconds: 120
|
||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health/readiness
|
path: /actuator/health
|
||||||
port: 8083
|
port: 8083
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 60
|
initialDelaySeconds: 60
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -415,11 +381,8 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: ai-recommend-secret
|
name: ai-recommend-secret
|
||||||
startupProbe:
|
startupProbe:
|
||||||
exec:
|
tcpSocket:
|
||||||
command:
|
port: 8084
|
||||||
- /bin/sh
|
|
||||||
- -c
|
|
||||||
- "nc -z ai-recommend-postgresql 5432"
|
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -428,20 +391,14 @@ spec:
|
|||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health
|
path: /actuator/health
|
||||||
port: 8084
|
port: 8084
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 120
|
initialDelaySeconds: 120
|
||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
timeoutSeconds: 10
|
timeoutSeconds: 10
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /actuator/health/readiness
|
path: /actuator/health
|
||||||
port: 8084
|
port: 8084
|
||||||
httpHeaders:
|
|
||||||
- name: Accept
|
|
||||||
value: application/json
|
|
||||||
initialDelaySeconds: 60
|
initialDelaySeconds: 60
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user