-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Tacc specific startup script #455
base: master
Are you sure you want to change the base?
Conversation
reverted start-mspass.sh to original startup script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for contributing your code! This is very good and I actually learned something new here: the way of creating a random password for Jupyter is very cool. Please read my inline comments and let me know what you think. Thank you!
Dockerfile
Outdated
@@ -203,6 +203,7 @@ RUN chmod +x /usr/sbin/tini | |||
|
|||
# Add startup script | |||
ADD scripts/start-mspass.sh /usr/sbin/start-mspass.sh | |||
ADD scripts/start-mspass-tacc.sh /usr/sbin/start-mspass-tacc.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't necessarily want to include that script here in the main container image.
scripts/start-mspass-tacc.sh
Outdated
## Creating reverse tunnel port to login nodes | ||
NODE_HOSTNAME=`hostname -s` > /dev/null 2>&1 | ||
LOGIN_PORT=`echo $NODE_HOSTNAME | perl -ne 'print (($2+1).$3.$1) if /c\d(\d\d)-(\d)(\d\d)/;'` > /dev/null 2>&1 | ||
STATUS_PORT=$(($LOGIN_PORT + 1)) | ||
echo "got login node port $LOGIN_PORT" | ||
echo "got status node port $STATUS_PORT" | ||
# create reverse tunnel port to login nodes. Make one tunnel for each login so the user can just | ||
# connect to stampede.tacc | ||
for i in `seq 4`; do | ||
ssh -q -f -g -N -R $LOGIN_PORT:$NODE_HOSTNAME:8888 login$i > /dev/null 2>&1 | ||
ssh -q -f -g -N -R $STATUS_PORT:$NODE_HOSTNAME:8787 login$i > /dev/null 2>&1 | ||
done | ||
# creating notebook password, giving link | ||
MSPASS_JUPYTER_PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1) | ||
echo "Created reverse ports on Stampede2 logins" | ||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - | ||
echo "Welcome to the MsPASS for Tapis" | sed -e :a -e "s/^.\{1,$(tput cols)\}$/ & /;ta" | tr -d '\n' | head -c $(tput cols); echo -e "\n" | ||
echo "The Link below will open a MsPASS Jupyter Notebook" | sed -e :a -e "s/^.\{1,$(tput cols)\}$/ & /;ta" | tr -d '\n' | head -c $(tput cols);echo -e "\n" | ||
echo "http://frontera.tacc.utexas.edu:$LOGIN_PORT/lab?token=$MSPASS_JUPYTER_PWD"| sed -e :a -e "s/^.\{1,$(tput cols)\}$/ & /;ta" | tr -d '\n' | head -c $(tput cols);echo -e "\n" | ||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my understanding, the lines here are newly added, right? There is some new handling of the Jupyter's URL compared to the one in
mspass/scripts/tacc_examples/single_node.sh
Lines 31 to 42 in 23898f4
NODE_HOSTNAME=`hostname -s` | |
LOGIN_PORT=`echo $NODE_HOSTNAME | perl -ne 'print (($2+1).$3.$1) if /c\d(\d\d)-(\d)(\d\d)/;'` | |
STATUS_PORT=`echo "$LOGIN_PORT + 1" | bc -l` | |
echo "got login node port $LOGIN_PORT" | |
# create reverse tunnel port to login nodes. Make one tunnel for each login so the user can just | |
# connect to stampede.tacc | |
for i in `seq 4`; do | |
ssh -q -f -g -N -R $LOGIN_PORT:$NODE_HOSTNAME:8888 login$i | |
ssh -q -f -g -N -R $STATUS_PORT:$NODE_HOSTNAME:8787 login$i | |
done | |
echo "Created reverse ports on Stampede2 logins" |
What I would suggest is instead of handling the URL here inside of the startup script of the container, we should do it inside the job script instead (i.e., single_node.sh and distributed_node.sh). Then, we don't need to create a dedicated container for this specific purpose anymore.
Obviously, this do mean that we need to change how the main container is built so that we could specify a password by giving it an environment variable, and I do agree that we should incorporate that change inside the mspass container in general.
I can see that doing it inside of the job script means that we need some additional mechanism inside Tapis to change how containers are launched. We can discuss that further in our next meeting, but for the MsPASS repo, I figured it is better to use job script instead of creating dedicated container image.
No description provided.