[IPython-dev] Jupyterhub behind NGINX redirect
Clare Sloggett
claresloggett at gmail.com
Mon Nov 3 02:13:11 EST 2014
Hi all,
We've managed to troubleshoot our other issues, so I'm now sure that I can
run jupyterhub successfully *without* a redirect. So I'm back to trying to
get a redirect working. I've cc'd Nuwan who's been working on this with me
and probably understands the issues better than I do.
Currently, if I run something like
$ jupyterhub --port 9520 ----JupyterHubApp.hub_port=8500
then I can access JupyterHub at http://my-url:9520/ . So far, success! This
works fine, I can log in as various linux users, edit notebooks, etc.
What we'd like is for it to instead be available to users at
http://my-url/jupyter/ .
We assumed that the command-line option JupyterHubApp.base_url is supposed
to be used for this. We are trying to set up an NGINX redirect from
/jupyter/ to :9520 and run jupyterhub so that it behaves properly in this
situation. However JupyterHubApp.base_url doesn't seem to be doing what we
expect it to. Is anyone able to explain how this parameter is supposed to
be used?
Cheers,
Clare
On 28 October 2014 18:15, Clare Sloggett <claresloggett at gmail.com> wrote:
> Hi Min,
>
> Thanks for your help!
>
> Actually at the moment I have been pushed back to a more fundamental
> problem and can't even reproduce the error I was posting about in this
> email. I can't get jupyterhub to run at all. I posted this separate error
> in another thread, which I've just replied to a moment ago: "Error running
> JupyterHub".
>
> I suspect the issue is mine as I encountered it a few days ago and am
> still encountering it after updating to the latest commit. It seems
> unlikely a bug has survived through several commits without someone else
> discovering it too. But I'm having trouble working out what the cause is,
> and am not sure what to make of the error messages it's throwing (both
> python *and* javascript errors are thrown when it crashes). Full error
> printout is in that thread!
>
> Cheers,
> Clare
>
> On 26 October 2014 06:34, MinRK <benjaminrk at gmail.com> wrote:
>
>> Clare,
>>
>> Can you update to the latest master? I think the never-ending redirects
>> could be the result of a recently fixed typo.
>>
>> Thanks,
>> -MinRK
>>
>> On Thu, Oct 23, 2014 at 10:01 PM, Clare Sloggett <claresloggett at gmail.com
>> > wrote:
>>
>>> Hi Doug,
>>>
>>> Thanks for this. I had actually just been thinking about about the NGINX
>>> redirect issue, and had assumed everything behind that would be fairly
>>> straightforward. But it sounds like you are saying there may be more
>>> fundamental issues, and to be honest I haven't tested that the redirect is
>>> definitely the source of all my problems.
>>>
>>> It sounds like I need to do some more direct testing and come back!
>>>
>>> In the meantime, if anyone has insight into what could be causing a URL
>>> rewrite like "/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython...."
>>> that could be really helpful.
>>>
>>> Cheers,
>>> Clare
>>>
>>> On 13 October 2014 00:44, Doug Blank <doug.blank at gmail.com> wrote:
>>>
>>>> On Sun, Oct 12, 2014 at 1:35 AM, Clare Sloggett <
>>>> claresloggett at gmail.com> wrote:
>>>> >
>>>> > Hi all,
>>>> >
>>>> > Am I right in thinking this list is also the right place for
>>>> questions about Jupyterhub?
>>>> >
>>>> > I'm trying to set up Jupyterhub for multiple users, on the same
>>>> server where we are running several other services. Currently there are
>>>> NGINX redirects in place to these other services. I'd like to set up http://<public-url>/ipython/
>>>> to redirect to a port on localhost and run Jupyterhub over that port. Is
>>>> this possible?
>>>> >
>>>> > I've got this working in the past with single-user IPython Notebook.
>>>> For that, I set config options c.NotebookApp.base_project_url,
>>>> c.NotebookApp.base_kernel_url, and c.NotebookApp.webapp_settings to be
>>>> aware of the ipython/ URL prefix. We used an NGINX redirect to forward
>>>> requests and handle websockets properly, which looked like
>>>> >
>>>> > location /ipython/ {
>>>> > proxy_pass http://127.0.0.1:9510;
>>>> > proxy_set_header Host $host;
>>>> > proxy_set_header X-Real-IP $remote_addr;
>>>> > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>>>> > proxy_set_header Upgrade $http_upgrade;
>>>> > proxy_set_header Connection "upgrade";
>>>> > }
>>>> >
>>>> > This worked for the old single-user notebook. But, I'm not clear on
>>>> the model Jupyterhub is using (and I'm not much of a sysadmin). I read
>>>> through the command-line options, thought from them that I don't need to
>>>> strip the /ipython/ from the incoming requests, and have tried using a
>>>> similar redirect to the above and setting
>>>> --JupyterHubApp.base_url='ipython/' and also setting --port 9510. This does
>>>> seem to see the incoming requests but results in amusing requests like
>>>> >
>>>> > 500 GET
>>>> /ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/......
>>>> >
>>>> > ... so clearly I haven't understood what's going on. Does anyone have
>>>> any pointers on how this should work? I haven't read any docs other than
>>>> the README and the command-line parameter information, so apologies if
>>>> there's something obvious that I didn't look at.
>>>> >
>>>> > I'm also interested in running Jupyterhub as a daemon, so if that's
>>>> something that's been done before and there's anything I should know, that
>>>> would be great.
>>>>
>>>> There is one other document, other than the README.md and the reported
>>>> issues [1]:
>>>>
>>>>
>>>> https://github.com/jupyter/jupyterhub/wiki/Using-sudo-to-run-the-server-as-non-root
>>>>
>>>> Despite the warning at the top of that page, you can make jupyterhub
>>>> work on some systems (eg, Linux, such as Ubuntu) using sudo, but not as
>>>> root. I suspect that this would be the recommended setup when jupyterhub is
>>>> complete. One recent change is the ability to save/load state from a
>>>> database. The wiki page above hasn't been updated with the note from this
>>>> issue:
>>>>
>>>> https://github.com/jupyter/jupyterhub/issues/57
>>>>
>>>> It might be easier to start without NGINX, and then add it after you
>>>> have a working jupyterhub system. It would be nice to have a little bash
>>>> script to make this a "service" that would support "start", "top", and
>>>> "status"... but I haven't had time. Currently, we're just becoming the
>>>> non-root sudoer ("rhea" in the docs) and starting the server, something
>>>> along the lines:
>>>>
>>>> jupyterhub --LocalProcessSpawner.set_user=sudo
>>>> --JupyterHubApp.ip=165.106.10.83 --JupyterHubApp.port=80
>>>> --db='sqlite:///:memory:' &>> /var/log/jupyterhub/log &
>>>>
>>>> The next step for us is to get it running under https... looks like
>>>> others have blazed that trail, so it looks possible.
>>>>
>>>> If you have success, it would be great to add to the wiki docs... I
>>>> suspect that many of us that aren't sys admins will be wanting to get this
>>>> up and running.
>>>>
>>>> -Doug
>>>>
>>>> [1] - https://github.com/jupyter/jupyterhub
>>>>
>>>> > Any help much appreciated!
>>>> >
>>>> > Clare
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > IPython-dev mailing list
>>>> > IPython-dev at scipy.org
>>>> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>> >
>>>>
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>
>>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141103/21cd1b96/attachment.html>
More information about the IPython-dev
mailing list