From 56b7d239405252df29c5295c4ba92a9150f37887 Mon Sep 17 00:00:00 2001 From: Dinindu Senanayake Date: Mon, 1 Jul 2024 12:57:16 +1200 Subject: [PATCH] update all template scripts to check port status --- submit.yml.erb | 2 +- template/before.sh.erb | 8 ++++---- template/script.sh.erb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/submit.yml.erb b/submit.yml.erb index 0ccf1fe..33148fa 100644 --- a/submit.yml.erb +++ b/submit.yml.erb @@ -10,7 +10,7 @@ script: native: container: name: "codeserver" - image: "ghcr.io/nesi/training-environment-codeserver-app:v0.1.5" + image: "ghcr.io/nesi/training-environment-codeserver-app:v0.1.6" command: ["/bin/bash","-l","<%= staged_root %>/job_script_content.sh"] restart_policy: 'OnFailure' env: diff --git a/template/before.sh.erb b/template/before.sh.erb index e1d1cf0..dc9334c 100755 --- a/template/before.sh.erb +++ b/template/before.sh.erb @@ -5,11 +5,11 @@ exec &> >(tee -a "pod.log") # Export the module function if it exists [[ $(type -t module) == "function" ]] && export -f module -# Find available port to run server on -export port=$(find_port ${host}) +export host="$HOST_CFG" +export port="$PORT_CFG" -# Export compute node the script is running on -export host="${host}" +echo "host is: ${host}" +echo "port is: ${port}" # Generate SHA1 encrypted password (requires OpenSSL installed) export password="$(create_passwd 16)" diff --git a/template/script.sh.erb b/template/script.sh.erb index 415459f..510e58d 100755 --- a/template/script.sh.erb +++ b/template/script.sh.erb @@ -18,7 +18,7 @@ mkdir -p "$CODE_SERVER_DATAROOT/extensions" export PASSWORD="$password" # Print compute node. -echo "$(date): Running on compute node ${compute_node}:$port" +echo "$(date): Running on compute node ${host}:$port" #Probably not needed but leaving as it is for the moment as per upstream record. @@ -47,7 +47,7 @@ echo "" code-server \ --auth="password" \ - --bind-addr="0.0.0.0:8443" \ + --bind-addr="${host}:8443" \ --disable-telemetry \ --user-data-dir="${CODE_SERVER_DATAROOT}" \ --log debug