Add node symlink to Dockerfile; expand ytdlp-test diagnostics

Debian installs nodejs as /usr/bin/nodejs but yt-dlp looks for 'node'.
The symlink ensures yt-dlp can find the runtime.

Diagnostics now report node path/version and yt-dlp version so we can
verify the environment without shelling into the container.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mattias Tall
2026-05-26 10:06:53 +02:00
parent 299338ff80
commit a006bf08bc
2 changed files with 26 additions and 4 deletions

View File

@@ -2,7 +2,9 @@ FROM python:3.12-slim
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y ffmpeg gosu nodejs && \
ln -sf /usr/bin/nodejs /usr/bin/node && \
rm -rf /var/lib/apt/lists/*
COPY backend/requirements.txt ./backend/requirements.txt COPY backend/requirements.txt ./backend/requirements.txt
RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp

View File

@@ -222,9 +222,26 @@ def oauth2_disable(
def ytdlp_test( def ytdlp_test(
current_user: User = Depends(get_current_user), current_user: User = Depends(get_current_user),
): ):
"""Run a quick yt-dlp metadata fetch on a public video and return raw output for diagnostics.""" """Run a quick yt-dlp metadata fetch and environment check for diagnostics."""
import subprocess import subprocess, shutil
cookie_args = ytdlp._cookie_args() cookie_args = ytdlp._cookie_args()
node_path = shutil.which("node") or shutil.which("nodejs")
node_version = None
if node_path:
try:
nv = subprocess.run([node_path, "--version"], capture_output=True, text=True, timeout=5)
node_version = nv.stdout.strip()
except Exception:
pass
yt_version = None
try:
yv = subprocess.run(["yt-dlp", "--version"], capture_output=True, text=True, timeout=5)
yt_version = yv.stdout.strip()
except Exception:
pass
result = subprocess.run( result = subprocess.run(
[ [
"yt-dlp", "yt-dlp",
@@ -236,8 +253,11 @@ def ytdlp_test(
capture_output=True, text=True, timeout=30, capture_output=True, text=True, timeout=30,
) )
return { return {
"returncode": result.returncode, "node_path": node_path,
"node_version": node_version,
"yt_dlp_version": yt_version,
"cookie_args": cookie_args, "cookie_args": cookie_args,
"returncode": result.returncode,
"stdout_lines": result.stdout.splitlines()[:5], "stdout_lines": result.stdout.splitlines()[:5],
"stderr_tail": result.stderr.splitlines()[-20:], "stderr_tail": result.stderr.splitlines()[-20:],
"success": result.returncode == 0, "success": result.returncode == 0,