jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.04k stars 341 forks source link

TLJH always serves /hub/ regardless of base_url parameter in config.yaml #722

Closed OffensiveGeneric closed 2 years ago

OffensiveGeneric commented 3 years ago

Update by Erik - 2021-10-26

This was also reported in #655 with relevant logs.

Bug description

I am running a TLJH server on Ubuntu 20.04.3 LTS (Focal Fossa). I would like the login to be available at a path on a subdomain I own, some.domain.org/jupyter/hub (and eventually be able to serve a page at /jupyter that lists some other hubs). After searching for a while, I know that I should be able to do this with sudo tljh-config set base_url /jupyter and then sudo tljh-config reload proxy. Doing this makes sudo tljh-config show show correctly that the config.yaml file has been changed, but upon inspection, nothing in the traefik rules.toml has been updated (that is, the file still looks like)

[frontends.frontend__2F.routes.test]
rule = "PathPrefix:/"
data = "{\"hub\": true}"

What's going on here? Any workarounds?

Expected behaviour

sudo tljh-config set base_url /jupyter and then sudo tljh-config reload proxy should make the hub available on the path some.domain.org/jupyter/hub.

Actual behaviour

sudo tljh-config set base_url /jupyter and then sudo tljh-config show shows correctly that the config.yaml file has been changed, but upon inspection, nothing in the traefik rules.toml has been updated.

Your personal set up


the output of `pip freeze`
apturl==0.5.2
attrs==19.3.0
Automat==0.8.0
blinker==1.4
catfish==1.4.13
certifi==2019.11.28
chardet==3.0.4
Click==7.0
cloud-init==21.3
colorama==0.4.3
command-not-found==0.3
configobj==5.0.6
constantly==15.1.0
cryptography==2.8
cupshelpers==1.0
dbus-python==1.2.16
defer==1.0.6
distro==1.4.0
distro-info===0.23ubuntu1
entrypoints==0.3
httplib2==0.14.0
hyperlink==19.0.0
idna==2.8
importlib-metadata==1.5.0
incremental==16.10.1
Jinja2==2.10.1
jsonpatch==1.22
jsonpointer==2.0
jsonschema==3.2.0
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
lightdm-gtk-greeter-settings==1.2.2
MarkupSafe==1.1.0
menulibre==2.2.1
more-itertools==4.2.0
mugshot==0.4.2
netifaces==0.10.4
oauthlib==3.1.0
olefile==0.46
onboard==1.4.1
pexpect==4.6.0
Pillow==7.0.0
psutil==5.5.1
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycairo==1.16.2
pycups==1.9.73
PyGObject==3.36.0
PyHamcrest==1.9.0
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyrsistent==0.15.5
pyserial==3.4
python-apt==2.0.0+ubuntu0.20.4.6
python-dateutil==2.7.3
python-debian===0.1.36ubuntu1
PyYAML==5.3.1
reportlab==3.5.34
requests==2.22.0
requests-unixsocket==0.2.0
SecretStorage==2.3.1
service-identity==18.1.0
sgt-launcher==0.2.5
simplejson==3.16.0
six==1.14.0
sos==4.1
ssh-import-id==5.10
systemd-python==234
Twisted==18.9.0
ubuntu-advantage-tools==27.2
ubuntu-drivers-common==0.0.0
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.8
wadllib==1.3.3
xcffib==0.8.1
xkit==0.0.0
zipp==1.0.0
zope.interface==4.7.1
welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

consideRatio commented 3 years ago

This seems like a straightforward bug associated with us not configuring traefik, but only c.JupyterHub.base_url, which isn't enough I presume.

OffensiveGeneric commented 3 years ago

This seems like a straightforward bug associated with us not configuring traefik, but only c.JupyterHub.base_url, which isn't enough I presume.

After hacking at it for a number of hours, I discovered that directly setting c.JupyterHub.base_url = '/jupyter' in the jupyterhub_config.py allows the base URL to persist between restarts of the hub & proxy services. The login becomes available on the desired URL path. However, it breaks the user environments and when a user logs in, they are unable to open any notebooks. I presume this has something to do with authentication/spawner aspects of the application. Either way, setting the config options in the config.yaml does nothing to affect the downstream variables. Going to try and figure this out today.

consideRatio commented 3 years ago

@OffensiveGeneric can you try verify if it breaks if a user logins - or if it breaks if a user tries to access their server? For me to follow clearly I may need to have a more clear description on "it breaks".

If you are testing things, test against:

OffensiveGeneric commented 3 years ago

@consideRatio

I am able to login to my account, and the login page is accessable from the correct URL. However a few times when I would login, the application would hang on the spawing page, being seemingly unable to spawn my environment. For whatever reason I'm having trouble reproducing this right now. UPDATE: here's an image of the spawing page hang, I was able to reproduce it. Screenshot_20211026_121037

Either way, afterwords, I am able to access my server from /home, but trying to make a new python notebook while in my server gives me this error. In fact, I cannot generate or upload any files at all. notebook not found

I have a user account, tyler, in the hub which has admin privileges.

  • /jupyter/hub/home --- traefik proxy should take you to the hub

This works as expected, I think. Once you are logged in, brings me here. hubhome

  • /jupyter/user/username --- traefik proxy should take you to the user's server

This also works as expected, however for my account it adds /tree or in one instance /tree?#notebooks to the end of this url. classestree

mskblackbelt commented 2 years ago

Is there any progress on this? If I could get TLJH running on a separate base_url, I might be able to make some progress on getting WebMO running on the same server. An alternative might be configuring jupyter-server-proxy, but I haven't had time to see if that will fit my requirements (or if it's even capable of doing the task I need).

I admit I'm unable to do much on my own, as I often don't know what it is I don't know… I'm trying to pick up things as fast as I can, but I run into missing vocabulary issues.

OffensiveGeneric commented 2 years ago

@consideRatio @mskblackbelt

For those curious, this should be considered fixed by the merge of Add base_url capability to tljh-config #623. If your install is from before this merge (Nov. 5, 2020), the feature to change the base url is broken/not configured properly.