Add Niko server as an alternative to noVNC

This commit is contained in:
Josh.5
2022-09-17 18:00:37 +12:00
committed by Josh Sunnex
parent 6260809ab3
commit 8b1de46a6d
4 changed files with 51 additions and 5 deletions

View File

@@ -224,6 +224,10 @@ RUN \
&& \
echo
# Install Neko server
COPY --from=m1k1o/neko:base /usr/bin/neko /usr/bin/neko
COPY --from=m1k1o/neko:base /var/www /var/www
# Install noVNC
ARG NOVNC_VERSION=1.2.0
RUN \
@@ -421,7 +425,12 @@ RUN \
&& useradd -d ${USER_HOME} -s /bin/bash ${USER} \
&& chown -R ${USER} \
${USER_HOME} \
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
&& echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \
&& adduser ${USER} audio \
&& adduser ${USER} video \
&& adduser ${USER} pulse \
&& \
echo
# Add FS overlay
COPY overlay /
@@ -442,6 +451,9 @@ ENV \
ENV \
MODE="primary" \
WEB_UI_MODE="vnc" \
ENABLE_VNC_AUDIO="true" \
NEKO_PASSWORD=neko \
NEKO_PASSWORD_ADMIN=admin
# Configure required ports
ENV \
@@ -449,7 +461,8 @@ ENV \
PORT_VNC="5900" \
PORT_AUDIO_STREAM="5901" \
PORT_NOVNC_WEB="8083" \
PORT_AUDIO_WEBSOCKET="32123"
PORT_AUDIO_WEBSOCKET="32123" \
NEKO_NAT1TO1=""
# Expose the required ports
EXPOSE 2222

View File

@@ -0,0 +1,18 @@
echo "**** Configure Neko ****"
if ([ ${WEB_UI_MODE} = "neko" ] && [ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
echo "Enable Neko server"
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/neko.ini
if [[ -z ${NEKO_NAT1TO1} ]]; then
export NEKO_NAT1TO1=$(ip route get 1 | awk '{print $(NF-2);exit}')
echo "Setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
else
echo "User provided setting NEKO_NAT1TO1=${NEKO_NAT1TO1}"
fi
else
echo "Disable Neko server"
fi
echo "DONE"

View File

@@ -2,10 +2,8 @@
echo "**** Configure VNC ****"
if ([ ${WEB_UI_MODE} = "vnc" ] && [ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then
echo "Enable VNC server"
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc.ini
if [[ "${ENABLE_VNC_AUDIO}" == "true" ]]; then
# Credits for this audio patch:
# - https://github.com/novnc/noVNC/issues/302
@@ -34,7 +32,8 @@ if ([ ${WEB_UI_MODE} = "vnc" ] && [ "${MODE}" != "s" ] && [ "${MODE}" != "second
# Disable supervisord script
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
fi
else
echo "Disable VNC server"
fi
echo "DONE"

View File

@@ -0,0 +1,16 @@
[program:neko]
autostart=false
autorestart=true
priority=30
user=%(ENV_USER)s
command=/usr/bin/neko serve --static "/var/www" --display %(ENV_DISPLAY)s --bind :%(ENV_PORT_NOVNC_WEB)s
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s"
stopsignal=INT
stopwaitsecs=5
stdout_logfile=/home/%(ENV_USER)s/.cache/log/neko.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=7
stderr_logfile=/home/%(ENV_USER)s/.cache/log/neko.err.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=7