From 2da56edc2a55da7e70c6b02a8a416f7e780e8ace Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 22 Jul 2026 17:28:09 +0200 Subject: [PATCH] Clear the DASH dir contents instead of rm -rf on the /opt/data mount The entrypoint reset segment state with `rm -rf /opt/data`, which targets the mount point itself. When /opt/data is a mounted volume - the normal deployment, where the DASH output is a named or bind volume - recursively deleting the mount's contents on every start is both unnecessary and risky: it removes whatever the host bound there rather than just the stale segments. Clear only the segment directory contents (mkdir -p, then find -mindepth 1 -delete), which resets the DASH output without touching the mount. --- nginx-transcoder/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx-transcoder/entrypoint.sh b/nginx-transcoder/entrypoint.sh index 2d0c22c..681f27b 100755 --- a/nginx-transcoder/entrypoint.sh +++ b/nginx-transcoder/entrypoint.sh @@ -37,7 +37,7 @@ if [ "$SSL_ENABLED" = true ] ; then - rm -rf /opt/data && mkdir -p /opt/data/dash && chown nginx /opt/data/dash && chmod 777 /opt/data/dash && mkdir -p /www && \ + mkdir -p /opt/data/dash && find /opt/data/dash -mindepth 1 -delete && chown nginx /opt/data/dash && chmod 777 /opt/data/dash && mkdir -p /www && \ envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < \ /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf ### Send certbot Emission/Renewal to background @@ -48,7 +48,7 @@ if [ "$SSL_ENABLED" = true ] ; then else echo "Running Earshot without SSL (connections will be insecure)" - rm -rf /opt/data && mkdir -p /opt/data/dash && chown nginx /opt/data/dash && chmod 777 /opt/data/dash && mkdir -p /www && \ + mkdir -p /opt/data/dash && find /opt/data/dash -mindepth 1 -delete && chown nginx /opt/data/dash && chmod 777 /opt/data/dash && mkdir -p /www && \ envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < \ /etc/nginx/nginx-no-ssl.conf.template > /etc/nginx/nginx.conf fi