Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
aa3025 committed Aug 25, 2022
0 parents commit 2d077e6a63f590f76943870defb171e90e276dfa
Showing with 398 additions and 0 deletions.
  1. +103 −0 0_create_cluster.cmd
  2. +20 −0 1_stop_the_cluster.cmd
  3. +22 −0 2_re-start_the_cluster.cmd
  4. +20 −0 3_pause_cluster.cmd
  5. +20 −0 4_unpause_cluster.cmd
  6. +20 −0 5_destroy_cluster.cmd
  7. +60 −0 admin_node/Dockerfile
  8. +38 −0 admin_node/id_rsa
  9. +1 −0 admin_node/id_rsa.pub
  10. +52 −0 client_node/Dockerfile
  11. +38 −0 client_node/id_rsa
  12. +1 −0 client_node/id_rsa.pub
  13. +3 −0 userlist.txt
@@ -0,0 +1,103 @@
@echo off

rem *************** VARIABLES ***************
rem *** Docker subnet for the cluster (admin box IP is %SUBNET%.254) ***
set CLUSTERNET=clusternet
set SUBNET=172.16.0
set NETMASK=16

rem *** Local folder to store /home of all the containers ***
set HOMES=clusterhomes
if not exist %HOMES% (mkdir %HOMES%)
set LOCALSHARE=%~dp0%HOMES%


rem *** cleaning up previous stuff ***
rem docker rm --force $(docker ps -a -q)
docker network rm clusternet


rem *** CREATEING NEW DOCKER SUBNET "clusternet" FOR THE CLUSTER ***
docker network create --subnet=%SUBNET%.0/%NETMASK% %CLUSTERNET%



rem *************** CREATING ADMIN NODE IMAGE ***************
cd "admin_node"
docker build . -t admin_node
cd ..

rem *** admin box is hooked up to :99 local VNC display ***
docker run -ti -d -p 5999:5901 --mount src=%LOCALSHARE%,target=/home,type=bind --net %CLUSTERNET% --ip %SUBNET%.254 --name admin --hostname admin admin_node



rem *************** CREATING CLIENT NODES ***************
cd "client_node"
docker build . -t client_node
cd ..

rem *** READING LIST OF USERS AND PASSWORDS ***
set USERLIST="userlist.txt"
set /a n=0
set /a vncport=5900
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1,2 usebackq delims=. " %%a in (%USERLIST%) do (

set /a n=n+1

rem *** local VNC port to hook up the client to ***
set /a vncport=5900+n

set node=%%a
set passwd=%%b

rem *** username, UID:GID on all clients ***
set user=!node!
set /a uid=1000+!n!
set /a gid=1000+!n!

set /a IP=100+!n!
echo starting node: !node!, IP=172.16.0.!IP!, user !user!, UID !uid!, GID !gid!, password !passwd!, vncport !vncport!

docker run -ti -d -p !vncport!:5901 --mount src=!LOCALSHARE!,target=/home,type=bind --net !CLUSTERNET! --ip !SUBNET!.!IP! --name !node! --hostname !node! client_node


rem *** ADD USER and CHANGE PASSWORDS ***
docker exec -ti !node! groupadd -g !gid! !user!

rem *** careful here (delete existing home folder? -- disable next line if not)***
docker exec -ti !node! rm -fr /home/!user!

docker exec -ti !node! mkdir -p /home/!user!

docker exec -ti !node! useradd -u !uid! -g !gid! -d /home/!user! -s /bin/bash !user!
docker exec -ti !node! chown -R !user!:!user! /home/!user!/
docker exec -ti !node! chmod o-r,o-w,o-x /home/!user!/

docker exec -ti -u !user! !node! mkdir -p /home/!user!/.vnc
docker exec -ti -u !user! !node! mkdir -p /home/!user!/Desktop
docker exec -ti -u !user! !node! cp /opt/seamonkey/Seamonkey.desktop /home/!user!/Desktop/

docker exec -ti -u !user! !node! /bin/bash -c "echo !passwd! | /opt/TurboVNC/bin/vncpasswd -f > /home/!user!/.vnc/passwd"
docker exec -ti -u !user! !node! chmod 600 /home/!user!/.vnc/passwd

docker exec -ti !node! /bin/bash -c "echo !user!:!passwd! | chpasswd"


rem *** sudo for user ? ***
docker exec -ti !node! usermod -aG sudo !user!

