diff --git a/deployBigMem.sh b/deployBigMem.sh index 44f4625edb441d67dd67dbd91ad7c67401559355..ab34a905cf2afa3c81a140ac534e18b0576d8f47 100644 --- a/deployBigMem.sh +++ b/deployBigMem.sh @@ -16,7 +16,6 @@ else esac fi - #nginx # HOST_NAME="192.168.100.49" diff --git a/deployBigMemCmdLine.sh b/deployBigMemCmdLine.sh new file mode 100644 index 0000000000000000000000000000000000000000..5afa55234e16ee9417da6d800b0a920d44863de8 --- /dev/null +++ b/deployBigMemCmdLine.sh @@ -0,0 +1,48 @@ +#!/bin/bash +#This script will help a deployment of a docker image on an MBB bigmem machine + + + +# Docker volumes +# MBB Workflows reads data from /Data and write results to /Results + + +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" + +config=$3 +cores=$4 + +if [ $# -lt 5 ] +then + APP_IMG="mbbteam/radseqdenovo:latest" +else + IMG_SRC=$5 + 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 exec --rm -it $DOCK_VOL $CONTAINER_ID snakemake -s /workflow/Snakefile all --configfile $config --cores $cores) + +if [ $CONTAINER_ID ] +then + echo " " + echo Results were written to : $3 + echo " " +else + echo Failed to run the docker container !! +fi diff --git a/deployBigMemInterface.sh b/deployBigMemInterface.sh new file mode 100644 index 0000000000000000000000000000000000000000..f416066d665b9913c4c81bf344ec2297f5fb7608 --- /dev/null +++ b/deployBigMemInterface.sh @@ -0,0 +1,92 @@ +#!/bin/bash +#This script will help a deployment of a docker image on an MBB bigmem machine + + +#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 : $2 + echo " " + echo Results will be written to : $3 + echo " " + hostname -I | awk -v port=$APP_PORT '{print "You can access the workflow interface at : http://"$1":"port}' + echo " " +else + echo Failed to run the docker container !! +fi