Sprint 6: report review workflow, CI/K8s, and client tabs.
Add coach review APIs, pose calibration thresholds, Gitea CI, Kubernetes skeleton, H5 practice page, and mini program tab bar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Kubernetes 部署骨架(Sprint 6)
|
||||
|
||||
## 前置
|
||||
|
||||
- 集群已安装 Ingress Controller
|
||||
- 镜像推送到私有 Registry
|
||||
- MySQL / Redis / MinIO 可用(云 RDS 或集群内 Helm)
|
||||
|
||||
## 部署
|
||||
|
||||
```bash
|
||||
# 1. 创建 Secret(勿提交明文)
|
||||
kubectl create secret generic happy-up-api-secret \
|
||||
--from-literal=DATABASE_URL='mysql+pymysql://...' \
|
||||
--from-literal=REDIS_URL='redis://...' \
|
||||
--from-literal=JWT_SECRET='...' \
|
||||
--from-literal=OSS_ACCESS_KEY='...' \
|
||||
--from-literal=OSS_SECRET_KEY='...'
|
||||
|
||||
# 2. 应用清单
|
||||
kubectl apply -f deploy/k8s/api.yaml
|
||||
|
||||
# 3. 验证
|
||||
kubectl rollout status deployment/happy-up-api
|
||||
curl https://api.happy-up.example.com/health
|
||||
```
|
||||
|
||||
## Worker
|
||||
|
||||
分析 Worker 可单独 Deployment,环境变量与 API 相同,`command: ["python", "-m", "app.worker"]`。
|
||||
|
||||
## CI
|
||||
|
||||
Gitea Actions 见 `.gitea/workflows/ci.yaml`,推送 main 自动跑 API 测试与 Web 构建。
|
||||
@@ -0,0 +1,84 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: happy-up-api
|
||||
labels:
|
||||
app: happy-up-api
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: happy-up-api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: happy-up-api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: registry.example.com/happy-up/api:latest
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: happy-up-api-config
|
||||
- secretRef:
|
||||
name: happy-up-api-secret
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 8000
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 512Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: happy-up-api
|
||||
spec:
|
||||
selector:
|
||||
app: happy-up-api
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8000
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: happy-up-api-config
|
||||
data:
|
||||
APP_ENV: production
|
||||
APP_DEBUG: "false"
|
||||
ANALYSIS_INLINE_PROCESS: "false"
|
||||
OSS_ENABLED: "true"
|
||||
OSS_PROVIDER: aliyun
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: happy-up-api
|
||||
spec:
|
||||
rules:
|
||||
- host: api.happy-up.example.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: happy-up-api
|
||||
port:
|
||||
number: 80
|
||||
Reference in New Issue
Block a user