e111398157
复刻 ../guitar 的功能: - 新加 chord-fetcher sidecar(python 3.11 + chromium + selenium),跟 main 同 pod 共享 PVC - yopu.py v2:搜「和弦谱」→ 进 view → 选 谱面样式=功能谱 + 和弦样式=级数名 → 截 sheet-container → PIL 裁白边 - music backend 加 POST /api/pieces/:id/chord/fetch + GET /chord/status,转发 sidecar 并把 png import 成 image attachment role=chord - 前端 chord tab 在没图时显示「自动抓取」按钮,点了 polling 状态、完成后刷新 - CI build 两个 image(music + music-chord),rollout 同步切版本
158 lines
3.7 KiB
YAML
158 lines
3.7 KiB
YAML
apiVersion: v1
|
||
kind: Namespace
|
||
metadata:
|
||
name: cube-music
|
||
---
|
||
apiVersion: v1
|
||
kind: PersistentVolumeClaim
|
||
metadata:
|
||
name: music-data
|
||
namespace: cube-music
|
||
spec:
|
||
accessModes:
|
||
- ReadWriteOnce
|
||
resources:
|
||
requests:
|
||
# video / audio 大附件 + 初始 guitar 曲库(~? GB),50Gi 起步
|
||
storage: 50Gi
|
||
# storageClassName 留空 → k3s 默认 local-path
|
||
---
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: music
|
||
namespace: cube-music
|
||
labels:
|
||
app: music
|
||
spec:
|
||
replicas: 1
|
||
strategy:
|
||
# PVC 是 RWO,rolling 上线时新旧 pod 抢 PVC 会卡住,直接 Recreate
|
||
type: Recreate
|
||
selector:
|
||
matchLabels:
|
||
app: music
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: music
|
||
spec:
|
||
imagePullSecrets:
|
||
- name: registry-creds
|
||
containers:
|
||
- name: music
|
||
image: registry.famzheng.me/mochi/music:latest
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- containerPort: 8080
|
||
name: http
|
||
env:
|
||
- name: DB_PATH
|
||
value: /data/app.db
|
||
- name: BLOBS_DIR
|
||
value: /data/blobs
|
||
- name: CHORD_URL
|
||
value: http://localhost:8001
|
||
readinessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: http
|
||
initialDelaySeconds: 1
|
||
periodSeconds: 5
|
||
livenessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: http
|
||
initialDelaySeconds: 5
|
||
periodSeconds: 15
|
||
resources:
|
||
requests:
|
||
cpu: 10m
|
||
memory: 32Mi
|
||
limits:
|
||
cpu: 1000m
|
||
memory: 512Mi
|
||
volumeMounts:
|
||
- name: data
|
||
mountPath: /data
|
||
- name: chord-fetcher
|
||
image: registry.famzheng.me/mochi/music-chord:latest
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- containerPort: 8001
|
||
name: chord
|
||
env:
|
||
- name: CHORD_OUT_DIR
|
||
value: /data/chord-fetch
|
||
readinessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: chord
|
||
initialDelaySeconds: 3
|
||
periodSeconds: 10
|
||
livenessProbe:
|
||
httpGet:
|
||
path: /healthz
|
||
port: chord
|
||
initialDelaySeconds: 30
|
||
periodSeconds: 30
|
||
resources:
|
||
requests:
|
||
cpu: 50m
|
||
memory: 256Mi
|
||
# chromium 内存峰值很容易飙到 ~600MB
|
||
limits:
|
||
cpu: 2000m
|
||
memory: 1Gi
|
||
volumeMounts:
|
||
- name: data
|
||
mountPath: /data
|
||
volumes:
|
||
- name: data
|
||
persistentVolumeClaim:
|
||
claimName: music-data
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: music
|
||
namespace: cube-music
|
||
spec:
|
||
selector:
|
||
app: music
|
||
ports:
|
||
- name: http
|
||
port: 80
|
||
targetPort: 8080
|
||
---
|
||
apiVersion: traefik.io/v1alpha1
|
||
kind: Middleware
|
||
metadata:
|
||
name: bodylimit
|
||
namespace: cube-music
|
||
spec:
|
||
buffering:
|
||
# 单文件最大 1GiB(main.rs 里 SINGLE_FILE_BYTES),multipart 总和留 5GiB 余量
|
||
maxRequestBodyBytes: 5368709120
|
||
---
|
||
apiVersion: networking.k8s.io/v1
|
||
kind: Ingress
|
||
metadata:
|
||
name: music
|
||
namespace: cube-music
|
||
annotations:
|
||
traefik.ingress.kubernetes.io/router.middlewares: cube-music-bodylimit@kubernetescrd
|
||
spec:
|
||
ingressClassName: traefik
|
||
rules:
|
||
- host: music.famzheng.me
|
||
http:
|
||
paths:
|
||
- path: /
|
||
pathType: Prefix
|
||
backend:
|
||
service:
|
||
name: music
|
||
port:
|
||
number: 80
|