Skip to content

Latest commit

 

History

History
68 lines (42 loc) · 1.71 KB

07-using-a-different-proxy-traefik.md

File metadata and controls

68 lines (42 loc) · 1.71 KB

Using a Different Proxy (Traefik)

Setting up Traefik Proxy

Let's use the Traefik proxy instead of configurable-http-proxy.

Install the Traefik Python API:

python3 -m pip install jupyterhub-traefik-proxy

Note: traefik is a binary. JupyterHub Traefik Proxy PTrTython package doesn't install traefik but has a handy command to bootstrap it.Traefik is installed.

Downloads the Traefik binary (any other method of downloading this binary is fine!):

sudo python3 -m jupyterhub_traefik_proxy.install --output=/usr/local/bin

Tell JupyterHub to use Traefik for the reverse proxy.

Edit jupyterhub_config.py:

c.JupyterHub.proxy_class = 'traefik_toml'

Generate a secret using openssl rand -hex 32.

c.TraefikTomlProxy.traefik_api_username = 'traefik'
c.TraefikTomlProxy.traefik_api_password = 'place_secret_here'

Restart JupyterHub.

Traefik is now running. JupyterHub is starting the proxy.

Potential discussion points:

  • Discuss what a proxy is
  • Diagram of different routes

JupyterHub is a tool for starting endpoints and creating a proxy to route requests.

The proxy is a customisable endpoint.

  • show current routes
  • add a new route
  • remove an existing route

Routing must be done on a longest prefix basis. Route for / and everything else is below. Let JupyterHub have a base route and user routes adds specificity.


Key Concepts

Learned:

Run the proxy external to the hub. Restarting jupyterhub restarts everything. So that users can still talk to their running servers without involving the hub while it restarts, we want to run the proxy external to the hub.


Extend your learning


Next: Setting Up HTTPS