Installation#
Traefik-proxy installation#
Install JupyterHub:
$ python3 -m pip install jupyterhub
Install jupyterhub-traefik-proxy, which is available now as pre-release:
python3 -m pip install jupyterhub-traefik-proxy
In order to be able to launch JupyterHub with traefik-proxy or run the tests, traefik, must first be installed and added to your
PATH
.There are two ways you can install traefik:
Through traefik-proxy’s install utility.
$ python3 -m jupyterhub_traefik_proxy.install --output=/usr/local/bin
This will install
traefik
.This will install the default versions of traefik, to to
/usr/local/bin
specified through the--output
option.If no directory is passed to the installer, a dependencies directory will be created in the
traefik-proxy
directory. In this case, you must add this directory toPATH
, e.g.$ export PATH=$PATH:{$PWD}/dependencies
If you want to install other versions of traefik in a directory of your choice, just specify it to the installer through the following arguments:
--traefik-version
--output
Example:
$ python3 -m jupyterhub_traefik_proxy.install --output=dep \ --traefik-version=2.4.8
If the desired install directory doesn’t exist, it will be created by the installer.
To get a list of all the available options:
$ python3 -m jupyterhub_traefik_proxy.install --help
From traefik release page:
Install
traefik
Installing a key-value store#
If you want to use a key-value store to mediate configuration (mainly for use in distributed deployments, such as containers), you can get etcd or consul via their respective release pages:
Or, more likely, select the appropriate container image. You will also need to install a Python client for the Key-Value store of your choice:
etcdpy
python-consul2
Enabling traefik-proxy in JupyterHub#
TraefikFileProviderProxy, TraefikEtcdProxy and TraefikConsulProxy are custom proxy implementations that subclass Proxy and can register in JupyterHub config using c.JupyterHub.proxy_class
entrypoint.
On startup, JupyterHub will look by default for a configuration file, jupyterhub_config.py, in the current working directory. If the configuration file is not in the current working directory, you can load a specific config file and start JupyterHub using:
$ jupyterhub -f /path/to/jupyterhub_config.py
There is an example configuration file here that configures JupyterHub to run with TraefikEtcdProxy as the proxy and uses dummyauthenticator and simplespawner to enable testing without administrative privileges.
In jupyterhub_config.py:
c.JupyterHub.proxy_class = "traefik_file"
# will configure JupyterHub to run with TraefikFileProviderProxy
c.JupyterHub.proxy_class = "traefik_etcd"
# will configure JupyterHub to run with TraefikEtcdProxy
c.JupyterHub.proxy_class = "traefik_consul"
# will configure JupyterHub to run with TraefikConsulProxy