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

redirect loop #397

Closed wqh17101 closed 3 years ago

wqh17101 commented 5 years ago

Hi there, i set the server as the ways in tutorial. it worked. but when i connect,i got the redirect loop error

wqh17101 commented 5 years ago

image

wqh17101 commented 5 years ago

i set c.JupyterHub.port = 15000 c.JupyterHub.hub_port = 16000 but i got loop redirect when i visit 16000, and i can not visit 15000

wqh17101 commented 5 years ago

and when i use netstat -an i find that it only setups port 16000, 15000 is not available

GeorgianaElena commented 5 years ago

@wqh17101, mind continuing the discussion here and close https://github.com/jupyterhub/jupyterhub/issues/2638 since it's a TLJH related question and people with similar issues might find it easier here? Also, sorry for not answering here in the first place, I somehow missed it.

wqh17101 commented 5 years ago

First, thank you for all you did before.

Never mind. It is up to you , i dont care where to discuss . I am focusing on this project. However we discuss too much in jupyterhub/jupyterhub#2638 , if move here , please read the rest of my comments in jupyterhub/jupyterhub#2638 , and make sure you will miss nothing. Looking forward to your reply. @GeorgianaElena

GeorgianaElena commented 5 years ago

From jupyterhub repo:

Also where can i set the config file in tljh image this time it is /opt/tljh/hub/lib/python3.6/site-packages/tljh/jupyterhub_config.py last time it was /srv/src/tljh/jupyterhub_config.py

and another problem jupyterlab in jupyterhub in tljh

It seems that there may be a small misunderstanding here about how TLJH works. From the screenshot it seems that you are trying to start jupyterhub inside the docker container where TLJH is installed. I believe you might find it useful to read a bit through the TLJH documentation, especially the section about the installer. I'm saying this because there's no need to start jupyterhub or the proxy because are built as systemd units and they all start at system startup.

After you followed the steps described bellow (without doing anything else) where you able to access JupyterHub at http://localhost:15000?

@wqh17101, you need a new container and published it with the new mapping.

The steps are: 1. docker build -t tljh-systemd . -f integration-tests/Dockerfile 2.

docker run \
  --privileged \
  --detach \
  --name=tljh-dev-env \
  --publish 15000:15000 \
  --mount type=bind,source=$(pwd),target=/srv/src \
  tljh-systemd

Note that a new container with a new name (tljh-dev-env instead of tljh-dev in the tutorial) will be created and the port 15000 inside the container will be mapped to the port 15000 on your local machine.

  1. docker exec -it tljh-dev-env /bin/bash
  2. python3 /srv/src/bootstrap/bootstrap.py --admin admin
  3. sudo tljh-config set http.port 15000
  4. sudo tljh-config reload proxy
  5. Now the proxy listens on 15000 inside the docker container and is also accessible outside on 15000. You should now be able to access JupyterHub on http://localhost:15000
wqh17101 commented 5 years ago

when i am on step 2 , i got this image image

image

wqh17101 commented 5 years ago

image i found the problem, it is my fault

wqh17101 commented 5 years ago

It worked ,but i found that after i did all above . @GeorgianaElena There are three problems left. 1. can not reload

tljh-config reload hub hung image from hub log image jupyterhub restarted successfuly

