Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStudio launcher strangeness on Codespaces #144

Open
syoh opened this issue Nov 29, 2023 · 6 comments
Open

RStudio launcher strangeness on Codespaces #144

syoh opened this issue Nov 29, 2023 · 6 comments
Labels

Comments

@syoh
Copy link

syoh commented Nov 29, 2023

Bug description

In Codespace, using jupyter-rsession-proxy to launch RStudio opens a window with a strange-looking URL.

For example,

Jupyter Lab URL: https://bookish-engine-7vjg45pq4xhpw4-8888.app.github.dev/lab
RStudio launched URL: https://bookish-engine-7vjg45pq4xhpw4-8888.app.github.dev:8888/rstudio/auth-sign-in?appUri=%2F

How to reproduce

  1. Go to 'https://github.com/dddlab/rstudio/tree/update-jupyter-image'
  2. Start Codespaces
  3. image
  4. Get Jupyter server token with jupyter server list in terminal
  5. Click on Ports > RStudio row > globe icon
    image
  6. Login to Jupyter Lab with token
  7. Click on RStudio launcher button

Expected behaviour

Open RStudio

Actual behaviour

Your personal set up

Running on Codespaces with this Dockerfile: https://github.com/dddlab/rstudio/blob/update-jupyter-image/.devcontainer/Dockerfile

  • OS: Ubuntu 22.04
  • Version(s):
jovyan@codespaces-8d1913:/workspaces/rstudio$ python --version
Python 3.11.6
jovyan@codespaces-8d1913:/workspaces/rstudio$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.16.1
ipykernel        : 6.25.2
ipywidgets       : not installed
jupyter_client   : 8.4.0
jupyter_core     : 5.4.0
jupyter_server   : 2.8.0
jupyterlab       : 4.0.7
nbclient         : 0.8.0
nbconvert        : 7.9.2
nbformat         : 5.9.2
notebook         : 7.0.6
qtconsole        : not installed
traitlets        : 5.11.2
@syoh syoh added the bug label Nov 29, 2023
Copy link

welcome bot commented Nov 29, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

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! 👋

Welcome to the Jupyter community! 🎉

@ryanlovett
Copy link
Collaborator

Hi @syoh , thanks for the clear instructions, as I was unfamiliar with starting jupyter in codespaces. I created a new codespace from your repo, and could confirm the problem. When I removed :8888 from the URL and tried again, I was redirected to a new page with the same issue. I removed :8888 a second time and that time I was properly directed to RStudio.

I was able to successfully launch RStudio properly from your main branch however. There were other changes in the repo, but I'm guessing it was probably due to the update of jupyter-rsession-proxy from 2.0.1 to 2.2.0.

@syoh
Copy link
Author

syoh commented Nov 30, 2023

Thank you @ryanlovett for taking the time to confirm the issue and the solution! I confirmed your solution works for me, too.
Also, I confirmed that 2.1.0 also works fine, too. Hopefully that helps to narrow down the root cause.

@eeholmes
Copy link

eeholmes commented May 30, 2024

Here are details on the behavior. Note, I tried to apply the patch but it did not help. I used this to apply the patch

pip install git+https://github.com/juzdzema/jupyter-rsession-proxy@patch-1

Changing the url 2x in the sequence below did work.

Here is what I have to do.
Open a JupyterLab with jupyter-rsession-proxy. Click the RStudio button on the Launcher. For a moment, this url appears

https://crispy-space-memory-q97x6qjp59cx76p-8888.app.github.dev/rstudio

and then is replaced by this url

https://crispy-space-memory-q97x6qjp59cx76p-8888.app.github.dev:8888/rstudio/auth-sign-in?appUri=%2F

Remove the :8888 from the url and reload. That now looks like this

https://crispy-space-memory-q97x6qjp59cx76p-8888.app.github.dev/rstudio/auth-sign-in?appUri=%2F

That will now redirect to. Notice the :8888 reappears

https://crispy-space-memory-q97x6qjp59cx76p-8888.app.github.dev:8888/rstudio/

Now remove the :8888 again so url looks like

https://crispy-space-memory-q97x6qjp59cx76p-8888.app.github.dev/rstudio/

Now that url will work (not redirect) and clicking the button also works and will continue to work.

image

@eeholmes
Copy link

And here is my devcontainer.json. The py-rocket base image is just an image with JLab and RStudio.

{
  "name": "test",
  "workspaceFolder": "/home/jovyan",
  "image": "ghcr.io/nmfs-opensci/container-images/py-rocket-base:4.4-3.10",
  "hostRequirements": {
    "cpus": "2"
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-toolsai.jupyter",
        "ms-python.python",
      ]
    }
  },
  "forwardPorts": [
    8888
  ],
  "portsAttributes": {
    "8888": {
      "label": "Jupyter Lab - py-rocket-base",
      "onAutoForward": "openPreview"
    }
  },
  "postCreateCommand": "jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password=''"
}

@eeholmes
Copy link

eeholmes commented May 31, 2024

Update: it only occurs in a special case below with 2.2.0+ and not with 2.1.0.

I am running the Codespaces devcontainer with a Dockerfile with this line at the bottom. It is the same Dockerfile used in my JupyterHub.

EXPOSE 8888

CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--allow-root", "--no-browser"]

The original poster was using this base image, which also exposes 8888
https://github.com/jupyter/docker-stacks/blob/main/images/base-notebook/Dockerfile

Using this image in a Codespace, doesn't automatically (for me at least) start jupyter lab on port 8888. Instead I run this from a terminal after the Codespace starts

jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.token='' --NotebookApp.password=''

If I use --port=8888 I get the problem, but if I change to--port=8889, I don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants