Multi-user server for Jupyter notebooks
Python JavaScript HTML Other
Latest commit 7e699af Jan 20, 2017 @willingc willingc committed on GitHub Merge pull request #953 from willingc/covfix
Rename test class to stub class to allow pytest collection

Closes #952
Permalink
Failed to load latest commit information.
.github Soften tone Nov 11, 2016
docs add api_token to services' properties Jan 15, 2017
examples simplify singleuser-service examples Jan 6, 2017
jupyterhub Rename class used in test cases to StubSingleUserSpawner Jan 20, 2017
onbuild move docker onbuild to directory Apr 21, 2016
scripts move singleuser script into the package May 31, 2016
share/jupyter/hub Updated Logos Sep 26, 2016
tools Remove zip from sdist build per PEP 527 Sep 1, 2016
.bowerrc move static files to share/jupyter/hub Dec 24, 2014
.coveragerc Omit alembic directory from report Jan 20, 2017
.dockerignore ignore node_modules Jan 25, 2016
.gitignore ignore generated rest-api html Aug 1, 2016
.travis.yml Merge pull request #953 from willingc/covfix Jan 20, 2017
CHECKLIST-Release.md Make the release checklist a GFM checklist Nov 11, 2016
CONTRIBUTING.md add CONTRIBUTING.md Mar 8, 2015
COPYING.md cleanup pass Aug 20, 2014
Dockerfile Update Dockerfile Nov 8, 2016
MANIFEST.in prune docs/node_modules Nov 13, 2016
README.md Update README to clarify docker image contents Dec 21, 2016
bower.json install js dependencies with npm Mar 5, 2015
circle.yml push tags on circleci Apr 25, 2016
dev-requirements.txt debug installation on travis Jul 28, 2016
package.json require clean-css 3.4.13 May 26, 2016
readthedocs.yml install nodejs with conda on RTD Jul 23, 2016
requirements.txt require alembic May 26, 2016
setup.py add alembic.ini to package_data Nov 22, 2016
setupegg.py make it a proper package Aug 21, 2014

README.md

Technical overview | Prerequisites | Installation | Running the Hub Server | Configuration | Docker | Contributing | License | Getting help

JupyterHub

Build Status Circle CI codecov.io " Documentation Status " Google Group

With JupyterHub you can create a multi-user Hub which spawns, manages, and proxies multiple instances of the single-user Jupyter notebook (IPython notebook) server.

JupyterHub provides single-user notebook servers to many users. For example, JupyterHub could serve notebooks to a class of students, a corporate workgroup, or a science research group.

by Project Jupyter


Technical overview

Three main actors make up JupyterHub:

  • multi-user Hub (tornado process)
  • configurable http proxy (node-http-proxy)
  • multiple single-user Jupyter notebook servers (Python/IPython/tornado)

JupyterHub's basic principles for operation are:

  • Hub spawns a proxy
  • Proxy forwards all requests to Hub by default
  • Hub handles login, and spawns single-user servers on demand
  • Hub configures proxy to forward url prefixes to the single-user servers

JupyterHub also provides a REST API for administration of the Hub and users.


Prerequisites

Before installing JupyterHub, you need:

  • Python 3.3 or greater

    An understanding of using pip for installing Python packages is recommended.

  • nodejs/npm

    Install nodejs/npm, which is available from your package manager. For example, install on Linux (Debian/Ubuntu) using:

    sudo apt-get install npm nodejs-legacy
    

    (The nodejs-legacy package installs the node executable and is currently required for npm to work on Debian/Ubuntu.)

  • TLS certificate and key for HTTPS communication

  • Domain name

Before running the single-user notebook servers (which may be on the same system as the Hub or not):

Installation

JupyterHub can be installed with pip, and the proxy with npm:

npm install -g configurable-http-proxy
pip3 install jupyterhub    

If you plan to run notebook servers locally, you will need to install the Jupyter notebook:

pip3 install --upgrade notebook

Running the Hub server

To start the Hub server, run the command:

jupyterhub

Visit https://localhost:8000 in your browser, and sign in with your unix credentials.

To allow multiple users to sign into the server, you will need to run the jupyterhub command as a privileged user, such as root. The wiki describes how to run the server as a less privileged user, which requires more configuration of the system.


Configuration

The getting started document contains the basics of configuring a JupyterHub deployment.

The JupyterHub tutorial provides a video and documentation that explains and illustrates the fundamental steps for installation and configuration. Repo | Tutorial documentation

Generate a default configuration file

Generate a default config file:

jupyterhub --generate-config

Customize the configuration, authentication, and process spawning

Spawn the server on 10.0.1.2:443 with https:

jupyterhub --ip 10.0.1.2 --port 443 --ssl-key my_ssl.key --ssl-cert my_ssl.cert

The authentication and process spawning mechanisms can be replaced, which should allow plugging into a variety of authentication or process control environments. Some examples, meant as illustration and testing of this concept:


Docker

A starter docker image for JupyterHub gives a baseline deployment of JupyterHub.

Important: This jupyterhub/jupyterhub image contains only the Hub itself, with no configuration. In general, one needs to make a derivative image, with at least a jupyterhub_config.py setting up an Authenticator and/or a Spawner. To run the single-user servers, which may be on the same system as the Hub or not, Jupyter Notebook version 4 or greater must be installed.

Starting JupyterHub with docker

The JupyterHub docker image can be started with the following command:

docker run -d --name jupyterhub jupyterhub/jupyterhub jupyterhub

This command will create a container named jupyterhub that you can stop and resume with docker stop/start.

The Hub service will be listening on all interfaces at port 8000, which makes this a good choice for testing JupyterHub on your desktop or laptop.

If you want to run docker on a computer that has a public IP then you should (as in MUST) secure it with ssl by adding ssl options to your docker configuration or using a ssl enabled proxy.

Mounting volumes will allow you to store data outside the docker image (host system) so it will be persistent, even when you start a new image.

The command docker exec -it jupyterhub bash will spawn a root shell in your docker container. You can use the root shell to create system users in the container. These accounts will be used for authentication in JupyterHub's default configuration.


Contributing

If you would like to contribute to the project, please read our contributor documentation and the CONTRIBUTING.md.

For a development install, clone the repository and then install from source:

git clone https://github.com/jupyterhub/jupyterhub
cd jupyterhub
pip3 install -r dev-requirements.txt -e .

If the pip3 install command fails and complains about lessc being unavailable, you may need to explicitly install some additional JavaScript dependencies:

npm install

This will fetch client-side JavaScript dependencies necessary to compile CSS.

You may also need to manually update JavaScript and CSS after some development updates, with:

python3 setup.py js    # fetch updated client-side js
python3 setup.py css   # recompile CSS from LESS sources

We use pytest for testing. To run tests:

pytest jupyterhub/tests

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

All code is licensed under the terms of the revised BSD license.

Getting help

We encourage you to ask questions on the mailing list, and you may participate in development discussions or get live help on Gitter.

Resources