-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·49 lines (38 loc) · 1.26 KB
/
setup.sh
File metadata and controls
executable file
·49 lines (38 loc) · 1.26 KB
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
#!/bin/bash
[ -d home ] || mkdir home
[ -d keys ] || mkdir keys
## Self-signed certificates can be generated according to
## https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#using-ssl-for-encrypted-communication
openssl req -x509 -nodes \
-days 365 \
-newkey rsa:2048 \
-keyout keys/mykey.key \
-out keys/mycert.pem \
-subj "/C=US/ST=A/L=B/O=C/OU=D/CN=F"
## The binary at ucsb.box.com (created using pyinstaller) hashes a password according to
## https://jupyter-notebook.readthedocs.io/en/stable/public_server.html#preparing-a-hashed-password
wget -nc https://ucsb.box.com/shared/static/0g291d3aw5fpl0j7j02kyrnm3zuutaqu \
-O hash_password && \
chmod u+x hash_password
# https://github.com/docker/compose/issues/4223#issuecomment-280077263
# https://docs.docker.com/compose/environment-variables/
cat <<EOF > .env
## generated by setup.sh
## compose variables
IMAGE=base-scipy-rstudio
HOST_DIR=${PWD}/home
CERT_DIR=${PWD}/keys
PASSWD=$(./hash_password)
DOCKER_ORG=syoh/
EOF
cat <<EOF > env_file
## generated by setup.sh
## container instance variables
## i.e. environment section in docker-compose.yml
NB_UID=$(id -u)
NB_GID=$(id -g)
JUPYTER_ENABLE_LAB=yes
GRANT_SUDO=yes
## CHOWN_EXTRA='/opt/conda'
## CHOWN_EXTRA_OPTS='-R'
EOF