From 962813e50b53494badf038c31d6187a4a9bf3175 Mon Sep 17 00:00:00 2001 From: khalid belkhir <khalid.belkhir@univ-montp2.fr> Date: Mon, 16 Dec 2019 09:11:41 +0100 Subject: [PATCH] Only One file --- deployBigMem.sh | 67 +++++++++++++-------------- deployBigMemInterface.sh | 97 ---------------------------------------- 2 files changed, 34 insertions(+), 130 deletions(-) delete mode 100644 deployBigMemInterface.sh diff --git a/deployBigMem.sh b/deployBigMem.sh index ab34a90..11b6bf4 100644 --- a/deployBigMem.sh +++ b/deployBigMem.sh @@ -1,22 +1,14 @@ #!/bin/bash #This script will help a deployment of a docker image on an MBB bigmem machine -if [ $# -lt 1 ] + +if [ $# -lt 2 ] then - APP_IMG="mbbteam/rnaseqde:latest" -else - IMG_SRC=$1 - case $IMG_SRC in - docker ) - APP_IMG="mbbteam/rnaseqde:latest" ;; - local) - docker build . -t rnaseqde:latest - APP_IMG="rnaseqde:latest" ;; - mbb) - #APP_IMG="X.X.X.X:5000/rnaseqde:latest" ;; - esac + echo usage : $0 dataDir resultsDir '[dockerHub|local]' + exit fi - #nginx +##### nginx install ##### +#sudo apt-get install -y nginx # HOST_NAME="192.168.100.49" @@ -60,37 +52,46 @@ then fi # Docker volumes -#realUSER=$(who am i | awk '{print $1}') -if [ $SUDO_USER ]; then realUSER=$SUDO_USER; else realUSER=`whoami`; fi -VOL_DEV=/media/bigvol/$realUSER # MBB Workflows reads data from /Data and write results to /Results -mkdir -p ${VOL_DEV}/Data -mkdir -p ${VOL_DEV}/Results -DOCK_VOL+=" --mount type=bind,src=$VOL_DEV/Data,dst=/Data" -DOCK_VOL+=" --mount type=bind,src=$VOL_DEV/Results,dst=/Results" +if [ $SUDO_USER ]; then realUSER=$SUDO_USER; else realUSER=`whoami`; fi + +Data=$1 +Results=$2 + +mkdir -p $Data +mkdir -p $Results + +DOCK_VOL+=" --mount type=bind,src=$Data,dst=/Data" +DOCK_VOL+=" --mount type=bind,src=$Results/Results,dst=/Results" + +if [ $# -lt 3 ] +then + APP_IMG="mbbteam/radseqdenovo:latest" +else + IMG_SRC=$3 + case $IMG_SRC in + docker ) + APP_IMG="mbbteam/radseqdenovo:latest" ;; + local) + docker build . -t radseqdenovo:latest + APP_IMG="radseqdenovo:latest" ;; + mbb) + #APP_IMG="X.X.X.X:5000/radseqdenovo:latest" ;; + esac +fi CONTAINER_ID=$( docker run --rm -d -p $APP_PORT:3838 $DOCK_VOL $APP_IMG ) if [ $CONTAINER_ID ] then echo " " - echo You have to put your Data on : ${VOL_DEV}/Data + echo You have to put your Data on : $1 echo " " - echo Results will be written to : ${VOL_DEV}/Results + echo Results will be written to : $2 echo " " hostname -I | awk -v port=$APP_PORT '{print "You can access the workflow interface at : http://"$1":"port}' echo " " echo To start a Bash session inside the container : docker exec -it $CONTAINER_ID /bin/bash - echo " " - echo To run the workflow without the interface : docker exec -it $CONTAINER_ID snakemake -s /workflow/Snakefile all --configfile config --cores XX - echo " " - echo config est un fichier de configuration qui doit être dans un sous dossier de ${VOL_DEV}/Data ou ${VOL_DEV}/Results - echo " " - echo ex. si fichier dans ${VOL_DEV}/Data/run1/maconfig1.yml : docker exec -it $CONTAINER_ID snakemake -s /workflow/Snakefile all --configfile /Data/run1/maconfig1.yml --cores XX - echo " " - echo Vous pouvez utiliser l''interface graphique pour générer un fichier de configuration. - echo " " - echo XX étant le nombre de coeurs qui seront utilisés par le workflow. else echo Failed to run the docker container !! fi diff --git a/deployBigMemInterface.sh b/deployBigMemInterface.sh deleted file mode 100644 index 11b6bf4..0000000 --- a/deployBigMemInterface.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -#This script will help a deployment of a docker image on an MBB bigmem machine - -if [ $# -lt 2 ] -then - echo usage : $0 dataDir resultsDir '[dockerHub|local]' - exit -fi -#nginx -##### nginx install ##### -#sudo apt-get install -y nginx - - # HOST_NAME="192.168.100.49" - - # HTTP_ENDP="https://$HOST_NAME" - - # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -subj "/C=FR/ST=LR/L=Montpellier/O=CNRS/OU=CNRS-ISEM/CN=mbb.univ-montp2.fr" - # openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 - - # mkdir -p /etc/nginx/snippets - # echo "ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;" > /etc/nginx/snippets/self-signed.conf - # echo "ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" >> /etc/nginx/snippets/self-signed.conf - - # cp system/nginx_snippets_ssl-params.conf /etc/nginx/snippets/ssl-params.conf - - # cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak - - # cp system/nginx_sites-available_default /etc/nginx/sites-available/default - # sed -i "s|server_domain_or_IP|$HOST_NAME|" /etc/nginx/sites-available/default - - # useradd nginx - # cp system/nginx_nginx.conf /etc/nginx/nginx.conf - - # cp system/nginx_conf.d_10-rstudio.conf /etc/nginx/conf.d/10-rstudio.conf - # sed -i "s|example.com|$HOST_NAME|" /etc/nginx/conf.d/10-rstudio.conf - - # systemctl restart nginx - # systemctl enable nginx - -#essayer une plage de ports entre 8787 et 8800 -#APP_PORT=$2 -APP_PORT=8787 -while [[ $(ss -tulw | grep $APP_PORT) != "" && $APP_PORT < 8800 ]] -do - APP_PORT=$(( $APP_PORT + 1)) -done - -if [[ $(ss -tulw | grep $APP_PORT) != "" ]] -then - echo "No tcp port available !!" - exit -1 -fi - -# Docker volumes -# MBB Workflows reads data from /Data and write results to /Results - -if [ $SUDO_USER ]; then realUSER=$SUDO_USER; else realUSER=`whoami`; fi - -Data=$1 -Results=$2 - -mkdir -p $Data -mkdir -p $Results - -DOCK_VOL+=" --mount type=bind,src=$Data,dst=/Data" -DOCK_VOL+=" --mount type=bind,src=$Results/Results,dst=/Results" - -if [ $# -lt 3 ] -then - APP_IMG="mbbteam/radseqdenovo:latest" -else - IMG_SRC=$3 - case $IMG_SRC in - docker ) - APP_IMG="mbbteam/radseqdenovo:latest" ;; - local) - docker build . -t radseqdenovo:latest - APP_IMG="radseqdenovo:latest" ;; - mbb) - #APP_IMG="X.X.X.X:5000/radseqdenovo:latest" ;; - esac -fi - -CONTAINER_ID=$( docker run --rm -d -p $APP_PORT:3838 $DOCK_VOL $APP_IMG ) -if [ $CONTAINER_ID ] -then - echo " " - echo You have to put your Data on : $1 - echo " " - echo Results will be written to : $2 - echo " " - hostname -I | awk -v port=$APP_PORT '{print "You can access the workflow interface at : http://"$1":"port}' - echo " " - echo To start a Bash session inside the container : docker exec -it $CONTAINER_ID /bin/bash -else - echo Failed to run the docker container !! -fi -- GitLab