Add music bot for self-hosted Stoat with web control panel
Plays audio into Stoat voice channels over LiveKit and exposes the same player through both chat commands and a browser panel, so the two never drift apart: everything routes through a single MusicManager. - core: per-server GuildPlayer (queue, loop, shuffle, seek, volume, idle auto-leave) driving revoice.js/@livekit/rtc-node and ffmpeg - sources: yt-dlp for YouTube/SoundCloud, direct media URLs and internet radio, optional local library with path-traversal guards - bot: 18 chat commands with aliases, plus !panel one-time login links - api: Fastify REST + WebSocket, sessions authenticated against the instance's own /auth/session/login (TOTP supported), permissions re-checked against Stoat membership and roles on every request - web: React panel with search, queue editing, seek and volume - deploy: Dockerfile, compose.override.yml and Caddyfile snippets for dropping the service into an existing /opt/stoat stack Verified with npm run typecheck, both builds, and scripts/smoke-api.mjs (9 API checks). Voice playback itself needs a live instance to test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d9d0e9f6bf
commit
a9b7ccdd16
+48
@@ -0,0 +1,48 @@
|
||||
# --- panel bundle -----------------------------------------------------------
|
||||
FROM node:22-bookworm-slim AS web
|
||||
WORKDIR /app/web
|
||||
COPY web/package.json web/package-lock.json* ./
|
||||
RUN npm install --no-audit --no-fund
|
||||
COPY web/ ./
|
||||
RUN npm run build
|
||||
|
||||
# --- server dependencies ----------------------------------------------------
|
||||
# glibc image on purpose: @livekit/rtc-node ships prebuilt glibc binaries.
|
||||
FROM node:22-bookworm-slim AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install --omit=dev --no-audit --no-fund
|
||||
|
||||
FROM node:22-bookworm-slim AS build
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* tsconfig.json ./
|
||||
RUN npm install --no-audit --no-fund
|
||||
COPY src/ ./src/
|
||||
RUN npm run build
|
||||
|
||||
# --- runtime ----------------------------------------------------------------
|
||||
FROM node:22-bookworm-slim AS runtime
|
||||
ENV NODE_ENV=production
|
||||
# yt-dlp keeps its cache under $HOME; /app is not writable for the node user.
|
||||
ENV HOME=/tmp
|
||||
WORKDIR /app
|
||||
|
||||
# yt-dlp_linux is a self-contained binary, so no Python runtime is needed.
|
||||
ARG YTDLP_VERSION=2025.08.20
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl \
|
||||
&& curl -fsSL "https://github.com/yt-dlp/yt-dlp/releases/download/${YTDLP_VERSION}/yt-dlp_linux" -o /usr/local/bin/yt-dlp \
|
||||
&& chmod +x /usr/local/bin/yt-dlp \
|
||||
&& yt-dlp --version \
|
||||
&& apt-get purge -y curl \
|
||||
&& apt-get autoremove -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=web /app/web/dist ./web/dist
|
||||
COPY package.json ./
|
||||
|
||||
USER node
|
||||
EXPOSE 3005
|
||||
CMD ["node", "dist/index.js"]
|
||||
Reference in New Issue
Block a user