diff --git a/Dockerfile b/Dockerfile index 5c45797..2af2860 100644 --- a/Dockerfile +++ b/Dockerfile @@ -125,7 +125,7 @@ EXPOSE 80 # Install Node.js & NGINX RUN apt-get update && \ - apt-get install --no-install-recommends -y nginx figlet && \ + apt-get install --no-install-recommends -y nginx figlet curl && \ rm -rf /var/lib/apt/lists/* COPY --from=ffmpeg-builder /libraries/usr/lib /usr/lib/x86_64-linux-gnu/ diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 2f5a898..63e501e 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -50,7 +50,16 @@ nginx # Start GPAC cd /opt -(gpac-dash -chunk-media-segments -cors $NETWORK_PROFILE &) >/dev/null 2>&1 +(gpac-dash -chunk-media-segments -cors $NETWORK_PROFILE &) 1>/dev/null + +# Check if GPAC is running +sleep 1 +curl -s http://localhost:8000/status | grep -q "OK" + +if [ $? -ne 0 ]; then + echo "GPAC failed to launch, check your arguments" + exit 1 +fi # Show banner figlet "A-CAPSC Demonstration" diff --git a/server/gpac-dash.js b/server/gpac-dash.js index a73011d..84f65e6 100755 --- a/server/gpac-dash.js +++ b/server/gpac-dash.js @@ -486,6 +486,12 @@ var onRequest = function (req, res) { var notFound = false; var fStat; + if (req.url == "/status") { + res.writeHead(200, { "Content-Type": "text/plain" }); + res.end("OK"); + return; + } + if (incoming_log_file && (req.url.slice(-3) === "mpd")) { fs.appendFile(incoming_log_file, (new Date()) + ": Incoming request from " + req.socket.remoteAddress + " for URL: " + req.url + " with headers: " + JSON.stringify(req.headers) + "\n"); }