feat: redesign match play and add broadcast tooling
This commit is contained in:
31
streamer/tourney/Dockerfile
Normal file
31
streamer/tourney/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# Build from the repository root:
|
||||
# docker build -f streamer/tourney/Dockerfile -t vash-tourney streamer
|
||||
FROM oven/bun:1 AS build
|
||||
WORKDIR /src
|
||||
COPY tv/main.ts tv/main.ts
|
||||
COPY agent.ts obs.ts tosu.ts tourney.ts ./
|
||||
RUN bun build tv/main.ts --compile --minify --outfile /vash-tv \
|
||||
&& bun build agent.ts --compile --minify --outfile /vash-agent
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
RUN sed -i 's/Components: main/Components: main contrib/' /etc/apt/sources.list.d/debian.sources \
|
||||
&& dpkg --add-architecture i386 \
|
||||
&& apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
wine wine32:i386 wine64 xvfb ffmpeg chromium tini ca-certificates \
|
||||
fonts-noto-core fonts-noto-cjk fonts-noto-color-emoji xdotool tesseract-ocr \
|
||||
pulseaudio pulseaudio-utils x11vnc novnc websockify libfuse2 \
|
||||
winetricks cabextract wget unzip \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& useradd --create-home --uid 1000 tv
|
||||
COPY --from=build /vash-tv /usr/local/bin/vash-tv
|
||||
COPY --from=build /vash-agent /usr/local/bin/vash-agent
|
||||
COPY tourney/start.sh /usr/local/bin/vash-tourney-start
|
||||
RUN chmod +x /usr/local/bin/vash-tourney-start
|
||||
USER tv
|
||||
ENV WINEPREFIX=/data/wine WINEARCH=win32 GAMEPLAY_DISPLAY=:98 GAMEPLAY_WIDTH=1280 GAMEPLAY_HEIGHT=720 \
|
||||
OSU_EXE=/data/osu/osu!.exe TOSU_BIN=/data/tosu/tosu PULSE_SOURCE=vash.monitor
|
||||
WORKDIR /home/tv
|
||||
VOLUME /data
|
||||
EXPOSE 6080
|
||||
ENTRYPOINT ["tini", "-g", "--", "vash-tourney-start"]
|
||||
68
streamer/tourney/start.sh
Normal file
68
streamer/tourney/start.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${GAMEPLAY_DISPLAY:=:98}"
|
||||
: "${GAMEPLAY_WIDTH:=1280}"
|
||||
: "${GAMEPLAY_HEIGHT:=720}"
|
||||
: "${OSU_EXE:=/data/osu/osu!.exe}"
|
||||
: "${TOSU_BIN:=/data/tosu/tosu}"
|
||||
|
||||
if [ ! -f "$OSU_EXE" ]; then
|
||||
echo "Missing $OSU_EXE. Mount a dedicated osu! stable installation at /data/osu." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Xvfb "$GAMEPLAY_DISPLAY" -screen 0 "${GAMEPLAY_WIDTH}x$((GAMEPLAY_HEIGHT + 220))x24" -nolisten tcp &
|
||||
export DISPLAY="$GAMEPLAY_DISPLAY"
|
||||
sleep 2
|
||||
|
||||
if [ -n "${VNC_PASSWORD:-}" ]; then
|
||||
x11vnc -storepasswd "$VNC_PASSWORD" /tmp/vash-vnc.pass >/dev/null
|
||||
x11vnc -display "$GAMEPLAY_DISPLAY" -rfbauth /tmp/vash-vnc.pass -rfbport 5900 -forever -shared -quiet &
|
||||
websockify --web=/usr/share/novnc 0.0.0.0:6080 127.0.0.1:5900 &
|
||||
fi
|
||||
|
||||
pulseaudio --start --exit-idle-time=-1
|
||||
pactl load-module module-null-sink sink_name=vash >/dev/null
|
||||
export PULSE_SINK=vash
|
||||
|
||||
# On first use, run osu! normally in the VNC screen, sign in with Remember
|
||||
# Username/Password, then restart without OSU_SETUP. The agent writes
|
||||
# tournament.cfg only after this setup run has ended.
|
||||
if [ "${OSU_SETUP:-0}" = 1 ]; then
|
||||
if [ -f "$(dirname "$OSU_EXE")/tournament.cfg" ]; then
|
||||
echo "OSU_SETUP needs a fresh installation without tournament.cfg." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "${OSU_DOTNET:-0}" = 1 ]; then
|
||||
winetricks -q dotnet48
|
||||
fi
|
||||
cd "$(dirname "$OSU_EXE")"
|
||||
exec wine "$OSU_EXE"
|
||||
fi
|
||||
|
||||
if [ ! -x "$TOSU_BIN" ]; then
|
||||
echo "Missing executable $TOSU_BIN. Mount the tosu Linux build at /data/tosu/tosu." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${VASH_SERVER:-}" ] || [ -z "${VASH_CHANNEL:-}" ] || [ -z "${VASH_TOKEN:-}" ]; then
|
||||
echo "Set VASH_SERVER, VASH_CHANNEL and VASH_TOKEN." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export TOSU_OSU_PATH="$(dirname "$OSU_EXE")"
|
||||
(
|
||||
while :; do
|
||||
"$TOSU_BIN" || true
|
||||
echo "tosu stopped; restarting in 3 seconds" >&2
|
||||
sleep 3
|
||||
done
|
||||
) &
|
||||
(
|
||||
while :; do
|
||||
AUTO_JOIN=1 vash-agent --server "$VASH_SERVER" --channel "$VASH_CHANNEL" --token "$VASH_TOKEN" --osu-exe "$OSU_EXE" --auto-join || true
|
||||
echo "Vash agent stopped; restarting in 3 seconds" >&2
|
||||
sleep 3
|
||||
done
|
||||
) &
|
||||
exec vash-tv
|
||||
Reference in New Issue
Block a user