Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to s6-overlay v3 and nginx listen ports for ipv4 and ipv6 #326

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
server {
listen [::]:_LOCAL_RELAY_PORT ipv6only=off;
listen _LOCAL_RELAY_PORT;
listen [::]:_LOCAL_RELAY_PORT;
location /video/:/transcode/session/ {
proxy_pass http://127.0.0.1:_PMS_PORT;
proxy_request_buffering off;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bash

if which node > /dev/null
then
echo "**** node is installed, skipping... ****"
else
echo "**** install runtime packages ****"
echo "**** apt-get update ****"
apt-get update
echo "**** install libatomic1, file, nginx ****"
apt-get install -y libatomic1 file nginx
echo "**** install 'n' ****"
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
echo "**** install nodejs ****"
bash n lts
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/1-install-dependencies/run
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/2-npm-install/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/with-contenv bash

if file /usr/lib/plexmediaserver/'Plex Transcoder' | grep -iq ASCII ; then
echo "**** Transcoder is already clusterplex, only update ****"
else
echo "**** Transcoder is still original, rename ****"
mv /usr/lib/plexmediaserver/'Plex Transcoder' /usr/lib/plexmediaserver/originalTranscoder
fi

echo "**** Move shim to destination ****"
cp /app/transcoder-shim.sh /usr/lib/plexmediaserver/'Plex Transcoder'

echo "**** Make the shim executable ****"
chmod +x /usr/lib/plexmediaserver/'Plex Transcoder'

echo "**** Make sentinel.sh executable ****"
chmod +x /app/sentinel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/3-install-transcoder-shim/run
15 changes: 15 additions & 0 deletions pms/docker-mod/root/etc/s6-overlay/s6-rc.d/4-setup-nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/with-contenv bash

echo "**** unlink nginx default ****"
unlink /etc/nginx/sites-enabled/default
echo "**** link nginx forward-proxy ****"
ln -s /etc/nginx/sites-available/forward-proxy.conf /etc/nginx/sites-enabled/forward-proxy.conf

echo "**** configuring nginx (for Local Relay) forwarding ports ****"
echo "PMS_PORT => '${PMS_PORT}'"
echo "LOCAL_RELAY_PORT => '${LOCAL_RELAY_PORT}'"

sed -i 's/_PMS_PORT/'"${PMS_PORT:-32400}"'/g' /etc/nginx/sites-available/forward-proxy.conf
sed -i 's/_LOCAL_RELAY_PORT/'"${LOCAL_RELAY_PORT:-32499}"'/g' /etc/nginx/sites-available/forward-proxy.conf

echo "**** nginx configuration complete ****"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/4-setup-nginx/run
4 changes: 4 additions & 0 deletions pms/docker-mod/root/etc/s6-overlay/s6-rc.d/5-run-nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash

echo "**** starting nginx ****"
/usr/sbin/nginx -g 'daemon off;'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
1 change: 1 addition & 0 deletions pms/docker-mod/root/etc/s6-overlay/s6-rc.d/5-run-nginx/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/4-setup-nginx/run
Empty file.
Empty file.
Empty file.
18 changes: 11 additions & 7 deletions pms/extended-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ LABEL maintainer="pabloromeo"
COPY /docker-mod/root/etc/ /etc/
COPY /app /app

RUN bash /etc/cont-init.d/92-install-dependencies && \
bash /etc/cont-init.d/93-npm-install && \
rm /etc/cont-init.d/92-install-dependencies && \
rm /etc/cont-init.d/93-npm-install && \
RUN bash /etc/s6-overlay/s6-rc.d/1-install-dependencies/run && \
bash /etc/s6-overlay/s6-rc.d/2-npm-install/run && \
rm -rf /etc/s6-overlay/s6-rc.d/1-install-dependencies && \
rm -rf /etc/s6-overlay/s6-rc.d/2-npm-install && \
rm -rf /etc/s6-overlay/s6-rc.d/3-install-transcoder-shim/dependencies.d && \
rm -rf /etc/s6-overlay/s6-rc.d/4-setup-nginx/dependencies.d && \
rm /etc/s6-overlay/s6-rc.d/user/contents.d/1-install-dependencies && \
rm /etc/s6-overlay/s6-rc.d/user/contents.d/2-npm-install && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*

WORKDIR /
5 changes: 5 additions & 0 deletions worker/docker-mod/_old_cont-init.d/93-npm-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash

echo "**** Running npm install ****"
cd /app
npm install
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/with-contenv bash

if which node > /dev/null
then
echo "**** node is installed, skipping... ****"
else
echo "**** install runtime packages ****"
echo "**** apt-get update ****"
apt-get update
echo "**** install binutils, libatomic1, file, unzip ****"
apt-get install -y binutils libatomic1 file unzip
echo "**** install 'n' ****"
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
echo "**** install nodejs ****"
bash n lts
fi

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/1-install-dependencies/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash

echo "**** Running npm install ****"
cd /app
npm install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/2-npm-install/run
14 changes: 14 additions & 0 deletions worker/docker-mod/root/etc/s6-overlay/s6-rc.d/3-install-shim/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bash

if file /usr/lib/plexmediaserver/'Plex Media Server' | grep -iq ASCII ; then
echo "**** Root executable is already clusterplex-worker, only update ****"
else
echo "**** Root executable is still original, rename ****"
mv /usr/lib/plexmediaserver/'Plex Media Server' /usr/lib/plexmediaserver/pms_original
fi

echo "**** Move shim to destination ****"
cp /app/start.sh /usr/lib/plexmediaserver/'Plex Media Server'

echo "**** Make the shim executable ****"
chmod +x /usr/lib/plexmediaserver/'Plex Media Server'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/3-install-shim/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/with-contenv bash

echo "**** Setting up codecs directory ****"
if [ -d "/codecs" ]
then
echo "Directory already present"
else
echo "Creating /codecs"
mkdir -p /codecs
fi

echo "**** Changing ownership for /codecs ****"
chown abc:abc /codecs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/4-setup-codecs-dir/run
14 changes: 10 additions & 4 deletions worker/extended-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ LABEL maintainer="pabloromeo"
COPY /docker-mod/root/etc/ /etc/
COPY /app /app

RUN bash /etc/cont-init.d/92-install-dependencies && \
bash /etc/cont-init.d/93-npm-install && \
rm /etc/cont-init.d/92-install-dependencies && \
rm /etc/cont-init.d/93-npm-install && \
RUN bash /etc/s6-overlay/s6-rc.d/1-install-dependencies/run && \
bash /etc/s6-overlay/s6-rc.d/2-npm-install/run && \
rm -rf /etc/s6-overlay/s6-rc.d/1-install-dependencies && \
rm -rf /etc/s6-overlay/s6-rc.d/2-npm-install && \
rm -rf /etc/s6-overlay/s6-rc.d/3-install-shim/dependencies.d && \
rm -rf /etc/s6-overlay/s6-rc.d/4-setup-codecs-dir/dependencies.d && \
rm /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/1-install-dependencies && \
rm /etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/2-npm-install && \
rm /etc/s6-overlay/s6-rc.d/user/contents.d/1-install-dependencies && \
rm /etc/s6-overlay/s6-rc.d/user/contents.d/2-npm-install && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/* \
Expand Down