video-shuoshan/k8s/backend-deployment.yaml
zyc f42eb64e25
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m13s
Add CI/CD pipeline and K8S deployment
- Backend/Web Dockerfiles with multi-stage builds
- K8S deployments, services, and ingress for both domains
- Gitea Actions workflow: build → push to SWR → deploy to K3s
- Health check endpoint (/healthz/)
- CORS env var support for production domains
- Nginx reverse proxy for frontend → backend API

Domains:
  - video-huoshan-api.airlabs.art (backend)
  - video-huoshan-web.airlabs.art (frontend)
2026-03-13 10:24:31 +08:00

81 lines
1.9 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"
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