feat(chat): add edge cache labels for chat static assets

This commit is contained in:
2026-08-12 18:22:20 +08:00
parent 5b84988789
commit d1d50d722c
+56 -7
View File
@@ -40,6 +40,48 @@ services:
networks:
- homelab_net
ollama-host-bridge:
image: node:24-alpine
container_name: xiteng-ollama-host-bridge
restart: unless-stopped
network_mode: host
command: ["node", "/app/proxy-bridge.mjs"]
environment:
BRIDGE_MODE: host
BRIDGE_SOCKET: /run/provider-proxy/ollama.sock
UPSTREAM_HOST: 127.0.0.1
UPSTREAM_PORT: "11434"
volumes:
- ./proxy-bridge.mjs:/app/proxy-bridge.mjs:ro
- ./run:/run/provider-proxy
security_opt:
- no-new-privileges:true
ollama-provider-bridge:
image: node:24-alpine
container_name: xiteng-ollama-provider-bridge
restart: unless-stopped
command: ["node", "/app/proxy-bridge.mjs"]
environment:
BRIDGE_MODE: network
BRIDGE_SOCKET: /run/provider-proxy/ollama.sock
LISTEN_PORT: "11434"
volumes:
- ./proxy-bridge.mjs:/app/proxy-bridge.mjs:ro
- ./run:/run/provider-proxy
depends_on:
- ollama-host-bridge
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:11434/api/tags').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
interval: 15s
timeout: 5s
retries: 3
start_period: 5s
networks:
- homelab_net
chat:
build:
context: .
@@ -57,7 +99,7 @@ services:
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/api/health"]
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/chat/api/health"]
interval: 15s
timeout: 5s
retries: 3
@@ -71,32 +113,39 @@ services:
- "traefik.http.middlewares.xiteng-chat-auth.forwardauth.address=http://authentik-outpost:9000/outpost.goauthentik.io/auth/traefik"
- "traefik.http.middlewares.xiteng-chat-auth.forwardauth.trustForwardHeader=true"
- "traefik.http.middlewares.xiteng-chat-auth.forwardauth.authResponseHeaders=X-authentik-username,X-authentik-email,X-authentik-name,X-authentik-uid"
- "traefik.http.routers.xiteng-chat.rule=Host(`chat.xiteng.site`)"
- "traefik.http.routers.xiteng-chat.rule=Host(`xiteng.site`) && (Path(`/chat`) || PathPrefix(`/chat/`))"
- "traefik.http.routers.xiteng-chat.entrypoints=websecure"
- "traefik.http.routers.xiteng-chat.tls=true"
- "traefik.http.routers.xiteng-chat.tls.certresolver=cfresolver"
- "traefik.http.routers.xiteng-chat.service=xiteng-chat"
- "traefik.http.routers.xiteng-chat.middlewares=xiteng-chat-scheme,xiteng-chat-auth"
- "traefik.http.routers.xiteng-chat-http.rule=Host(`chat.xiteng.site`)"
- "traefik.http.routers.xiteng-chat.priority=300"
- "traefik.http.routers.xiteng-chat-http.rule=Host(`xiteng.site`) && (Path(`/chat`) || PathPrefix(`/chat/`))"
- "traefik.http.routers.xiteng-chat-http.entrypoints=web"
- "traefik.http.routers.xiteng-chat-http.service=xiteng-chat"
- "traefik.http.routers.xiteng-chat-http.middlewares=xiteng-chat-scheme,xiteng-chat-auth"
- "traefik.http.routers.xiteng-chat-http.priority=300"
- "xiteng.site.cache.chat.enabled=true"
- "xiteng.site.cache.chat.routers=xiteng-chat,xiteng-chat-http"
- "xiteng.site.cache.chat.paths=/chat/assets/,/chat/icons/"
- "xiteng.site.cache.chat.edge-ttl=604800"
- "xiteng.site.cache.chat.stale-while-revalidate=86400"
- "xiteng.site.component.chat.enabled=true"
- "xiteng.site.component.chat.name=Xiteng Chat"
- "xiteng.site.component.chat.description=基于 assistant-ui 与个人 Key Vault 的轻量 AI 对话界面。"
- "xiteng.site.component.chat.description=基于 Vanilla TypeScript、Bun 与个人 Key Vault 的轻量 AI 对话界面。"
- "xiteng.site.component.chat.section=services"
- "xiteng.site.component.chat.category=AI"
- "xiteng.site.component.chat.url=https://chat.xiteng.site"
- "xiteng.site.component.chat.url=https://xiteng.site/chat/"
- "xiteng.site.component.chat.access=sso"
- "xiteng.site.component.chat.access-label=需要登录"
- "xiteng.site.component.chat.icon=AI"
- "xiteng.site.component.chat.icon-url=https://xiteng.site/icons/services/chat.svg"
- "xiteng.site.component.chat.accent=blue"
- "xiteng.site.component.chat.order=190"
- "xiteng.site.component.chat.navigation=new-tab"
- "xiteng.site.component.chat.navigation=same-tab"
- "xiteng.site.component.chat.portal-link=embedded"
- "xiteng.site.component.chat.monitor.enabled=true"
- "xiteng.site.component.chat.monitor.url=http://xiteng-chat:3000/api/health"
- "xiteng.site.component.chat.monitor.url=http://xiteng-chat:3000/chat/api/health"
networks:
homelab_net: