mirror of
https://github.com/kasmtech/workspaces-core-images.git
synced 2025-01-25 14:48:42 +01:00
KASM-2390 auto restart kasmvnc
This commit is contained in:
parent
96ac77addd
commit
2382fa9684
@ -43,7 +43,8 @@ ENV DISPLAY=:1 \
|
||||
START_PULSEAUDIO=$START_PULSEAUDIO \
|
||||
LANG=$LANG \
|
||||
LANGUAGE=$LANGUAGE \
|
||||
LC_ALL=$LC_ALL
|
||||
LC_ALL=$LC_ALL \
|
||||
KASMVNC_AUTO_RECOVER=true
|
||||
|
||||
EXPOSE $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_kasm.png /usr/share/extra/icons/icon_kasm.png
|
||||
|
||||
ADD ./src/common/xfce/window_manager_startup.sh $STARTUPDIR
|
||||
|
||||
### Install kasm_vnc dependencies and binaries
|
||||
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/
|
||||
|
@ -54,7 +54,8 @@ ENV DISPLAY=:1 \
|
||||
LANG=$LANG \
|
||||
LANGUAGE=$LANGUAGE \
|
||||
LC_ALL=$LC_ALL \
|
||||
SINGLE_APPLICATION=0
|
||||
SINGLE_APPLICATION=0 \
|
||||
KASMVNC_AUTO_RECOVER=true
|
||||
|
||||
EXPOSE $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/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/xfce/window_manager_startup.sh $STARTUPDIR
|
||||
|
||||
### Install kasm_vnc dependencies and binaries
|
||||
COPY ./src/ubuntu/install/kasm_vnc $INST_SCRIPTS/kasm_vnc/
|
||||
|
@ -51,7 +51,8 @@ ENV DISPLAY=:1 \
|
||||
START_PULSEAUDIO=$START_PULSEAUDIO \
|
||||
LANG=$LANG \
|
||||
LANGUAGE=$LANGUAGE \
|
||||
LC_ALL=$LC_ALL
|
||||
LC_ALL=$LC_ALL \
|
||||
KASMVNC_AUTO_RECOVER=true
|
||||
|
||||
EXPOSE $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_kasm.png /usr/share/extra/icons/icon_kasm.png
|
||||
|
||||
ADD ./src/common/xfce/window_manager_startup.sh $STARTUPDIR
|
||||
|
||||
### Install kasm_vnc dependencies and binaries
|
||||
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/
|
||||
|
@ -73,8 +73,20 @@ function start_kasmvnc (){
|
||||
}
|
||||
|
||||
function start_window_manager (){
|
||||
echo -e "start window manager\n..."
|
||||
$STARTUPDIR/window_manager_startup.sh #&> $STARTUPDIR/window_manager_startup.log
|
||||
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
|
||||
KASM_PROCS['window_manager']=$!
|
||||
else
|
||||
echo "Skipping XFCE Startup"
|
||||
fi
|
||||
}
|
||||
|
||||
function start_audio_out_websocket (){
|
||||
@ -132,8 +144,7 @@ function start_audio_in (){
|
||||
function start_upload (){
|
||||
if [[ ${KASM_SVC_UPLOADS:-1} == 1 ]]; then
|
||||
echo 'Starting upload server'
|
||||
cd $STARTUPDIR/upload_server/
|
||||
./kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" &
|
||||
$STARTUPDIR/upload_server/kasm_upload_server --ssl --auth-token "kasm_user:$VNC_PW" &
|
||||
|
||||
KASM_PROCS['upload_server']=$!
|
||||
|
||||
@ -144,6 +155,19 @@ function start_upload (){
|
||||
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 ###########
|
||||
|
||||
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}"
|
||||
|
||||
# start custom startup script
|
||||
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" &
|
||||
fi
|
||||
custom_startup
|
||||
|
||||
# Monitor Kasm Services
|
||||
sleep 3
|
||||
@ -233,11 +249,17 @@ do
|
||||
|
||||
case $process in
|
||||
kasmvnc)
|
||||
echo "KasmVNC crashed, exiting container"
|
||||
exit 1
|
||||
# TODO: Is there a way to restore gracefully, restarting the container may be the best here
|
||||
#start_kasmvnc
|
||||
#/dockerstartup/custom_startup.sh
|
||||
if [ "$KASMVNC_AUTO_RECOVER" = true ] ; then
|
||||
echo "KasmVNC crashed, restarting"
|
||||
start_kasmvnc
|
||||
else
|
||||
echo "KasmVNC crashed, exiting container"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
window_manager)
|
||||
echo "Window manager crashed, restarting"
|
||||
start_window_manager
|
||||
;;
|
||||
kasm_audio_out_websocket)
|
||||
echo "Restarting Audio Out Websocket Service"
|
||||
@ -257,6 +279,11 @@ do
|
||||
# TODO: This will only work if both processes are killed, requires more work
|
||||
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"
|
||||
;;
|
||||
|
@ -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