and then i run tljh-config set Spawner.default_url '/lab' reload process hung again jupyterhub restarted successfuly again but Spawner.default_url doesnt work , it still redirect ot '/tree'

  1. jupyterlab version is wrong https://github.com/jupyterhub/jupyterhub/issues/2656

  2. can not use tljh-config inside the admin-user`s terminal

image

image

4 how to use command rz to upload file from local system by terminal of jupyter i entered rz and hung with out a file-choosing window like below shown image

GeorgianaElena commented 5 years ago
  1. can not reload tljh-config reload hub hung

@wqh17101, reloading the config usually doesn't work when there's something in the config not properly set. In most of the cases, you ca see what the problem is by looking at the logs. In your logs however I don't see anything wrong and the hub starts normally, which is strange. Can you please share the output of sudo tljh-config show ?

and then i run tljh-config set Spawner.default_url '/lab' reload process hung again jupyterhub restarted successfuly again but Spawner.default_url doesnt work , it still redirect ot '/tree'

Checkout the "Change default User Interface for users" section. You can find there the steps on how to use the JupyterLab interface in TLJH.

  1. jupyterlab version is wrong jupyterhub/jupyterhub#2656

When you run the TLJH installer, JupyterLab 0.35.4 gets installed automatically in the user environment (see http://tljh.jupyter.org/en/latest/contributing/packages.html#python-environments). Did you pip installed jupyterlab? If so, it also got installed in the hub environment or even outside the python envs created by TLJH (that's what you see when you run pip list). The users however see the jupyterlab installed by TLJH in the user environment. In order not to run into future config problems, you might probably want to uninstall jupyterlab from the hub env and stick with the packages installed by TLJH.

Summarizing, TLJH supports natively the JupyterLab interface, just follow the steps described in the docs on how to enable it (linked above).

  1. can not use tljh-config inside the admin-user`s terminal

Can you please check the logs of the admin user server? (sudo journalctl -u jupyter-admin) for any errors?

  1. how to use command rz to upload file from local system by terminal of jupyter i entered rz and hung with out a file-choosing window like below shown

From the screenshot it seems like you're on a Windows system and JupyterHub isn't supported on Windows (https://jupyterhub.readthedocs.io/en/stable/installation-basics.html#platform-support) so I'm afraid I cannot provide support with this. Also, I feel the need to reiterate that you have configured a development environment which is only for testing and/or contributing to the TLJH development and shouldn't be used in production. Also, it is not recommended to run TLJH inside a Docker container (checkout https://github.com/jupyterhub/the-littlest-jupyterhub/issues/214#issuecomment-434308195 and http://tljh.jupyter.org/en/latest/install/custom-server.html#installing-on-your-own-server).

wqh17101 commented 5 years ago
  1. sudo tljh-config show image i use sudo tljh-config unset Spawner.default_url to unset the things i added, it still can not reload normally. And then i use sudo tljh-config set user_environment.default_app jupyterlab and tljh-config reload hub . the tljh-config reload hub still hung . but the hub restart and the user default has been changed to '/lab' . So it looks like the config worked since the reloading process hung. the /opt/tljh/config/config.yaml which tljh-config command use is here:

config.txt

i change the postfix of it which was .yaml to upload here.

wqh17101 commented 5 years ago
  1. jupyterlab version is wrong i have installed jupyterlab 1.0.0 . so how to uninstall the jupyterlab in jupyterhub env and install jupyterlab in it

In addition , i found that the installed used sh Miniconda3-4.5.4-Linux-x86_64.sh -u -b -p /opt/tljh/user to install conda, -b will cause the slient install processing which will not add the path of conda to the system env. That will cause conda command not found.

To resolve this ,i think in the installer script you should add export PATH="/opt/tljh/user/bin:$PATH" to /root/.bashrc and source /root/.bashrc to make conda command work. @GeorgianaElena
This may casue the conflict of python env. The original python env is /opt/tljh/hub. After run it , it will change to /opt/tljh/user.

So, it is not recommanded to add /opt/tljh/user to $PATH OR it is the real right thing that i should use the env in /opt/tljh/user

As i read the source code , i found that the really env you want to use is /opt/tljh/user . So you must add /opt/tljh/user/bin to env. You can add it to env by add it to Dockfile

It is confused that if what you need is /opt/tljh/user/bin , why you installed another python env in /opt/tljh/hub. @GeorgianaElena

After i added /opt/tljh/user/bin to env , all the ENV problem were resolved.

wqh17101 commented 5 years ago
  1. can not use tljh-config inside the admin-user`s terminal image image image nothing error
wqh17101 commented 5 years ago
  1. the pic is what i visited the jupyterlab generated by jupyterhub on WINDOWS. it seems that it cant popup in the terminal of jupyter
consideRatio commented 3 years ago

I'll go for a close on this as I could not identify a concrete action point to take in order to improve something within this repository and it is quite old now -- thanks @GeorgianaElena for your thorough effort looking into this. I hope you got it up and running in the end @wqh17101!