Commit b21fd06c authored by Giuliano Taffoni's avatar Giuliano Taffoni
Browse files

Base with KASM 0.9.1 support

parent 4066791a
Loading
Loading
Loading
Loading
+33 −51
Original line number Diff line number Diff line
FROM lofar/lofar-pipeline:LOFAR-Release-4_0_16

LABEL Maintainer Giuliano Taffoni <giuliano.taffoni@inaf.it>
USER root
# Set non-interactive
ENV DEBIAN_FRONTEND noninteractive

# Always update when extending base images
RUN apt update

RUN apt -y upgrade

#------------------------
# Install deps
@@ -13,6 +14,12 @@ RUN apt update

# Git, Curl, sudo and  Nano
RUN apt-get install git curl sudo nano -y
RUN apt -y install lubuntu-core libjpeg-dev wget sudo git curl nano vim emacs
RUN apt-get install -y  supervisor strace net-tools

RUN  sed -i 's\1\0\g' /etc/apt/apt.conf.d/20auto-upgrades
RUN  ln -s /usr/share/lxde/wallpapers/lxde_blue.jpg /etc/alternatives/desktop-background
#


#------------------------
@@ -36,64 +43,38 @@ COPY data/input_data /input_data
COPY data/output_data /output_data
RUN chown lofar:lofar /home/lofar && chown -R lofar:lofar /input_data && chown -R lofar:lofar /output_data


#----------------------
# Minimal Desktop
#----------------------

# Utilities
RUN apt-get install -y telnet unzip wget supervisor build-essential python-dev git-core openjdk-8-jre

# Global Supervisord conf
COPY files/supervisord.conf /etc/supervisor/

# Install xvfb that triggers minimal install of X base packages and xterm
RUN apt-get install xvfb xterm  -y

# Install base packages for VNC server and headless desktop (2)
RUN cd /opt && wget https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.8.0.x86_64.tar.gz -O tigervnc-1.8.0.x86_64.tar.gz \
            && tar -zxvf tigervnc-1.8.0.x86_64.tar.gz \
            && mv tigervnc-1.8.0.x86_64 tigervnc

# Supervisord configuration
COPY files/supervisord_vnc.conf /etc/supervisor/conf.d/
COPY files/run_vnc.sh /etc/supervisor/conf.d/
COPY files/run_novnc.sh /etc/supervisor/conf.d/
RUN chmod 755 /etc/supervisor/conf.d/run_vnc.sh
RUN chmod 755 /etc/supervisor/conf.d/run_novnc.sh

# Web VNC (noVNC) v0.6.1.
# NOTE: this is a custom version from Doro Wu (fcwu.tw@gmail.com).
# TODO: Check differences and maybe move to 0.6.2
COPY files/noVNC.tar.gz /usr/lib/
RUN cd /usr/lib/ && tar -zxvf noVNC.tar.gz
COPY files/index.html /usr/lib/noVNC

RUN apt-get install -y net-tools

# Supervisord configuration
COPY files/supervisord_novnc.conf /etc/supervisor/conf.d/

# X environment setup/startup
RUN apt-get install fluxbox -y
COPY files/xstartup /opt/tigervnc/
RUN chmod 755 /opt/tigervnc/xstartup

# Prepare for logs
RUN mkdir /home/lofar/.logs && chown lofar:lofar /home/lofar/.logs

# Add fluxbox customisations
COPY files/dot_fluxbox /home/lofar/.fluxbox
RUN chown -R lofar:lofar /home/lofar/.fluxbox
COPY files/background.jpg /usr/share/images/fluxbox/background.jpg

# Rename lofar home folder as a "vanilla" home folder
RUN mkdir /home/lofar/.vnc
COPY files/config  /home/lofar/.vnc
COPY files/xstartup /home/lofar/.vnc
RUN chmod 755 /home/lofar/.vnc/xstartup
RUN chown -R lofar:lofar /home/lofar/.vnc

# Rename user home folder as a "vanilla" home folder
RUN mv /home/lofar /lofar_home_vanilla

# Give write access to anyone to the home folder so the entrypoint will be able
# to copy over the /home/matauser_vanilla into /home/lofar (for Singularity)
# to copy over the /home/matauser_vanilla into /home/metauser (for Singularity)
RUN chmod 777 /home

# Copy and install kasmvnc
COPY files/kasmvnc-Linux-x86_64-0.9.tar.gz /tmp
RUN sudo tar xz --strip 1 -C / -f /tmp/kasmvnc-Linux-x86_64-0.9.tar.gz && rm /tmp/kasmvnc-Linux-x86_64-0.9.tar.gz
RUN mkdir /usr/local/share/kasmvnc/certs
RUN chown lofar.lofar /usr/local/share/kasmvnc/certs
COPY files/index.html /usr/local/share/kasmvnc/www/


