release
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: vector-api-config
|
||||
data:
|
||||
# 🔧 기존 애플리케이션 설정 (유지)
|
||||
APP_TITLE: "음식점 Vector DB 구축 서비스"
|
||||
APP_VERSION: "1.0.0"
|
||||
APP_DESCRIPTION: "소상공인을 위한 AI 기반 경쟁업체 분석 및 액션 추천 시스템"
|
||||
|
||||
# 🔧 기존 서버 설정 (유지)
|
||||
HOST: "0.0.0.0"
|
||||
PORT: "8000"
|
||||
LOG_LEVEL: "debug" # 디버깅을 위해 debug로 변경
|
||||
|
||||
# 🔧 기존 Restaurant API 설정 (K8s 환경, 유지)
|
||||
RESTAURANT_API_HOST: "restaurant-api-service"
|
||||
RESTAURANT_API_PORT: "80"
|
||||
|
||||
# 🔧 기존 Review API 설정 (K8s 환경, 유지)
|
||||
REVIEW_API_HOST: "kakao-review-api-service"
|
||||
REVIEW_API_PORT: "80"
|
||||
|
||||
# 🔧 기존 Claude API 설정 (유지)
|
||||
CLAUDE_MODEL: "claude-sonnet-4-20250514"
|
||||
|
||||
# 🔧 기존 Vector DB 설정 (유지)
|
||||
VECTOR_DB_PATH: "/app/vectordb"
|
||||
VECTOR_DB_COLLECTION: "restaurant_reviews"
|
||||
EMBEDDING_MODEL: "sentence-transformers/all-MiniLM-L6-v2"
|
||||
|
||||
# 🔧 기존 데이터 수집 설정 (유지)
|
||||
MAX_RESTAURANTS_PER_CATEGORY: "50"
|
||||
MAX_REVIEWS_PER_RESTAURANT: "100"
|
||||
REQUEST_DELAY: "0.1"
|
||||
REQUEST_TIMEOUT: "600"
|
||||
|
||||
# 🆕 ChromaDB 최신 버전 호환 설정 추가
|
||||
CHROMA_DB_IMPL: "duckdb+parquet" # SQLite 대신 DuckDB 사용
|
||||
ALLOW_RESET: "True"
|
||||
ANONYMIZED_TELEMETRY: "False"
|
||||
|
||||
# 🆕 Python 최적화 설정
|
||||
PYTHONUNBUFFERED: "1"
|
||||
PYTHONDONTWRITEBYTECODE: "1"
|
||||
|
||||
# 🆕 캐시 디렉토리 설정
|
||||
HF_HUB_CACHE: "/app/.cache/huggingface"
|
||||
TRANSFORMERS_CACHE: "/app/.cache/transformers"
|
||||
|
||||
# 🆕 FastAPI 설정
|
||||
FASTAPI_ENV: "production"
|
||||
|
||||
# 🆕 Uvicorn 설정
|
||||
UVICORN_HOST: "0.0.0.0"
|
||||
UVICORN_PORT: "8000"
|
||||
UVICORN_LOG_LEVEL: "debug"
|
||||
UVICORN_ACCESS_LOG: "true"
|
||||
|
||||
# 🆕 타임아웃 설정
|
||||
STARTUP_TIMEOUT: "300" # 5분
|
||||
SHUTDOWN_TIMEOUT: "30" # 30초
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
# deployment/manifests/deployment.yaml.fixed
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: vector-api
|
||||
labels:
|
||||
app: vector-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: vector-api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: vector-api
|
||||
spec:
|
||||
# 🔧 볼륨 권한 설정을 위한 initContainer
|
||||
initContainers:
|
||||
- name: volume-permissions
|
||||
image: busybox:1.35
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "=== 볼륨 권한 설정 시작 ==="
|
||||
mkdir -p /app/vectordb
|
||||
chown -R 1000:1000 /app/vectordb
|
||||
chmod -R 755 /app/vectordb
|
||||
echo "=== 볼륨 권한 설정 완료 ==="
|
||||
volumeMounts:
|
||||
- name: vector-db-storage
|
||||
mountPath: /app/vectordb
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
|
||||
containers:
|
||||
- name: vector-api
|
||||
image: acrdigitalgarage03.azurecr.io/vector-api:latest
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
|
||||
# 🔧 보안 컨텍스트
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: false
|
||||
|
||||
# 🔧 리소스 설정
|
||||
resources:
|
||||
requests:
|
||||
memory: "4Gi"
|
||||
cpu: "1000m"
|
||||
limits:
|
||||
memory: "8Gi"
|
||||
cpu: "2000m"
|
||||
|
||||
# 🏥 헬스체크 설정
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 120
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 15
|
||||
failureThreshold: 3
|
||||
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 3
|
||||
|
||||
# 📂 볼륨 마운트
|
||||
volumeMounts:
|
||||
- name: vector-db-storage
|
||||
mountPath: /app/vectordb
|
||||
|
||||
# ConfigMap 환경 변수
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: vector-api-config
|
||||
|
||||
# 🌍 환경변수 설정 (인증 필드 제거)
|
||||
env:
|
||||
- name: PYTHONUNBUFFERED
|
||||
value: "1"
|
||||
- name: PYTHONDONTWRITEBYTECODE
|
||||
value: "1"
|
||||
# 🔧 ChromaDB 기본 설정 (인증 필드 제거)
|
||||
- name: ANONYMIZED_TELEMETRY
|
||||
value: "False"
|
||||
- name: CHROMA_DB_IMPL
|
||||
value: "duckdb+parquet"
|
||||
- name: ALLOW_RESET
|
||||
value: "True"
|
||||
# 🔧 로그 레벨
|
||||
- name: LOG_LEVEL
|
||||
value: "info"
|
||||
# 🔧 Claude API (ConfigMap에서 가져오기)
|
||||
- name: CLAUDE_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: vector-api-secret
|
||||
key: CLAUDE_API_KEY
|
||||
- name: CLAUDE_MODEL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: vector-api-config
|
||||
key: CLAUDE_MODEL
|
||||
# 🔧 기타 설정 (ConfigMap에서 가져오기)
|
||||
- name: APP_TITLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: vector-api-config
|
||||
key: APP_TITLE
|
||||
- name: APP_VERSION
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: vector-api-config
|
||||
key: APP_VERSION
|
||||
|
||||
# 📦 볼륨 설정
|
||||
volumes:
|
||||
- name: vector-db-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: vector-db-pvc
|
||||
|
||||
# 🔐 이미지 Pull Secret
|
||||
imagePullSecrets:
|
||||
- name: acr-secret
|
||||
|
||||
# 🎯 노드 선택 및 배치 설정
|
||||
nodeSelector:
|
||||
agentpool: aipool
|
||||
|
||||
tolerations:
|
||||
- key: "dedicated"
|
||||
operator: "Equal"
|
||||
value: "aipool"
|
||||
effect: "NoSchedule"
|
||||
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- vector-api
|
||||
topologyKey: kubernetes.io/hostname
|
||||
|
||||
restartPolicy: Always
|
||||
dnsPolicy: ClusterFirst
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# deployment/manifests/ingress.yaml
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: vector-api-ingress
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "10m"
|
||||
# Vector DB 구축 시간을 고려한 긴 타임아웃 설정
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "1800"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "1800"
|
||||
nginx.ingress.kubernetes.io/client-body-timeout: "1800"
|
||||
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
|
||||
# CORS 설정
|
||||
nginx.ingress.kubernetes.io/enable-cors: "true"
|
||||
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
|
||||
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, OPTIONS"
|
||||
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
# 환경에 맞게 호스트명 수정 필요
|
||||
- host: vector-api.20.249.191.180.nip.io
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: vector-api-service
|
||||
port:
|
||||
number: 80
|
||||
# TLS 설정 (HTTPS 필요시 주석 해제)
|
||||
# tls:
|
||||
# - hosts:
|
||||
# - vector-api.example.com
|
||||
# secretName: vector-api-tls
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# deployment/manifests/pvc.yaml
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: vector-db-pvc
|
||||
labels:
|
||||
app: vector-api
|
||||
component: storage
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: managed
|
||||
# 선택적: 특정 PV에 바인딩하려는 경우
|
||||
# volumeName: vector-db-pv
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# deployment/manifests/secret.yaml
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: vector-api-secret
|
||||
type: Opaque
|
||||
data:
|
||||
# Claude API 키 (Base64 인코딩 필요)
|
||||
# echo -n "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" | base64
|
||||
CLAUDE_API_KEY: c2stYW50LWFwaTAzLUVGM1ZocXJJUkVmY3hOa1V3ZkdENDluZ0k1SGZhcTUwd3c4WGZMd0psckR6akczdzNPSHRYTzFBZEltczJuRng2cmc4bk84cWhnMnFwUU01WFJnLTQ1SDdIQUFB
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# deployment/manifests/service.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: vector-api-service
|
||||
labels:
|
||||
app: vector-api
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8000
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: vector-api
|
||||
|
||||
Reference in New Issue
Block a user