Files
cube/apps/music/k8s/all.yaml
T
Fam Zheng c0d6e37325
deploy cube / build-and-deploy (push) Successful in 1m8s
deploy music / build-and-deploy (push) Successful in 2m15s
deploy simpleasm / build-and-deploy (push) Successful in 1m25s
music: 加 LLM chat、笔记 tab 化、歌单/标签
chat(右边栏):
- chat_messages 表 per piece,OpenAI 兼容 /v1/chat/completions stream:true
- backend SSE forward delta,结束时落库 user + assistant
- system prompt 注入曲目 (title/artist/category/notes/lyrics 截 4KB)
- 网关同 mochi/config.yaml: gemma-4-31b-it on 3.135.65.204:8848,token 走 k8s Secret chat-creds
- reqwest client 去掉全局 timeout(chat 流可能跑很久),chord sidecar 调用改 per-request timeout

笔记: 从右 sidebar 移到独立 tab "笔记"

歌单 + tag:
- playlists / playlist_pieces / tags / piece_tags 表,CRUD API
- PATCH piece 接 tags 数组(按名字 upsert)
- list pieces 加 ?tag/?playlist 过滤 + 返回 tags 列表
- 顶 bar filterbar:歌单 + 标签 chip 切换;"+ 新歌单" prompt 创建
- EditView 加 tag 编辑(chip + 自动补全)+ 加入/移除歌单
2026-05-10 14:51:53 +01:00

167 lines
4.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 是 RWOrolling 上线时新旧 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
- name: CHAT_GATEWAY
value: http://3.135.65.204:8848/v1
- name: CHAT_MODEL
value: gemma-4-31b-it
- name: CHAT_TOKEN
valueFrom:
secretKeyRef:
name: chat-creds
key: token
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:
# 单文件最大 1GiBmain.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