- Spin up an AWS/Azure/GCP machine (Ubuntu - 16.04)
- ensure you know how to use the web-interface of these IaaS to open ports for an instance
- open ports 80, 443, 8000, 8888
- Follow this link
- Create a dir (.jupyterhub) which shall contain jupyterhub specific files
mkdir .jupyterhub
cd .jupyterhub
jupyterhub --generate-config
openssl rand -hex 8 > jupyterhub_cookie_secret
- Config file edits
vim jupyterhub_config.py
-
c.Authenticator.admin_users = {'<username>'} c.JupyterHub.admin_access = True c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_secret' c.JupyterHub.logo_file = '/home/play/tmp/playment_logo_32x32.png' origin = '*' c.JupyterHub.tornado_settings = { 'headers': { 'Access-Control-Allow-Origin': origin, }, } c.Spawner.args = ['--NotebookApp.allow_origin={0}'.format(origin)]
- Server Run
sudo jupyterhub
to check if the server runs fine. Default ip=127.0.0.1 and port=8000- OR
sudo jupyterhub --ip=127.0.0.1 --port=<port_number>
- Open your browser
- type
<instance_ip>:8000
in your browser to see if you can access the - to get your instance_ip, go to your command line and type
curl ipecho.net/plain
- type
- One can also setup OAuth
- One cal also setup Jupyter extensions
-
sudo jupyter contrib nbextension install --system --symlink --debug sudo chmod -R 0777 /usr/local/etc/jupyter/nbconfig
vim jupyterhub_config.py
import os os.environ['JUPYTER_CONFIG_DIR'] = '/usr/local/etc/jupyter/nbconfig' c.Spawner.env_keep.append('JUPYTER_CONFIG_DIR')
-
- Install nginx
- Open
/etc/nginx/sites-enabled/default
- Add the following configuration
-
upstream notebook { server 127.0.0.1:8000; #this should be the ip:port where you jupyterhub is running } # redirect http --> https server { listen 80; server_name <domain_name>; # redirects both www and non-www to https return 301 https://<domain_name>$request_uri; } server{ # listen 80; listen 443 ssl; server_name <domain_name> <ip>; ssl_certificate <>.pem; # managed by Certbot ssl_certificate_key <>.pem; # managed by Certbot location / { proxy_pass http://notebook; proxy_set_header Host $host; } location ~ /api/kernels/ { proxy_pass http://notebook; proxy_set_header Host $host; # websocket support proxy_http_version 1.1; proxy_set_header Upgrade "websocket"; proxy_set_header Connection "Upgrade"; proxy_read_timeout 86400; } location ~ /terminals/ { proxy_pass http://notebook; proxy_set_header Host $host; # websocket support proxy_http_version 1.1; proxy_set_header Upgrade "websocket"; proxy_set_header Connection "Upgrade"; proxy_read_timeout 86400; } }
- To get credentials follow this link