✅ 已完成功能: - 后端 Go 服务 (认证/授权/检测) - JWT 认证 + RBAC 权限控制 - 登录速率限制 (5 次失败锁定 15 分钟) - 密码强度校验 - 敏感数据脱敏 - Vue3 管理后台 - 路由守卫 - 删除二次确认 📦 部署配置: - Docker Compose 生产环境配置 - MySQL/Redis/MongoDB 数据库 - Nginx 前端服务 - 强密码安全配置 ⚠️ P2 待办 (下次迭代): - 学生/检测/预警等业务模块实现 - 错误处理统一化 - 缓存策略优化 - 日志分级 📍 生产环境: - 服务器:192.168.15.222 - 管理后台:http://192.168.15.222:8081 - API 服务:http://192.168.15.222:8080 2026-03-29 上线部署完成
102 lines
2.2 KiB
YAML
102 lines
2.2 KiB
YAML
# AI近视防控系统 - Kubernetes部署配置
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ai-myopia-prevention-backend
|
|
namespace: ai-myopia
|
|
labels:
|
|
app: ai-myopia-prevention-backend
|
|
spec:
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app: ai-myopia-prevention-backend
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: ai-myopia-prevention-backend
|
|
spec:
|
|
containers:
|
|
- name: backend
|
|
image: ai-myopia-prevention:latest
|
|
ports:
|
|
- containerPort: 8080
|
|
env:
|
|
- name: DB_HOST
|
|
value: "mysql-service"
|
|
- name: DB_PORT
|
|
value: "3306"
|
|
- name: DB_USER
|
|
value: "root"
|
|
- name: DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: db-secret
|
|
key: password
|
|
- name: DB_NAME
|
|
value: "myopia_db"
|
|
- name: REDIS_HOST
|
|
value: "redis-service"
|
|
- name: REDIS_PORT
|
|
value: "6379"
|
|
- name: JWT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: jwt-secret
|
|
key: secret
|
|
resources:
|
|
requests:
|
|
memory: "256Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "512Mi"
|
|
cpu: "500m"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8080
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 8080
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: backend-service
|
|
namespace: ai-myopia
|
|
spec:
|
|
selector:
|
|
app: ai-myopia-prevention-backend
|
|
ports:
|
|
- protocol: TCP
|
|
port: 80
|
|
targetPort: 8080
|
|
type: LoadBalancer
|
|
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: backend-ingress
|
|
namespace: ai-myopia
|
|
annotations:
|
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
|
spec:
|
|
rules:
|
|
- host: api.myopia-prevention.com
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: backend-service
|
|
port:
|
|
number: 80 |