# Global Supervisord conf
COPY files/supervisord.conf /etc/supervisor/
COPY files/supervisord_kasm.conf /etc/supervisor/conf.d/
COPY files/run_kasm.sh /etc/supervisor/conf.d/
RUN chmod 755 /etc/supervisor/conf.d/run_kasm.sh



#----------------------
# Entrypoint
@@ -108,6 +89,7 @@ RUN chmod 755 /entrypoint.sh
# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]

RUN apt -y clean
# Set user lofar
USER lofar

+23 −20
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@
# (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error)
set -e

GUI=True



if [ "x$SAFE_MODE" == "xTrue" ]; then

@@ -18,9 +21,9 @@ else
    
    if [ "x$GUI" == "xTrue" ]; then
	    if [ "x$BASE_PORT" == "x" ]; then
	        echo "[INFO] No task base port set, will set noVNC port 8590 and VNC port 5900 with desktop id \"0\""  
	        echo "[INFO] No task base port set, will set KasmVNC port 8443 with  desktop id \"1\""  
	    else 
	        echo "[INFO] Task base port set, will set noVNC port $BASE_PORT and noVNC port $(($BASE_PORT+1)) with desktop id \"$(($BASE_PORT-5900+1))\""
	        echo "[INFO] Task base port set, will set KasmVNC port $BASE_PORT with desktop id \"$(($BASE_PORT-5900+1))\""
	    fi
    fi
    
@@ -28,19 +31,16 @@ else
    #   Setup home
    #---------------------

    if [ -f "/home/lofar/.initialized" ]; then
        :
    else
    if [ ! -f "/home/lofar/.initialized" ]; then
        echo "[INFO] Setting up home"
        mkdir -p /home/lofar

	[ ! -d "/home/lofar" ] &&  mkdir -p /home/lofar
        # Copy over vanilla home contents
        for x in /lofar_home_vanilla/* /lofar_home_vanilla/.[!.]* /lofar_home_vanilla/..?*; do
            if [ -e "$x" ]; then cp -a "$x" /home/lofar/; fi
        done
        
        # Mark as initialized
        touch /home/lofar/.initialized
	[ ! -f "/home/lofar/.initialized" ] && touch /home/lofar/.initialized
    fi
    

@@ -61,20 +61,25 @@ else
          echo "export $env_var" >> /tmp/env.sh
      fi
    done
    
    cd /home/lofar 
    #---------------------
    #   VNC Password
    #---------------------
    if [ "x$GUI" == "xTrue" ]; then
	    if [ "x$AUTH_PASS" != "x" ]; then
	        echo "[INFO] Setting up VNC password..."
	        mkdir -p /home/lofar/.vnc
	        /opt/tigervnc/usr/bin/vncpasswd -f <<< $AUTH_PASS > /home/lofar/.vnc/passwd
	        chmod 600 /home/lofar/.vnc/passwd
	        /usr/local/bin/kasmvncpasswd -f <<< $AUTH_PASS > /home/lofar/.kasmpasswd
	    else
	        echo "[INFO] Setting up default VNC password: metapasswd"
                /usr/local/bin/kasmvncpasswd -f <<< metapasswd > /home/lofar/.kasmpasswd
	    fi            
            chmod 600 /home/lofar/.kasmpasswd
            export VNC_AUTH=True
	    if [ "x$AUTH_USER" != "x" ]; then
               echo "[INFO] Setting up VNC user..."
               sed -i -e "s/username=lofar/username=$AUTH_USER/" /home/lofar/.vnc/config 
	    else
	        echo "[INFO] Not setting up any VNC password"
	            
               echo "[INFO] Default VNC user: lofar"
            fi
    fi
    
@@ -106,11 +111,10 @@ else

    # Start!
	echo -n "[INFO] Will execute entrypoint command: "
	echo $COMMAND
	echo ""
	echo "=============================================================="
	echo ""
	echo "      Welcome to the LOFAR-IT $CONTAINER_NAME container!"
	echo "      Welcome to the EUROEXA $CONTAINER_NAME container!"
	echo ""
	echo "=============================================================="
	echo ""
@@ -122,5 +126,4 @@ else
	echo ""
	
	exec $COMMAND

fi

base_v4/files/background.jpg

deleted100644 → 0
−9.96 KiB
Loading image diff...

base_v4/files/config

0 → 100644
+10 −0
Original line number Diff line number Diff line
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
# geometry=2000x1200
# localhost
# alwaysshared
username=lofar
+15 MiB

File added.

No diff preview for this file type.

Loading