How to add additional custom routes?

31 views
Skip to first unread message

Bas Harenslak

unread,
Feb 2, 2018, 10:18:03 AM2/2/18
to Project Jupyter
Hi,

I've written an AWS EMR spawner which spins up an EMR cluster for each user and starts a notebook server on the master node. An ssh tunnel is created to route traffic from the notebook on the master node to a random local port on the jupyterhub machine. This works, however I cannot figure out how to add additional routes to view the EMR web interfaces.

My idea was to create routes such as:
  • /emr-services/[username]/hue -> random port jupyterhub machine -> masternode:8888
  • /emr-services/[username]/yarn-rm -> random port jupyterhub machine -> masternode:8088
  • /emr-services/[username]/hdfs-namenode -> random port jupyterhub machine -> masternode:50070
I thought it'd be best to create /emr-services/[username]/* routes to not intervene with anything at /user/[username]/*.

At this point I'm stuck. I've implemented a custom spawner which creates ssh tunnels for all admin uis during starting the notebook. The /user/[username] -> notebook route is added in Proxy.add_user(). I've overridden this method to add additional custom routes and see my route being created and http requests being redirected in the logs:

14:43:49.422 - info: [ConfigProxy] Adding route /emr-services/bas/hue -> 127.0.0.1:12345
14:43:49.422 - info: [ConfigProxy] 201 POST /api/routes/emr-services/bas/hue

[I 2018-02-02 14:59:19.730 JupyterHub log:124] 302 GET /emr-services/bas/hue → /hub/emr-services/bas/hue (@46.44.168.252) 0.60ms
[W 2018-02-02 14:59:19.791 JupyterHub log:124] 404 GET /hub/emr-services/bas/hue (b...@46.44.168.252) 9.32ms

curl -L localhost:12345 on the jupyterhub machine gives me the Hue UI, but browsing to http://jupyterhub-machine/emr-services/bas/hue gives me a 404.

Any idea what I'm missing?
Reply all
Reply to author
Forward
0 new messages