Initialize Compose Launcher source and deployment

This commit is contained in:
tongtong committed 2026-11-26 02:34:19 +08:00
commit 12a8c24441
77 files changed
+9594

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
ENV TZ=Asia/Shanghai \
JAVA_TOOL_OPTIONS="-Xms64m -Xmx192m -XX:MaxMetaspaceSize=128m -XX:+UseSerialGC -XX:+ExitOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom"
COPY target/vibe-launcher-backend.jar /app/app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
+95
View File
@@ -0,0 +1,95 @@
apiVersion: v1
kind: Namespace
metadata:
name: vibe-launcher
labels:
name: vibe-launcher
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: vibe-launcher-backend
namespace: vibe-launcher
labels:
app: vibe-launcher-backend
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: vibe-launcher-backend
template:
metadata:
labels:
app: vibe-launcher-backend
spec:
containers:
- name: server
image: docker.io/library/vibe-launcher-backend:1.1.0-deploy3
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: TZ
value: Asia/Shanghai
- name: HOST
value: 0.0.0.0
- name: PORT
value: "8080"
- name: LAYOUT_DB
value: /data/layouts.sqlite
envFrom:
- secretRef:
name: vibe-launcher-auth
volumeMounts:
- name: data
mountPath: /data
resources:
requests:
cpu: 100m
memory: 192Mi
limits:
cpu: 750m
memory: 384Mi
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 60
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 5
volumes:
- name: data
hostPath:
path: /opt/vibe-launcher/data
type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
name: vibe-launcher-backend
namespace: vibe-launcher
labels:
app: vibe-launcher-backend
spec:
type: NodePort
selector:
app: vibe-launcher-backend
ports:
- name: http
port: 8080
targetPort: http
nodePort: 30830
protocol: TCP
+22
View File
@@ -0,0 +1,22 @@
# Vibe Launcher 后端(k3s vibe-launcher/vibe-launcher-backend, NodePort 30830)
# 挂载点:https://api.ttstd.com/launcher/(灰云直连源站,不走 Cloudflare)
# 用法:放到 /etc/nginx/snippets/launcher-path.conf,在 api.ttstd.com 的 443 server 块内 include
# 以 /launcher/ 前缀反代,proxy_pass 末尾斜杠会剥掉前缀,后端仍收到 /api/... 与 /
location = /launcher {
return 301 /launcher/;
}
location ^~ /launcher/ {
client_max_body_size 2m;
proxy_pass http://127.0.0.1:30830/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 10s;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_buffering off;
add_header Cache-Control "no-store" always;
}
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
set -euo pipefail
BASE=${BASE:-https://api.ttstd.com/launcher}
AUTH_FILE=${AUTH_FILE:-/opt/vibe-launcher/auth.env}
. "$AUTH_FILE"
echo "== healthz =="
curl -fsS "$BASE/healthz"; echo
echo "== device layout =="
curl -fsS -H "Authorization: Bearer $DEVICE_TOKEN" -D /tmp/launcher-device.headers \
-o /tmp/launcher-device.json "$BASE/api/layout"
grep -i '^X-Layout-Revision:' /tmp/launcher-device.headers
echo "== admin layout =="
curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" -D /tmp/launcher-admin.headers \
-o /tmp/launcher-admin.json "$BASE/api/admin/layout"
TAG=$(sed -n 's/^[Ee][Tt][Aa][Gg]: //p' /tmp/launcher-admin.headers | tr -d '\r')
echo "ETag=$TAG"
echo "== missing If-Match =="
curl -sS -o /tmp/launcher-428.json -w '%{http_code}\n' -X PUT \
-H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \
--data @/tmp/launcher-admin.json "$BASE/api/admin/layout"
cat /tmp/launcher-428.json; echo
echo "== invalid layout =="
curl -sS -o /tmp/launcher-422.json -w '%{http_code}\n' -X PUT \
-H "Authorization: Bearer $ADMIN_TOKEN" -H "If-Match: $TAG" \
-H 'Content-Type: application/json' \
--data '{"schemaVersion":2,"pages":[]}' "$BASE/api/admin/layout"
head -c 200 /tmp/launcher-422.json; echo
echo "== history =="
curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" "$BASE/api/admin/history"; echo