generated from interTwin-eu/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change-values.sh
executable file
·47 lines (38 loc) · 1.72 KB
/
change-values.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
#!/bin/bash
# create a copy of the file jupyter_template.py
cp jupyter_template.py jupyterhubcustomconfig.py
cp values_template.yaml values.yaml
source .env
# change those values with the ones you want
HOSTNAME="jhub.131.154.98.62.myip.cloud.infn.it"
# values inside jupyter_template.py
IAM_SERVER="https://iam.cloud.infn.it"
CALLBACK_URL="https://$HOSTNAME:443/hub/oauth_callback"
JHUB_HOST="$HOSTNAME"
JHUB_PORT="443"
JHUB_API_URL="https://$HOSTNAME/hub/api"
sed -i "s|__CALLBACK_URL__|\"$CALLBACK_URL\"|g" jupyterhubcustomconfig.py
sed -i "s|__IAM_SERVER__|\"$IAM_SERVER\"|g" jupyterhubcustomconfig.py
sed -i "s|__CLIENT_ID__|\"$CLIENT_ID\"|g" jupyterhubcustomconfig.py
sed -i "s|__CLIENT_SECRET__|\"$CLIENT_SECRET\"|g" jupyterhubcustomconfig.py
sed -i "s|__COOKIE_SECRET__|\"$COOKIE_SECRET\"|g" jupyterhubcustomconfig.py
sed -i "s|__JHUB_HOST__|\"$JHUB_HOST\"|g" jupyterhubcustomconfig.py
sed -i "s|__JHUB_IP__|\"$HOSTNAME\"|g" jupyterhubcustomconfig.py
sed -i "s|__JHUB_PORT__|\"$JHUB_PORT\"|g" jupyterhubcustomconfig.py
sed -i "s|__JHUB_API_URL__|\"$JHUB_API_URL\"|g" jupyterhubcustomconfig.py
# values inside values.yaml
JHUB_URL="https://$HOSTNAME:443"
NAMESPACE="helm-jhub-namespace"
RELEASE="helm-jhub-release"
sed -i "s|__JHUB_URL__|\"$JHUB_URL\"|g" values.yaml
sed -i "s|__JHUB_HOSTNAME__|\"$JHUB_HOST\"|g" values.yaml
sed -i "s|__NAMESPACE__|$NAMESPACE|g" values.yaml
sed -i "s|__RELEASE__|\"$RELEASE\"|g" values.yaml
sed -i "s|__CALLBACK_URL__|\"$CALLBACK_URL\"|g" values.yaml
sed -i "s|__IAM_SERVER__|\"$IAM_SERVER\"|g" values.yaml
sed -i "s|__COOKIE_SECRET__|$COOKIE_SECRET|g" values.yaml
# check if jhub folder exists, if not create it
if [ ! -d "jhub" ]; then
mkdir jhub
fi
mv jupyterhubcustomconfig.py jhub/jupyterhubcustomconfig.py