fix(playout): entrypoint finds binary in /opt/casparcg for 2.4.x tarball layout
This commit is contained in:
parent
67ac007706
commit
fcd8e8dd2e
1 changed files with 4 additions and 15 deletions
|
|
@ -1,42 +1,32 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Headless GL: start a virtual framebuffer unless a real DISPLAY is provided
|
|
||||||
# (a GPU node may pass through an X socket). CasparCG's mixer needs a GL context.
|
|
||||||
if [ -z "${DISPLAY:-}" ]; then
|
if [ -z "${DISPLAY:-}" ]; then
|
||||||
echo "[entrypoint] starting Xvfb on :99"
|
echo "[entrypoint] starting Xvfb on :99"
|
||||||
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
|
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
|
||||||
export DISPLAY=:99
|
export DISPLAY=:99
|
||||||
# Give Xvfb a moment to create the socket.
|
|
||||||
for i in $(seq 1 20); do
|
for i in $(seq 1 20); do
|
||||||
[ -e /tmp/.X11-unix/X99 ] && break
|
[ -e /tmp/.X11-unix/X99 ] && break
|
||||||
sleep 0.25
|
sleep 0.25
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure the HLS preview directory exists before CasparCG attaches its second
|
|
||||||
# FFMPEG consumer (mam-api serves /live/<channel_id>/* from the shared volume).
|
|
||||||
if [ -n "${CHANNEL_ID:-}" ]; then
|
if [ -n "${CHANNEL_ID:-}" ]; then
|
||||||
mkdir -p "/media/live/${CHANNEL_ID}"
|
mkdir -p "/media/live/${CHANNEL_ID}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# casparcg.config writes log/ + data/ under /media (the install dir is a symlink
|
|
||||||
# into a possibly read-only apt location), so make sure those exist + writable.
|
|
||||||
mkdir -p /media/casparcg/log /media/casparcg/data /media/templates
|
mkdir -p /media/casparcg/log /media/casparcg/data /media/templates
|
||||||
|
|
||||||
# Launch CasparCG Server. The 2.5 deb installs the binary on PATH (symlinked to
|
|
||||||
# /usr/local/bin/casparcg at build) and takes the config file as its first arg.
|
|
||||||
# Run from /opt/casparcg (symlink to the install dir) so any relative lookups in
|
|
||||||
# the server resolve against the install tree.
|
|
||||||
cd /opt/casparcg
|
cd /opt/casparcg
|
||||||
CASPAR_BIN="casparcg"
|
|
||||||
command -v "$CASPAR_BIN" >/dev/null || CASPAR_BIN=/usr/bin/casparcg-server-2.5
|
|
||||||
CASPAR_CFG=/opt/casparcg/casparcg.config
|
CASPAR_CFG=/opt/casparcg/casparcg.config
|
||||||
|
if [ -x "./casparcg" ]; then CASPAR_BIN="./casparcg";
|
||||||
|
elif [ -x "./CasparCG Server" ]; then CASPAR_BIN="./CasparCG Server";
|
||||||
|
elif command -v casparcg >/dev/null; then CASPAR_BIN="casparcg";
|
||||||
|
else echo "[entrypoint] ERROR: casparcg binary not found"; exit 1; fi
|
||||||
echo "[entrypoint] launching CasparCG: $CASPAR_BIN $CASPAR_CFG"
|
echo "[entrypoint] launching CasparCG: $CASPAR_BIN $CASPAR_CFG"
|
||||||
"$CASPAR_BIN" "$CASPAR_CFG" &
|
"$CASPAR_BIN" "$CASPAR_CFG" &
|
||||||
CASPAR_PID=$!
|
CASPAR_PID=$!
|
||||||
|
|
||||||
# Forward termination to CasparCG so the channel closes cleanly.
|
|
||||||
term() {
|
term() {
|
||||||
echo "[entrypoint] terminating CasparCG ($CASPAR_PID)"
|
echo "[entrypoint] terminating CasparCG ($CASPAR_PID)"
|
||||||
kill -TERM "$CASPAR_PID" 2>/dev/null || true
|
kill -TERM "$CASPAR_PID" 2>/dev/null || true
|
||||||
|
|
@ -45,7 +35,6 @@ term() {
|
||||||
}
|
}
|
||||||
trap term SIGTERM SIGINT
|
trap term SIGTERM SIGINT
|
||||||
|
|
||||||
# Launch the Node control shim (foreground). If it exits, stop the container.
|
|
||||||
cd /app
|
cd /app
|
||||||
node src/index.js &
|
node src/index.js &
|
||||||
NODE_PID=$!
|
NODE_PID=$!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue