Skip to content

Instantly share code, notes, and snippets.

@jgwerner
Last active October 9, 2017 14:06
Show Gist options
  • Save jgwerner/18bb71cc3427d98b33ea to your computer and use it in GitHub Desktop.
Save jgwerner/18bb71cc3427d98b33ea to your computer and use it in GitHub Desktop.
Clean setup for JupyterHub demo
# Installs new JupyterHub with Ubuntu 14.04 (Trusty) on host
# with self signed SSL certificate. Change SSL section
# to incorporate procedure for signing with trusted CA.
#!/bin/bash
# make install dir
mkdir /home/ubuntu/install-host
# set environment vars
export INSTALLDIR=/home/ubuntu/install-host
export GITCLONE=$INSTALLDIR/3BladesJupyter
export WORKINGDIR=/srv/jupyterhub
mkdir /home/ubuntu/install-host
cd /home/ubuntu/install-host
# clone repo
git clone https://github.com/minrk/jupyterhub-demo.git
# make jupyterhub app root directory
mkdir /srv
mkdir /srv/jupyterhub
# make new ssl files
cd /home/ubuntu/install-host/jupyterhub-demo/ssl
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out ssl.key
rm server.pass.key
openssl req -new -key ssl.key -out ssl.csr
openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt
# copy files from cloned git to jupyterhub directory and cd into it
cp -r /home/ubuntu/install-host/jupyterhub-demo/. $WORKINGDIR
# copy jupyterhub_config.py, env and userlist to working directory
# repalace with valid env, userlist, jupyterhub_config.py,
# systemuserspawner.py if necessary
cp systemuserspawner.py $WORKINGDIR/src/dockerspawner/dockerspawner/systemuser.py
cp env $WORKINGDIR/env
cp userlist $WORKINGDIR/userlist
cp jupyterhub_config.py $WORKINGDIR/jupyterhub_config.py
# run install
cd $WORKINGDIR
sh install.sh
# configure server
./configure.sh
# sometimes server fails to start with configure.sh
supervisorctl stop jupyterhub
supervisorctl start jupyterhub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment