video-shuoshan/k8s/backend-deployment.yaml
zyc 8ef3d17553
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m57s
Integrate Log Center for error reporting
- Backend: DRF custom exception handler → Log Center (async, non-blocking)
- Frontend: global error handlers + axios 5xx interceptor → Log Center
- CI/CD: failure step reports build/deploy errors with actual logs
- K8S: add LOG_CENTER env vars to backend deployment
- Registered projects: video_backend, video_web
2026-03-13 10:35:49 +08:00

88 lines
2.1 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: video-backend
labels:
app: video-backend
spec:
replicas: 1
selector:
matchLabels:
app: video-backend
template:
metadata:
labels:
app: video-backend
spec:
containers:
- name: video-backend
image: ${CI_REGISTRY_IMAGE}/video-backend:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
env:
- name: USE_MYSQL
value: "true"
- name: DJANGO_DEBUG
value: "False"
- name: DJANGO_ALLOWED_HOSTS
value: "*"
- name: DJANGO_SECRET_KEY
value: "video-huoshan-prod-secret-key-2026"
# Database (Aliyun RDS)
- name: DB_HOST
value: "rm-7xv1uaw910558p1788o.mysql.rds.aliyuncs.com"
- name: DB_NAME
value: "video_auto"
- name: DB_USER
value: "ai_video"
- name: DB_PASSWORD
value: "JogNQdtrd3WY8CBCAiYfYEGx"
- name: DB_PORT
value: "3306"
# CORS
- name: CORS_ALLOWED_ORIGINS
value: "https://video-huoshan-web.airlabs.art"
# Log Center
- name: LOG_CENTER_URL
value: "https://qiyuan-log-center-api.airlabs.art"
- name: LOG_CENTER_ENABLED
value: "true"
- name: ENVIRONMENT
value: "production"
livenessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "1024Mi"
cpu: "1000m"
---
apiVersion: v1
kind: Service
metadata:
name: video-backend
spec:
selector:
app: video-backend
ports:
- protocol: TCP
port: 8000
targetPort: 8000