rocker-org / rocker-versioned

Run current & prior versions of R using docker
https://hub.docker.com/r/rocker/r-ver
GNU General Public License v2.0
297 stars 169 forks source link

browseVignettes() gives broken links #178

Closed lwaldron closed 2 years ago

lwaldron commented 4 years ago

Steps to reproduce:

  1. launch the rocker/rstudio server, for example using the current version:
    run -d -p 8787:8787 -e PASSWORD=pw --name rstudio rocker/rstudio
  2. Open http://localhost:8787 and login
  3. In the R console, run > browseVignettes(). Allow pop-ups.
  4. Click on any of the links, and they produce "The requested page was not found."
cboettig commented 4 years ago

Thanks @lwaldron for the bug report!

It looks like the URLs being listed by browseVignettes() are missing help/ at the beginning of the URL (right after the hostname / localhost:8787). If you use the help browser in RStudio itself (e.g. go to home-> select package, -> select vignette), you get a link to the same vignette content, but these links are correctly formed starting with help and look like they should open in a new tab/window just fine.

If anyone has any insight on why browseVignettes() page produces these incorrect URLs, we're all ears! (maybe the excellent @kevinushey can set me straight once again?)

kevinushey commented 4 years ago

Those help links use the R help server directly (which is served on a different port that RStudio Server itself). RStudio uses the help/ in the Help pane to basically act something like a proxy to the R help server.

So, the links reported by browseVignettes() are correct. More likely is that the port used by the R help server is not actually exposed by Docker and so such URLs are not visible externally (even though they might be visible within the Docker container; ie, to RStudio)

cboettig commented 4 years ago

thanks @kevinushey , that makes sense. I'm a bit unclear what port numbers either RStudio help server or R help server are using; it appears to me that the RStudio help server works fine even when I've locked down all other ports except RStudio's (e.g. I bind 8787 in the container to 443 outside the container and put the container behind a reverse proxy, and still I can get RStudio's urls with the help/ to work just fine). Maybe RStudio's proxy is already handling this so it all goes through the 8787 port anyway?

In any event, I would lean towards us merely recommending users rely on the RStudio help panel for the time being?

(Historically we have explored exposing other ports, e.g. HTTR_LOCALHOST + HTTR_PORT for oauth apps, but going down that road can be tricky when users operate in vary different network spaces with different firewalls etc) .

lwaldron commented 4 years ago

FYI, the links all point to the same port, e.g. for the parallel package vignette it's http://localhost:8787/library/parallel/doc/parallel.pdf.

As a note, under Help - R Help it's a bit convoluted to find package vignettes, you have to choose the package first then see if it has vignettes; I don't see an equivalent of browseVignettes() to see all available vignettes.

kevinushey commented 4 years ago

See also the help.ports documentation in ?options.

I suspect you could force R to use a particular port for its help server with e.g.

options(help.ports = 8888L)

and then tell Docker to expose that port so it can be accessed through e.g. a web browser.