app #2 piano-sheet: 钢琴谱管理 / 阅读,piano.famzheng.me
deploy cube / build-and-deploy (push) Successful in 1m8s
deploy piano-sheet / build-and-deploy (push) Failing after 1m38s
deploy simpleasm / build-and-deploy (push) Successful in 1m22s

后端 axum + sqlite,图片直接 BLOB 存进 pages 表(单张 ≤ 10MB / 单
谱 ≤ 64 页),5 个 endpoint:multipart upload、列表、详情、单页图片
(带 immutable cache header)+ healthz。

前端 vue3 + pinia + vue-router,3 个视图:列表(卡片网格 + 首页缩
略)、上传(拖拽 + 顺序预览)、阅读(全屏,左右点按 / 键盘 / 拖
拽进度条翻页,2.5s 自动隐藏 chrome)。视图状态走 URL(reader 的
当前页是 ?page=N)。

部署:cube-piano-sheet ns + 10Gi PVC + traefik ingress + 一条
buffering middleware 把 body 上限抬到 700MB。镜像 < 20MB(scratch
+ musl 静态)。
This commit was merged in pull request #1.
This commit is contained in:
Fam Zheng
2026-05-05 09:29:02 +01:00
parent e81f44662a
commit 28713e489f
23 changed files with 2616 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: piano-sheet
namespace: cube-piano-sheet
labels:
app: piano-sheet
spec:
replicas: 1
strategy:
# PVC 是 RWOrolling 上线时新旧 pod 抢 PVC 会卡住,直接 Recreate
type: Recreate
selector:
matchLabels:
app: piano-sheet
template:
metadata:
labels:
app: piano-sheet
spec:
imagePullSecrets:
- name: registry-creds
containers:
- name: piano-sheet
image: registry.famzheng.me/mochi/piano-sheet:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: http
env:
- name: DB_PATH
value: /data/app.db
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: 500m
memory: 256Mi
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
persistentVolumeClaim:
claimName: piano-sheet-data
+30
View File
@@ -0,0 +1,30 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: piano-sheet
namespace: cube-piano-sheet
annotations:
# 上传整组图片可能 ~600MB,调高 traefik 默认上限
traefik.ingress.kubernetes.io/router.middlewares: cube-piano-sheet-bodylimit@kubernetescrd
spec:
ingressClassName: traefik
rules:
- host: piano.famzheng.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: piano-sheet
port:
number: 80
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: bodylimit
namespace: cube-piano-sheet
spec:
buffering:
maxRequestBodyBytes: 700000000
+4
View File
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: cube-piano-sheet
+13
View File
@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: piano-sheet-data
namespace: cube-piano-sheet
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
# 图片直存 sqlite,留出宽裕空间
storage: 10Gi
# storageClassName 留空 → 走 k3s 默认 local-pathhostPath,单节点足够)
+12
View File
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: piano-sheet
namespace: cube-piano-sheet
spec:
selector:
app: piano-sheet
ports:
- name: http
port: 80
targetPort: 8080