Problems running Rstudio on JupyterHub

Hi,

I’ve read a lot on this topic, but I a bit lost right now.

I’m building a containerized IDE / development environment for my team based on JupyterHub. Really impressed on the wide range of functionality and happy with my installation so far:

  • Signing in with github
  • Create (linux)user when user is in whitelist / allowed users
  • Running VS code / Code server
  • Running Jupyter notebooks

One last piece for me is to install Rstudio as we also work a lot with R.

In my dockerfile I install R studio with the following lines

# Install R Studio
RUN apt-get -y install r-base gdebi-core
RUN cd /srv/jupyterhub && \
    wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.0-443-amd64.deb && \
    gdebi -n -q rstudio-server-2022.02.0-443-amd64.deb
    
RUN pip install jupyter-rsession-proxy

ENV RSESSION_PROXY_RSTUDIO_1_4=yes

I no have two issues:

  1. When launching the container, Rstudio is not running. I manually need to run: rstudio-server start in a connected terminal. This can best be solved with a small script when starting the container?

  2. Clicking on the R-icon in JupyterHub I then get the following:


    For some reason the host-name gets really weird and is changed to “dime” witch is part of the original hostname containing dashes: https://dime-ide-oo-dime-dev.apps.ocp-prd.XYZ.com/

Copy pasting my valid base-url XYZ.com in the url displayed in the browser instead of https://dime/ so I get, https://XYZ.com/user/[username]/rstudio/auth-sign-in?appUri=%2F. Running this results in a working rstudio when clicking again on the R-server icon.

Can sameone point me in the right direct to fix this wrong redirecting behaviour?

Heya! Glad you are enjoying using JupyterHub :slight_smile:

For RStudio, RSESSION_PROXY_RSTUDIO_1_4=yes should no longer be required. If you’re on the latest version of jupyter-rsession-proxy, just going to the /rstudio URL on your hub should ‘do the right thing’. I think manually running rstudio-server start might cause some issues, as jupyter-rsession-proxy has to do some custom stuff to get everything going.

If just going to https://<hub-url>/hub/user-redirect/rstudio doesn’t work, please can you post the logs from the user container as well as the versions of rstudio and jupyter-rsession-proxy?

3 Likes

I’m getting the same behavior. When my hostname is:

https://somename.aa-bb.cc.com/hub/user-redirect/rstudio

it’s being redirected and failing due to incorrect hostname:
https://somename.aa/user/{user}/rstudio

Any idea how to fix?

I ran it under a different hostname, one without ‘-’ in the name. It worked fine. This issue may potentially be a bug. I’ll wait for confirmation before I submit it to github.

1 Like

man…u R not connected to the internet probably :sunglasses:

Hi @Semafoor,
i have exactly the same issue on openshift. How did you solve it?

I can confirm, removing (-) from Subdomain solved the Problem.
old → jhub-dev.mydomain.com
new → jhubdev.mydomain.com

We use z2jh helm chart on OpenShift.

rserver 4.1.2
jupyter-rsession-proxy        2.1.0
jupyter-server-proxy          3.2.2

I still have the same problem as @semafoor, but cannot remove (-) from host and subdomain.
Has anyone solved this issue ? Any good pointer ?
Thank you in advance!

openshift
rserver 2023.03.0+386
jupyter-rsession-proxy 2.1.0
jupyter-server-proxy 4.0.0

Logs report that:

[I 2023-06-06 10:55:04.747 ServerApp] 200 GET /user/flore/api/terminals?1686048904721 (flore@10.130.4.2) 0.77ms
[I 2023-06-06 10:55:06.552 ServerApp] 302 GET /user/flore/rstudio/ -> https://plantbook/user/flore/rstudio/auth-sign-in?appUri=%2F (flore@10.130.4.2) 401.87ms

so it seems that ServerApp redirects to plantbook instead of plantbook-test.subdomain.org.

Is this related to jupyter_server_proxy ?

Thanks