-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdeploy-multiple-jupyterhub.sh
executable file
·67 lines (52 loc) · 1.39 KB
/
deploy-multiple-jupyterhub.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Script must be passed input file with course descriptions.
if [ "$#" -lt 1 ]; then
echo "USAGE: `basename $0` courses-file [args]" 1>&2
exit 1
fi
COURSES_FILE=$1
shift
if [ "$#" -ge 1 ]; then
LDAP_SEARCH_USER=$1
shift
else
read -p "LDAP Search User: " LDAP_SEARCH_USER
fi
if [ "$#" -ge 1 ]; then
LDAP_SEARCH_PASSWORD=$1
shift
else
read -s -p "LDAP Search Password: " LDAP_SEARCH_PASSWORD
echo
fi
if [ "$#" -ge 1 ]; then
JUPYTERHUB_ADMIN_USERS=$1
shift
else
read -p "JupyterHub Admin Users: " JUPYTERHUB_ADMIN_USERS
fi
if [ "$#" -ge 1 ]; then
PROJECT_RESOURCES=$1
shift
else
read -p "Project Resources: " PROJECT_RESOURCES
fi
if [ x"$CONTINUE_PROMPT" != x"n" ]; then
read -p "Continue? [Y/n] " DO_UPDATE
fi
if ! [[ $DO_UPDATE =~ ^[Yy]?$ ]]; then
exit 1
fi
export DO_UPDATE
export CONTINUE_PROMPT=n
# Iterate over course details from input file and create each one.
while IFS=, read -r COURSE_NAME NOTEBOOK_REPOSITORY_URL \
NOTEBOOK_REPOSITORY_CONTEXT_DIR NOTEBOOK_REPOSITORY_REFERENCE
do
echo "INFO: Creating course $COURSE_NAME."
`dirname $0`/deploy-jupyterhub.sh "$COURSE_NAME" \
"$NOTEBOOK_REPOSITORY_URL" "$NOTEBOOK_REPOSITORY_CONTEXT_DIR" \
"$NOTEBOOK_REPOSITORY_REFERENCE" "$LDAP_SEARCH_USER" \
"$LDAP_SEARCH_PASSWORD" "$JUPYTERHUB_ADMIN_USERS" \
"$PROJECT_RESOURCES"
done < $COURSES_FILE