INIT(app): initial setup
- Initialize project structure - Add base application files
This commit is contained in:
21
deploy/argocd/mas.yaml
Normal file
21
deploy/argocd/mas.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://gitea0213.kro.kr/bluemayne/mas.git
|
||||
targetRevision: HEAD
|
||||
path: deploy/k8s
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: mas
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
|
||||
24
deploy/docker/Dockerfile
Normal file
24
deploy/docker/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 시스템 의존성 설치
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Python 의존성 설치
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 애플리케이션 코드 복사
|
||||
COPY . .
|
||||
|
||||
# Chainlit 포트
|
||||
EXPOSE 8000
|
||||
|
||||
# Chainlit 실행
|
||||
CMD ["chainlit", "run", "chainlit_app.py", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
73
deploy/docker/docker-compose.yml
Normal file
73
deploy/docker/docker-compose.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
mas:
|
||||
build: ../../services/backend
|
||||
container_name: mas
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||
# Groq API (OpenAI-compatible)
|
||||
- GROQ_API_KEY=${GROQ_API_KEY}
|
||||
- GROQ_API_BASE=${GROQ_API_BASE:-https://api.groq.com/openai/v1}
|
||||
# (optional) keep other providers
|
||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
- GOOGLE_API_KEY=${GOOGLE_API_KEY}
|
||||
- DATABASE_URL=postgresql+asyncpg://mas:mas@postgres:5432/mas
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
- ollama
|
||||
volumes:
|
||||
- ../../services/backend:/app
|
||||
networks:
|
||||
- mas-network
|
||||
|
||||
# Ollama (로컬 Qwen 모델)
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
container_name: mas-ollama
|
||||
ports:
|
||||
- "11434:11434"
|
||||
volumes:
|
||||
- ollama-data:/root/.ollama
|
||||
networks:
|
||||
- mas-network
|
||||
|
||||
# PostgreSQL
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: mas-postgres
|
||||
environment:
|
||||
POSTGRES_DB: mas
|
||||
POSTGRES_USER: mas
|
||||
POSTGRES_PASSWORD: mas
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- mas-network
|
||||
|
||||
# Redis
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: mas-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
networks:
|
||||
- mas-network
|
||||
|
||||
volumes:
|
||||
ollama-data:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
|
||||
networks:
|
||||
mas-network:
|
||||
driver: bridge
|
||||
|
||||
73
deploy/k8s/deployment.yaml
Normal file
73
deploy/k8s/deployment.yaml
Normal file
@@ -0,0 +1,73 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: mas
|
||||
labels:
|
||||
app: mas
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mas
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mas
|
||||
spec:
|
||||
containers:
|
||||
- name: mas
|
||||
image: harbor.mayne.vcn/mas/platform:latest
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
env:
|
||||
- name: ANTHROPIC_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mas-api-keys
|
||||
key: anthropic-api-key
|
||||
- name: OPENAI_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mas-api-keys
|
||||
key: openai-api-key
|
||||
- name: GOOGLE_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mas-api-keys
|
||||
key: google-api-key
|
||||
- name: GROQ_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mas-api-keys
|
||||
key: groq-api-key
|
||||
- name: GROQ_API_BASE
|
||||
value: "https://api.groq.com/openai/v1"
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: mas-postgres
|
||||
key: database-url
|
||||
- name: REDIS_URL
|
||||
value: "redis://redis:6379/0"
|
||||
resources:
|
||||
requests:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
limits:
|
||||
memory: "2Gi"
|
||||
cpu: "2000m"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
|
||||
29
deploy/k8s/ingress.yaml
Normal file
29
deploy/k8s/ingress.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: mas
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
nginx.ingress.kubernetes.io/websocket-services: "mas"
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
tls:
|
||||
- hosts:
|
||||
- mas.mayne.vcn
|
||||
secretName: mas-tls
|
||||
rules:
|
||||
- host: mas.mayne.vcn
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: mas
|
||||
port:
|
||||
number: 8000
|
||||
|
||||
13
deploy/k8s/kustomization.yaml
Normal file
13
deploy/k8s/kustomization.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: mas
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- ../vault/mas-api-keys.yaml
|
||||
- ../vault/mas-postgres.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- ingress.yaml
|
||||
|
||||
7
deploy/k8s/namespace.yaml
Normal file
7
deploy/k8s/namespace.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: mas
|
||||
labels:
|
||||
name: mas
|
||||
|
||||
17
deploy/k8s/service.yaml
Normal file
17
deploy/k8s/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mas
|
||||
namespace: mas
|
||||
labels:
|
||||
app: mas
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: mas
|
||||
|
||||
31
deploy/vault/mas-api-keys.yaml
Normal file
31
deploy/vault/mas-api-keys.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: mas-api-keys
|
||||
namespace: mas
|
||||
spec:
|
||||
refreshInterval: 1h
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: vault-backend
|
||||
target:
|
||||
name: mas-api-keys
|
||||
creationPolicy: Owner
|
||||
data:
|
||||
- secretKey: anthropic-api-key
|
||||
remoteRef:
|
||||
key: mas/api-keys
|
||||
property: ANTHROPIC_API_KEY
|
||||
- secretKey: groq-api-key
|
||||
remoteRef:
|
||||
key: mas/api-keys
|
||||
property: GROQ_API_KEY
|
||||
- secretKey: openai-api-key
|
||||
remoteRef:
|
||||
key: mas/api-keys
|
||||
property: OPENAI_API_KEY
|
||||
- secretKey: google-api-key
|
||||
remoteRef:
|
||||
key: mas/api-keys
|
||||
property: GOOGLE_API_KEY
|
||||
|
||||
27
deploy/vault/mas-postgres.yaml
Normal file
27
deploy/vault/mas-postgres.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: external-secrets.io/v1beta1
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: mas-postgres
|
||||
namespace: mas
|
||||
spec:
|
||||
refreshInterval: 1h
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: vault-backend
|
||||
target:
|
||||
name: mas-postgres
|
||||
creationPolicy: Owner
|
||||
data:
|
||||
- secretKey: database-url
|
||||
remoteRef:
|
||||
key: mas/postgres
|
||||
property: DATABASE_URL
|
||||
- secretKey: username
|
||||
remoteRef:
|
||||
key: mas/postgres
|
||||
property: USERNAME
|
||||
- secretKey: password
|
||||
remoteRef:
|
||||
key: mas/postgres
|
||||
property: PASSWORD
|
||||
|
||||
Reference in New Issue
Block a user