ComputeCanada / puppet-jupyterhub

Puppet module to deploy a JupyterHub that submits job to Slurm
MIT License
11 stars 7 forks source link

RStudio redirects to incorrect url #21

Closed ocaisa closed 2 years ago

ocaisa commented 3 years ago

Maybe there is an easy way to fix this but I can't figure it out. I've got RStudio-Server available in EESSI and using that to start an RStudio session. After starting the session I get redirected to

https://jupyter.brac.learnhpc.eu/hub/auth-sign-in

which gives a 404. If I modify this URL to become

https://jupyter.brac.learnhpc.eu/user/ocaisa/rstudio/auth-sign-in

then everything works as expected and I end up at in an RStudio session at

https://jupyter.brac.learnhpc.eu/user/ocaisa/rstudio
ocaisa commented 3 years ago

This is RStudio easyconfig we are using: https://github.com/easybuilders/easybuild-easyconfigs/pull/12544/files

cmd-ntrf commented 3 years ago

I think this RStudio issue is related: https://github.com/rstudio/rstudio/issues/8888

puppet-jupyterhub installs jupyter-server-proxy latest version (v3.0.2) which I think does not include the patch mentioned by Ryan in the issue.

ocaisa commented 3 years ago

So it looks like Compute Canada get around this by not actually using the full release, but stopping at a particular commit that doesn't include the auth changes: https://github.com/ComputeCanada/easybuild-easyconfigs/blob/computecanada-main/easybuild/easyconfigs/r/RStudio-Server/RStudio-Server-1.3.1093-gmkl-2020a.eb#L55

The changes after this commit in that release are at https://github.com/rstudio/rstudio/compare/718e6d75b094658d999495534badf55fb2ce0047...v1.3.1093 and include some changes to the PAM authentication.

mboisson commented 3 years ago

@ccoulombe probably knows about this.

ocaisa commented 3 years ago

I tested this and it still didn't work for me, even if I stuck to that commit, so there must be something else I am missing.

ccoulombe commented 3 years ago

In v1.3.1093, the auth-none default was fixed to be 1. rserver --help -> --auth-none arg (=1). And see release note: Fix an issue where auth-none would not load sessions (#7575)

The git revision is actually not used since a zip file is the source, an artefact I should remove

cmd-ntrf commented 3 years ago

A manual solution is mentionned here: https://github.com/jupyterhub/jupyter-rsession-proxy/issues/97

When presented with the 404, a user can manually work around the problem by inserting the base path in front of the auth-sign-in path. For example on a jupyterhub, the user could change /auth-sign-in?appUri=%2F to /user/the-user-name/rstudio/auth-sign-in?appUri=%2F. Once corrected, rserver will properly authenticate the user and the user will be redirected to {base_url}/rstudio.

We could change the landing page from /rstudio to /rstudio/auth-sign-in?appUri=%2F in the spawner config.

ocaisa commented 3 years ago

I tested that and it led to ERR_TOO_MANY_REDIRECTS

ocaisa commented 3 years ago

This should be fixed according to https://github.com/jupyterhub/jupyter-rsession-proxy/issues/97#issuecomment-873360757 in v1.4 of jupyter-rsession-proxy

ocaisa commented 3 years ago

To work, this requires setting RSESSION_PROXY_RSTUDIO_1_4=1 in the environment to work

ocaisa commented 3 years ago

I tested this by adding

# Use fix for https://github.com/ComputeCanada/puppet-jupyterhub/issues/21
export RSESSION_PROXY_RSTUDIO_1_4=1

to https://github.com/ComputeCanada/puppet-jupyterhub/blob/main/templates/submit.sh.epp but it doesn't seem to work. Pretty sure I am doing something wrong.

ccoulombe commented 2 years ago

The redirect is now fixed in upstream jupyter-rsession-proxy. And will be on our JupyterHubs once https://github.com/ComputeCanada/puppet-jupyterhub/pull/26 is merged.