mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2025-02-01 18:09:15 +01:00
Merge branch 'feature/KASM-2390_kasmvnc_autorestart' into 'develop'
KASM-2390 auto restart kasmvnc See merge request kasm-technologies/internal/workspaces-core-images!41
This commit is contained in:
commit
7fae990199
@ -43,7 +43,8 @@ ENV DISPLAY=:1 \
|
|||||||
START_PULSEAUDIO=$START_PULSEAUDIO \
|
START_PULSEAUDIO=$START_PULSEAUDIO \
|
||||||
LANG=$LANG \
|
LANG=$LANG \
|
||||||
LANGUAGE=$LANGUAGE \
|
LANGUAGE=$LANGUAGE \
|
||||||
LC_ALL=$LC_ALL
|
LC_ALL=$LC_ALL \
|
||||||
|
KASMVNC_AUTO_RECOVER=true
|
||||||
|
|
||||||
EXPOSE $VNC_PORT \
|
EXPOSE $VNC_PORT \
|
||||||
$NO_VNC_PORT \
|
$NO_VNC_PORT \
|
||||||
@ -70,8 +71,6 @@ ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_ubu
|
|||||||
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_default.png
|
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_default.png
|
||||||
ADD /src/common/resources/images/icon_kasm.png /usr/share/extra/icons/icon_kasm.png
|
ADD /src/common/resources/images/icon_kasm.png /usr/share/extra/icons/icon_kasm.png
|
||||||
|
|
||||||
ADD ./src/common/xfce/window_manager_startup.sh $STARTUPDIR
|
|
||||||
|
|
||||||
### Install kasm_vnc dependencies and binaries
|
### Install kasm_vnc dependencies and binaries
|
||||||
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
||||||
RUN bash $INST_SCRIPTS/kasm_vnc/install_kasm_vnc.sh && rm -rf $INST_SCRIPTS/kasm_vnc/
|
RUN bash $INST_SCRIPTS/kasm_vnc/install_kasm_vnc.sh && rm -rf $INST_SCRIPTS/kasm_vnc/
|
||||||
|
@ -54,7 +54,8 @@ ENV DISPLAY=:1 \
|
|||||||
LANG=$LANG \
|
LANG=$LANG \
|
||||||
LANGUAGE=$LANGUAGE \
|
LANGUAGE=$LANGUAGE \
|
||||||
LC_ALL=$LC_ALL \
|
LC_ALL=$LC_ALL \
|
||||||
SINGLE_APPLICATION=0
|
SINGLE_APPLICATION=0 \
|
||||||
|
KASMVNC_AUTO_RECOVER=true
|
||||||
|
|
||||||
EXPOSE $VNC_PORT \
|
EXPOSE $VNC_PORT \
|
||||||
$NO_VNC_PORT \
|
$NO_VNC_PORT \
|
||||||
@ -81,7 +82,6 @@ RUN bash $INST_SCRIPTS/xfce/install_xfce_ui.sh && rm -rf $INST_SCRIPTS/xfce/
|
|||||||
COPY ./src/$DISTRO/xfce/.config/ $HOME/.config/
|
COPY ./src/$DISTRO/xfce/.config/ $HOME/.config/
|
||||||
COPY /src/common/resources/images/bg_kasm.png /usr/share/backgrounds/bg_kasm.png
|
COPY /src/common/resources/images/bg_kasm.png /usr/share/backgrounds/bg_kasm.png
|
||||||
COPY /src/common/resources/images/$BG_IMG /usr/share/backgrounds/bg_default.png
|
COPY /src/common/resources/images/$BG_IMG /usr/share/backgrounds/bg_default.png
|
||||||
COPY ./src/common/xfce/window_manager_startup.sh $STARTUPDIR
|
|
||||||
|
|
||||||
### Install kasm_vnc dependencies and binaries
|
### Install kasm_vnc dependencies and binaries
|
||||||
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
||||||
|
@ -51,7 +51,8 @@ ENV DISPLAY=:1 \
|
|||||||
START_PULSEAUDIO=$START_PULSEAUDIO \
|
START_PULSEAUDIO=$START_PULSEAUDIO \
|
||||||
LANG=$LANG \
|
LANG=$LANG \
|
||||||
LANGUAGE=$LANGUAGE \
|
LANGUAGE=$LANGUAGE \
|
||||||
LC_ALL=$LC_ALL
|
LC_ALL=$LC_ALL \
|
||||||
|
KASMVNC_AUTO_RECOVER=true
|
||||||
|
|
||||||
EXPOSE $VNC_PORT \
|
EXPOSE $VNC_PORT \
|
||||||
$NO_VNC_PORT \
|
$NO_VNC_PORT \
|
||||||
@ -84,8 +85,6 @@ ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_ubu
|
|||||||
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_default.png
|
ADD /src/common/resources/images/icon_ubuntu.png /usr/share/extra/icons/icon_default.png
|
||||||
ADD /src/common/resources/images/icon_kasm.png /usr/share/extra/icons/icon_kasm.png
|
ADD /src/common/resources/images/icon_kasm.png /usr/share/extra/icons/icon_kasm.png
|
||||||
|
|
||||||
ADD ./src/common/xfce/window_manager_startup.sh $STARTUPDIR
|
|
||||||
|
|
||||||
### Install kasm_vnc dependencies and binaries
|
### Install kasm_vnc dependencies and binaries
|
||||||
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
||||||
RUN bash $INST_SCRIPTS/kasm_vnc/install_kasm_vnc.sh && rm -rf $INST_SCRIPTS/kasm_vnc/
|
RUN bash $INST_SCRIPTS/kasm_vnc/install_kasm_vnc.sh && rm -rf $INST_SCRIPTS/kasm_vnc/
|
||||||
|
@ -73,8 +73,20 @@ function start_kasmvnc (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start_window_manager (){
|
function start_window_manager (){
|
||||||
echo -e "start window manager\n..."
|
echo -e "\n------------------ Xfce4 window manager startup------------------"
|
||||||
$STARTUPDIR/window_manager_startup.sh #&> $STARTUPDIR/window_manager_startup.log
|
|
||||||
|
if [ "${START_XFCE4}" == "1" ] ; then
|
||||||
|
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
|
||||||
|
echo "Starting XFCE with VirtualGL using EGL device ${KASM_EGL_CARD}"
|
||||||
|
DISPLAY=:1 /opt/VirtualGL/bin/vglrun -d "${KASM_EGL_CARD}" /usr/bin/startxfce4 --replace &
|
||||||
|
else
|
||||||
|
echo "Starting XFCE"
|
||||||
|
/usr/bin/startxfce4 --replace &
|
||||||
|
fi
|
||||||
|
KASM_PROCS['window_manager']=$!
|
||||||
|
else
|
||||||
|
echo "Skipping XFCE Startup"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_audio_out_websocket (){
|
function start_audio_out_websocket (){
|
||||||
@ -132,8 +144,7 @@ function start_audio_in (){
|
|||||||
function start_upload (){
|
function start_upload (){
|
||||||
if [[ ${KASM_SVC_UPLOADS:-1} == 1 ]]; then
|
if [[ ${KASM_SVC_UPLOADS:-1} == 1 ]]; then
|
||||||
echo 'Starting upload server'
|
echo 'Starting upload server'
|
||||||
cd $STARTUPDIR/upload_server/
|
$STARTUPDIR/upload_server/kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" &
|
||||||
./kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" &
|
|
||||||
|
|
||||||
KASM_PROCS['upload_server']=$!
|
KASM_PROCS['upload_server']=$!
|
||||||
|
|
||||||
@ -144,6 +155,19 @@ function start_upload (){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function custom_startup (){
|
||||||
|
custom_startup_script=/dockerstartup/custom_startup.sh
|
||||||
|
if [ -f "$custom_startup_script" ]; then
|
||||||
|
if [ ! -x "$custom_startup_script" ]; then
|
||||||
|
echo "${custom_startup_script}: not executable, exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$custom_startup_script" &
|
||||||
|
KASM_PROCS['custom_startup']=$!
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
############ END FUNCTION DECLARATIONS ###########
|
############ END FUNCTION DECLARATIONS ###########
|
||||||
|
|
||||||
if [[ $1 =~ -h|--help ]]; then
|
if [[ $1 =~ -h|--help ]]; then
|
||||||
@ -209,15 +233,7 @@ KASMIP=$(hostname -i)
|
|||||||
echo "Kasm User ${KASM_USER}(${KASM_USER_ID}) started container id ${HOSTNAME} with local IP address ${KASMIP}"
|
echo "Kasm User ${KASM_USER}(${KASM_USER_ID}) started container id ${HOSTNAME} with local IP address ${KASMIP}"
|
||||||
|
|
||||||
# start custom startup script
|
# start custom startup script
|
||||||
custom_startup_script=/dockerstartup/custom_startup.sh
|
custom_startup
|
||||||
if [ -f "$custom_startup_script" ]; then
|
|
||||||
if [ ! -x "$custom_startup_script" ]; then
|
|
||||||
echo "${custom_startup_script}: not executable, exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$custom_startup_script" &
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Monitor Kasm Services
|
# Monitor Kasm Services
|
||||||
sleep 3
|
sleep 3
|
||||||
@ -233,11 +249,17 @@ do
|
|||||||
|
|
||||||
case $process in
|
case $process in
|
||||||
kasmvnc)
|
kasmvnc)
|
||||||
echo "KasmVNC crashed, exiting container"
|
if [ "$KASMVNC_AUTO_RECOVER" = true ] ; then
|
||||||
exit 1
|
echo "KasmVNC crashed, restarting"
|
||||||
# TODO: Is there a way to restore gracefully, restarting the container may be the best here
|
start_kasmvnc
|
||||||
#start_kasmvnc
|
else
|
||||||
#/dockerstartup/custom_startup.sh
|
echo "KasmVNC crashed, exiting container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
window_manager)
|
||||||
|
echo "Window manager crashed, restarting"
|
||||||
|
start_window_manager
|
||||||
;;
|
;;
|
||||||
kasm_audio_out_websocket)
|
kasm_audio_out_websocket)
|
||||||
echo "Restarting Audio Out Websocket Service"
|
echo "Restarting Audio Out Websocket Service"
|
||||||
@ -257,6 +279,11 @@ do
|
|||||||
# TODO: This will only work if both processes are killed, requires more work
|
# TODO: This will only work if both processes are killed, requires more work
|
||||||
start_upload
|
start_upload
|
||||||
;;
|
;;
|
||||||
|
custom_script)
|
||||||
|
echo "The custom startup script exited."
|
||||||
|
# custom startup scripts track the target process on their own, they should not exit
|
||||||
|
custom_startup
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown Service: $process"
|
echo "Unknown Service: $process"
|
||||||
;;
|
;;
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo -e "\n------------------ Xfce4 window manager startup------------------"
|
|
||||||
|
|
||||||
if [ "${START_XFCE4}" == "1" ] ; then
|
|
||||||
if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then
|
|
||||||
echo "Starting XFCE with VirtualGL using EGL device ${KASM_EGL_CARD}"
|
|
||||||
DISPLAY=:1 /opt/VirtualGL/bin/vglrun -d "${KASM_EGL_CARD}" /usr/bin/startxfce4 --replace &
|
|
||||||
else
|
|
||||||
echo "Starting XFCE"
|
|
||||||
/usr/bin/startxfce4 --replace &
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Skipping XFCE Startup"
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user