diff --git a/Dockerfile b/Dockerfile index f764f2c..d70bfef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -443,9 +443,19 @@ ENV \ MODE="primary" \ ENABLE_VNC_AUDIO="true" -# Be sure that the noVNC port is exposed -EXPOSE 8083 +# Configure required ports +ENV \ + PORT_SSH="2222" \ + PORT_VNC="5900" \ + PORT_AUDIO_STREAM="5901" \ + PORT_NOVNC_WEB="8083" \ + PORT_AUDIO_WEBSOCKET="32123" + +# Expose the required ports +EXPOSE 2222 +EXPOSE 5900 EXPOSE 5901 +EXPOSE 8083 EXPOSE 32123 # Set entrypoint diff --git a/Dockerfile.arch b/Dockerfile.arch index 98a0fac..5f2bb7c 100644 --- a/Dockerfile.arch +++ b/Dockerfile.arch @@ -412,9 +412,19 @@ ENV \ MODE="primary" \ ENABLE_VNC_AUDIO="true" -# Be sure that the noVNC port is exposed -EXPOSE 8083 +# Configure required ports +ENV \ + PORT_SSH="2222" \ + PORT_VNC="5900" \ + PORT_AUDIO_STREAM="5901" \ + PORT_NOVNC_WEB="8083" \ + PORT_AUDIO_WEBSOCKET="32123" + +# Expose the required ports +EXPOSE 2222 +EXPOSE 5900 EXPOSE 5901 +EXPOSE 8083 EXPOSE 32123 # Set entrypoint diff --git a/overlay/etc/cont-init.d/70-configure_vnc_audio.sh b/overlay/etc/cont-init.d/70-configure_vnc_audio.sh index b893a6e..8d3fcdd 100644 --- a/overlay/etc/cont-init.d/70-configure_vnc_audio.sh +++ b/overlay/etc/cont-init.d/70-configure_vnc_audio.sh @@ -9,6 +9,9 @@ if [ "${MODE}" != "s" ] & [ "${MODE}" != "secondary" ]; then # - https://github.com/calebj/noVNC if [ -f /opt/noVNC/audio.patch ]; then echo "Patching noVNC with audio websocket" + # Enable supervisord script + sed -i "s|32123|${PORT_AUDIO_WEBSOCKET}|" /opt/noVNC/audio.patch + # Apply patch pushd /opt/noVNC/ &> /dev/null patch -p1 --input=/opt/noVNC/audio.patch --batch --quiet popd &> /dev/null diff --git a/overlay/etc/supervisor.d/sshd.ini b/overlay/etc/supervisor.d/sshd.ini index d21ef9a..e060afb 100644 --- a/overlay/etc/supervisor.d/sshd.ini +++ b/overlay/etc/supervisor.d/sshd.ini @@ -4,7 +4,7 @@ autostart=true autorestart=true priority=10 user=root -command=/usr/sbin/sshd -Ddp 2222 +command=/usr/sbin/sshd -Ddp "%(ENV_PORT_SSH)s" stopsignal=QUIT stdout_logfile=/var/log/supervisor/sshd.log stdout_logfile_maxbytes=10MB diff --git a/overlay/etc/supervisor.d/vnc-audio.ini b/overlay/etc/supervisor.d/vnc-audio.ini index f42928a..b7f7101 100644 --- a/overlay/etc/supervisor.d/vnc-audio.ini +++ b/overlay/etc/supervisor.d/vnc-audio.ini @@ -4,7 +4,7 @@ autostart=false autorestart=true priority=10 user=%(ENV_USER)s -command=tcpserver localhost 5901 gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1 +command=tcpserver localhost %(ENV_PORT_AUDIO_STREAM)s gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1 stopsignal=QUIT stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiostream.log stdout_logfile_maxbytes=10MB @@ -18,7 +18,7 @@ autostart=false autorestart=true priority=10 user=%(ENV_USER)s -command=/usr/local/bin/websockify 32123 localhost:5901 +command=/usr/local/bin/websockify %(ENV_PORT_AUDIO_WEBSOCKET)s localhost:%(ENV_PORT_AUDIO_STREAM)s stopsignal=QUIT stdout_logfile=/home/%(ENV_USER)s/.cache/log/audiowebsock.log stdout_logfile_maxbytes=10MB diff --git a/overlay/etc/supervisor.d/vnc.ini b/overlay/etc/supervisor.d/vnc.ini index d5d5b5f..8178c6c 100644 --- a/overlay/etc/supervisor.d/vnc.ini +++ b/overlay/etc/supervisor.d/vnc.ini @@ -4,7 +4,7 @@ autostart=true autorestart=true priority=30 user=%(ENV_USER)s -command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -rfbport 5900 -shared -forever +command=/usr/bin/x11vnc -display %(ENV_DISPLAY)s -rfbport %(ENV_PORT_VNC)s -shared -forever stopsignal=QUIT stdout_logfile=/home/%(ENV_USER)s/.cache/log/x11vnc.log stdout_logfile_maxbytes=10MB @@ -18,7 +18,7 @@ autostart=true autorestart=true priority=30 user=%(ENV_USER)s -command=/opt/noVNC/utils/launch.sh --vnc localhost:5900 --listen 8083 +command=/opt/noVNC/utils/launch.sh --vnc localhost:%(ENV_PORT_VNC)s --listen %(ENV_PORT_NOVNC_WEB)s environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s" stopsignal=QUIT stdout_logfile=/home/%(ENV_USER)s/.cache/log/novnc.log