rem *** start user's VNC server ***
docker exec -u !user! !node! bash -c "/bin/startvnc"

rem *** SSHD for inside cluster comms only (for root from admin container) ***
docker exec !node! bash -c "service ssh start"

rem *** add client to PDSH list and hosts file on admin node ***
docker exec -ti admin bash -c "echo !node! >> /etc/pdsh/machines"
docker exec -ti admin bash -c "echo %SUBNET%.!IP! !node! >> /etc/hosts"
)

endlocal
@@ -0,0 +1,20 @@
@echo off
rem *** stop all cluster containers without destroying them ***

set USERLIST="userlist.txt"
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1 usebackq delims=. " %%a in (%USERLIST%) do (

set node=%%a
set user=!node!
docker exec -ti -u !user! !node! /opt/TurboVNC/bin/vncserver -kill :1
docker stop !node!

)

docker stop admin

docker ps -a

pause
@@ -0,0 +1,22 @@
@echo off

set USERLIST="userlist.txt"
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1 usebackq delims=. " %%a in (%USERLIST%) do (

set node=%%a
set user=!node!

docker start !node!
docker exec -u !user! !node! bash -c "/bin/startvnc"
docker exec !node! bash -c "service ssh start"

)

docker start admin
docker ps -a


pause
exit
@@ -0,0 +1,20 @@
@echo off

set USERLIST="userlist.txt"
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1 usebackq delims=. " %%a in (%USERLIST%) do (

set node=%%a
set user=!node!

docker pause !node!

)

docker pause admin
docker ps -a


pause
exit
@@ -0,0 +1,20 @@
@echo off

set USERLIST="userlist.txt"
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1 usebackq delims=. " %%a in (%USERLIST%) do (

set node=%%a
set user=!node!

docker unpause !node!

)

docker unpause admin
docker ps -a


pause
exit
@@ -0,0 +1,20 @@
@echo off

set USERLIST="userlist.txt"
setlocal ENABLEDELAYEDEXPANSION

FOR /F "tokens=1 usebackq delims=. " %%a in (%USERLIST%) do (

set node=%%a
set user=!node!

docker rm -f !node!

)

rem docker rm -f admin
docker ps -a


pause
exit
@@ -0,0 +1,60 @@
FROM ubuntu

ARG user=root

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install pdsh net-tools xfce4 wget build-essential cmake nano mc xfce4-terminal xterm bzip2 tar sudo git emacs openssh-server -y
RUN wget https://kumisystems.dl.sourceforge.net/project/turbovnc/3.0/turbovnc_3.0_amd64.deb
RUN dpkg -i turbovnc_3.0_amd64.deb

RUN rm -fr /usr/bin/xfce4-screensaver
RUN touch /usr/bin/xfce4-screensaver
RUN chmod +x /usr/bin/xfce4-screensaver

# pdsh stuff
RUN mkdir -p /etc/pdsh
RUN echo "export PDSH_RCMD_TYPE='ssh'">> /etc/bash.bashrc
RUN echo "export WCOLL=/etc/pdsh/machines" >> /etc/bash.bashrc

# ssh stuff for pdsh
RUN mkdir -p /root/.ssh
COPY id_rsa.pub /root/.ssh/
COPY id_rsa /root/.ssh/
RUN chmod 700 /root/.ssh
RUN chmod 600 /root/.ssh/id_rsa
RUN chmod 640 /root/.ssh/id_rsa.pub
RUN cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
RUN chmod 600 /root/.ssh/authorized_keys
RUN echo "StrictHostKeyChecking no" >> /root/.ssh/config
RUN chmod 600 /root/.ssh/config

# let's include seamonkey browser
RUN wget -c https://archive.mozilla.org/pub/seamonkey/releases/2.53.12/linux-x86_64/en-GB/seamonkey-2.53.12.en-GB.linux-x86_64.tar.bz2 -O /opt/seamonkey.tar.bz2
WORKDIR "/opt/"
RUN tar -xf seamonkey.tar.bz2
RUN rm -f /opt/seamonkey.tar.bz2
WORKDIR "/"
RUN mkdir -p /home/$user/Desktop
RUN echo "[Desktop Entry]\n \
Version=1.0\n \
Type=Application\n \
Name=Seamonkey\n \
Comment=Web Browser\n \
Exec=/opt/seamonkey/seamonkey\n \
Icon=web-browser\n \
Terminal=false" > /home/$user/Desktop/Seamonkey.desktop
RUN chmod +x /home/$user/Desktop/Seamonkey.desktop

