Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi notebook on same port. #1

Open
Carreau opened this issue Jan 2, 2013 · 7 comments
Open

Multi notebook on same port. #1

Carreau opened this issue Jan 2, 2013 · 7 comments

Comments

@Carreau
Copy link

Carreau commented Jan 2, 2013

Hi there,

I'm writting a small nodejs proxy that allows to have multiple IPython notebook server virtually listening on the same port, the routing is made thanks to URLs prefixes.

I was wondering if it was interesting you, as for example when most ports are blocked it is easier to have all user through one port.

I'm startig to develop it it here : https://github.com/Carreau/IPython-notebook-proxy
It works but is not really user-friendly right now.

I'll probably release under one of IPython repo.

I'm not sure of how well it behaves under high load.

@gsfr
Copy link

gsfr commented Jan 3, 2013

That sounds interesting, indeed. So far, we had to open a range of ports in our firewall to make this work. We do consider our current solution quite a hack, btw, but we needed to get going quickly.

You should coordinate with Fernando and his team, who are interested in implementing these features properly. They may have even started working on them already. See third objective here: http://ipython.org/sloan-grant.html

@Carreau
Copy link
Author

Carreau commented Jan 3, 2013

Hi,
Sorry, I should have precised that I was already in contact with Fernando. Actually I came here after discussing with Brian.

Of course in long term we want the notebook to support multiuser, but there are still a lot of work ahead before it is usable. So this is not a definitive solution. Node was the only way I found to proxy both http and websocket that potentially still works with https.

Anyway, it now works, it is not super user friendly bus as releasing a 0.0.1 on npm was much easier than I expected I did it yesterday night. It took me only half an hour where I was expecting day to understand the package management and registering myself on npm.

Next step would be to allow to pass uid/gid when starting subprocess, and hook the login mechanisme, as well as to test https.

link to post on ML

@rfdougherty
Copy link
Member

Hi Matthias,

I've finally gotten around to integrating your nodejs proxy into hydra. I've made some progress! I can get a proxy up on our server. It proxys the ipython server port fine-- I see the dashboard, but with all the static content missing. The browser indicates a bunch of 404 errors. E.g.:
GET http://cninb.stanford.edu:8080/static/ipynblogo.png?v=5892b 404 (Not Found)

Note that the proxy is routing /bobd/, so the first problem is that /bobd/ is missing from the URL, so it's not even hitting the proxy. If I correct the URL and enter it by hand, e.g.:
http://cninb.stanford.edu:8080/bobd/static/ipynblogo.png?v=5892b

I still get a 404 error. This time it definitely hit the proxy, as I also now get an error in the console running the proxy:
stderr bobd : WARNING:root:404 GET /bobd/static/ipynblogo.png?v=5892b (127.0.0.1) 0.33ms

Any thoughts? The main change to your code was to route the FQDN of our server (cninb.stanford.edu) instead of localhost.

cheers,
bob

@Carreau
Copy link
Author

Carreau commented Feb 25, 2013

Short from my phone.

If it's IPython 0.13.1 or before it's a bug.on ipython side (prefix url not
used for static files). I'll give you more info later.
Le 24 févr. 2013 23:31, "Bob Dougherty" [email protected] a écrit :

Hi Matthias,

I've finally gotten around to integrating your nodejs proxy into hydra.
I've made some progress! I can get a proxy up on our server. It proxys the
ipython server port fine-- I see the dashboard, but with all the static
content missing. The browser indicates a bunch of 404 errors. E.g.:
GET http://cninb.stanford.edu:8080/static/ipynblogo.png?v=5892b 404 (Not
Found)

Note that the proxy is routing /bobd/, so the first problem is that /bobd/
is missing from the URL, so it's not even hitting the proxy. If I correct
the URL and enter it by hand, e.g.:
http://cninb.stanford.edu:8080/bobd/static/ipynblogo.png?v=5892b

I still get a 404 error. This time it definitely hit the proxy, as I also
now get an error in the console running the proxy:
stderr bobd : WARNING:root:404 GET /bobd/static/ipynblogo.png?v=5892b
(127.0.0.1) 0.33ms

Any thoughts? The main change to your code was to route the FQDN of our
server (cninb.stanford.edu) instead of localhost.

cheers,
bob


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-14017773.

@Carreau
Copy link
Author

Carreau commented Feb 25, 2013

Ok, so, I think the issues are that the url prefix was not set in templates and a few other places : see issue ipython/ipython#2720 and PR ipython/ipython#2723
In the meantime if you do not wish to patch ipython, you can use something like :

add_rule('static', 8080) where 8080 is an always on IPython server (or else) that will server all the static resources for everyone.

@rfdougherty
Copy link
Member

Thanks! I switched to using the dev branch of ipython and this has fixed the issue. I've also now got it working over ssl by adding an https object with the cert and key files to the httpProxy.createServer call. So it now listens on https, but proxys to an unencrypted http ipython server (which is nice, since we get the security of SSL, but each user doesn't need their own cert and key). I'm now moving on the next hurdle-- demonizing it and having it update rules from a config file so that hydra can modify the rules as needed, without restarting the proxy.

@Carreau
Copy link
Author

Carreau commented Feb 26, 2013

Hi !

Happy this works. I'm kind of too much things to do right now, so if you wish I should be able to give you the admin right on the npm repo.

For demonizing, I would look at forever monitor

As for updating the rules from a config files, as think it is already part of the lib I used.
https://github.com/nodejitsu/node-http-proxy/blob/master/lib/node-http-proxy/proxy-table.js#L64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants