From aeec8fb13e7cbfef566032b587e60ccd78ef51de Mon Sep 17 00:00:00 2001 From: "Xavier Pillons (MSFT)" Date: Thu, 28 Sep 2023 20:42:01 +0200 Subject: [PATCH] export PORT --- .../files/bc_rstudio/template/before.sh.erb | 8 +++++++- .../files/bc_rstudio/template/start_container.sh | 2 +- .../files/bc_rstudio/template/start_rstudio.sh | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/ood-applications/files/bc_rstudio/template/before.sh.erb b/playbooks/roles/ood-applications/files/bc_rstudio/template/before.sh.erb index 112069db0..83c8e21b1 100755 --- a/playbooks/roles/ood-applications/files/bc_rstudio/template/before.sh.erb +++ b/playbooks/roles/ood-applications/files/bc_rstudio/template/before.sh.erb @@ -3,4 +3,10 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" [[ $(type -t module) == "function" ]] && export -f module # Find available port to run server on -port=$(find_port ${host}) +export port=$(find_port ${host}) + +<%- if OodAppkit.clusters[context.cluster].job_config[:adapter] == 'pbspro' -%> +# TODO : Use the job ID for the container name +export CONTAINER_NAME=rstudio.$PBS_JOBID +$THIS_DIR/get_container.sh <%=context.container_image%> $CONTAINER_NAME +<%- end -%> diff --git a/playbooks/roles/ood-applications/files/bc_rstudio/template/start_container.sh b/playbooks/roles/ood-applications/files/bc_rstudio/template/start_container.sh index 7879dd2ac..c5ab35a32 100644 --- a/playbooks/roles/ood-applications/files/bc_rstudio/template/start_container.sh +++ b/playbooks/roles/ood-applications/files/bc_rstudio/template/start_container.sh @@ -7,6 +7,6 @@ container_name=$1 echo "container_name=$container_name" echo "enroot start" -enroot start --rw -e NOTEBOOK_ROOT="$NOTEBOOK_ROOT" -e CONFIG_FILE="$CONFIG_FILE" $container_name $THIS_DIR/start_rstudio.sh +enroot start --rw -e NOTEBOOK_ROOT="$NOTEBOOK_ROOT" -e CONFIG_FILE="$CONFIG_FILE" -e PORT="$port" $container_name $THIS_DIR/start_rstudio.sh echo "enroot remove" enroot remove -f $container_name diff --git a/playbooks/roles/ood-applications/files/bc_rstudio/template/start_rstudio.sh b/playbooks/roles/ood-applications/files/bc_rstudio/template/start_rstudio.sh index 07d7b1af6..29806f36a 100755 --- a/playbooks/roles/ood-applications/files/bc_rstudio/template/start_rstudio.sh +++ b/playbooks/roles/ood-applications/files/bc_rstudio/template/start_rstudio.sh @@ -12,4 +12,4 @@ EOF # Launch the Rstudio server set -x -/usr/lib/rstudio-server/bin/rserver --www-port ${port} +/usr/lib/rstudio-server/bin/rserver --www-port ${PORT}