# add vnc server easy startup
RUN echo "service ssh start" > /bin/startvnc
RUN echo "/opt/TurboVNC/bin/vncserver -fg :1'" > /bin/startvnc
RUN cat /bin/startvnc
RUN chmod +x /bin/startvnc

EXPOSE 5901
EXPOSE 22

# startup exe:
CMD /bin/bash

@@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA53uZv9Snd1XeoUQcPqo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oB1gFq4S//Fdcq2RyyEla1FzcfAPBzuyGMBd9muFRcvxTSw36LXcEDKbyxwi
QZ49l0kO+IN/sLOmJQMfSJ3xbPXjG4dsU3aV0reveRExDoDxN/yn2LpZ6P5WvWsGv+OJCB
lasuBc7rIpYIamTH00JfcENZQpRM6eWVpDUXY623SnyDPm0rLVkBDvfeRzyUC8FuzTnQL0
/m6VdaQSSu4JU0DQAAAA5hYTMwMkBFTlZZeDM2MAECAw==
-----END OPENSSH PRIVATE KEY-----
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDne5m/1Kd3Vd6hRBw+qgvT5/83+XuofK1u5Nk1Y4tLW6fDv6fATst5t0vWI8QHA16z+rLnsG9WaQ90xpVbEghJKtrIqm20Q1jRSfpwpwbJAPXBgEj86KLpv2heeY0jmsSQAaKJfQugY5mVJ+fGGS/gNlLOvviiSi+hl3gVPkYC8sHC7UuNy5BMrYMTkp2xz/1c0YFCxXPyKqcLTzBWWsfTQB0ozs9dfcXD0Q7gxlcQvwjU273NIIbhe7wGaxZJT+bjRCd5xKnqwNuX/fx7rS2E4/hd27UZodq0duXynedkUGR8r6iECVIN1yNTixyK5pUvJnefSrerB1kcDB4uLX+O0UoU0h/fuLrtJaLJhmuAZErYZ+JIeMDaB49jcTonKKS3k85qQrhX1MGlGJEUDkZdlOVr7T57KnM4us3kt7fmYefW2PkAkqpL68w+OjV/H6nQNdkG5We96i/m97FTKH5YireOgJ+L0zbmLG+/VarpAvTJdRELJwi81HZYpdO6Dp0= aa302@ENVYx360
@@ -0,0 +1,52 @@
FROM ubuntu


ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install pdsh net-tools xfce4 wget build-essential cmake nano mc xfce4-terminal xterm bzip2 tar sudo git emacs openssh-server -y
RUN wget https://kumisystems.dl.sourceforge.net/project/turbovnc/3.0/turbovnc_3.0_amd64.deb
RUN dpkg -i turbovnc_3.0_amd64.deb

RUN rm -fr /usr/bin/xfce4-screensaver
RUN touch /usr/bin/xfce4-screensaver
RUN chmod +x /usr/bin/xfce4-screensaver

# ssh stuff for root pdsh access from admin container
RUN mkdir -p /root/.ssh
COPY id_rsa.pub /root/.ssh/authorized_keys
RUN chmod 700 /root/.ssh
RUN chmod 600 /root/.ssh/authorized_keys



# let's include seamonkey browser
RUN wget -c https://archive.mozilla.org/pub/seamonkey/releases/2.53.12/linux-x86_64/en-GB/seamonkey-2.53.12.en-GB.linux-x86_64.tar.bz2 -O /opt/seamonkey.tar.bz2
WORKDIR "/opt/"
RUN tar -xvf seamonkey.tar.bz2
RUN rm -f /opt/seamonkey.tar.bz2

RUN echo "[Desktop Entry]\n \
Version=1.0\n \
Type=Application\n \
Name=Seamonkey\n \
Comment=Web Browser\n \
Exec=/opt/seamonkey/seamonkey\n \
Icon=web-browser\n \
Terminal=false" > /opt/seamonkey/Seamonkey.desktop
RUN chmod +x /opt/seamonkey/Seamonkey.desktop



# vnc server startup shortcut
RUN echo "/opt/TurboVNC/bin/vncserver :1" >> /bin/startvnc
RUN chmod +x /bin/startvnc

EXPOSE 5901
EXPOSE 22


# startup command:
CMD /bin/bash



0 comments on commit 2d077e6

Please sign in to comment.