databio / bulker

Manager for multi-container computing environments
https://bulker.io
BSD 2-Clause "Simplified" License
24 stars 2 forks source link

--workdir="`pwd`" is ignored when invoking rstudio-server #38

Closed lwaldron closed 5 years ago

lwaldron commented 5 years ago

When invoking rstudio-server in waldronlab/bioconductor.yaml, the rstudio session starts in the directory /home/rstudio, meaning that --workdir="`pwd`" is ignored. This is inconvenient because the /home/rstudio directory is empty, and things like the host ${HOME}/.Renviron are ignored, and you have to change directories manually e.g. to /Users/lwaldron.

Since rstudio-server is not a command-line operation, one solution is for me to hard-code dockerargs: "-v $HOME:/home/rstudio" into the waldronlab/bioconductor.yaml manifest entry for rstudio-server. This works, even though my home directory appears under /home/rstudio. This setting is specific to the rstudio-server command, so it doesn't seem appropriate to put in bulker_config.yaml. What do you think @nsheff?

nsheff commented 5 years ago

that's kind of annoying that it ignores the workdir command. I wonder if this also related to the way these images are created.

This setting is specific to the rstudio-server command, so it doesn't seem appropriate to put in bulker_config.yaml.

Well that sounds like a candidate host- and tool-specific setting:

http://docs.bulker.io/en/latest/settings/

So one option is to put that in the bulker config under tool_args. However... if you think the desire is universal enough that it will always be just '$HOME', and you use '$HOME' instead of some host-specific path, then you could make an argument that this option is tool-specific and not host-specific, in which case it goes in the manifest as you suggest. I think either way is acceptable and I'd probably lean toward the way you're doing it.

Since rstudio-server is not a command-line operation,

I'm not sure why you say that... rstudio-server is a command-line operation, right?

The other thing you could do that doesn't involve tool_args would be to symlink /home/rstudio to $HOME on each computer. Unfortunately, that's not portable and puts the settings outside of bulker management.

lwaldron commented 5 years ago

Since rstudio-server is not a command-line operation,

By that imprecise statement, I meant that I don't think it will be used in the context of piping, stdin/stdout, or filename arguments where it really matters to preserve pwd. It probably does eliminate the possibility of creating a helper that would allow you to, for example, click on a .Rproj file and have it opened in RStudio with this command.

It's not obvious to me from http://docs.bulker.io/en/latest/settings/ how to make a command-specific, as opposed to a tag-specific, setting? E.g. adding the following entries rstudio-server and rstudio-server-dev lines to my bulker config seems to have no effect:

  tool_args:
    bioconductor:
      bioconductor_full:
        default:
          docker_args: --volume=${HOME}/R/bioc-release:/usr/local/lib/R/host-site-library -e PASSWORD=rstudiopassword -p 8787:8787
        devel:
          docker_args: --volume=${HOME}/R/bioc-devel:/usr/local/lib/R/host-site-library -e PASSWORD=rstudiopassword -p 8788:8787
        rstudio-server:
          docker_args: -v ${HOME}:/home/rstudio
        rstudio-server-dev:
          docker_args: -v ${HOME}:/home/rstudio
nsheff commented 5 years ago

You're right, you can't do that. here, 'bioconductor' is a namespace and 'bioconductor_full' is an image name... these settings are at the image level, not at the command level. there is no 'rstudio-server' image. so you'd put that on the line;

          docker_args: --volume=${HOME}/R/bioc-release:/usr/local/lib/R/host-site-library -e PASSWORD=rstudiopassword -p 8787:8787  -v ${HOME}:/home/rstudio

Will that work? If not -- is it really the case that we have 1 image with multiple commands that have very different use cases and settings? If so, shouldn't those uses be split into different images? I think from my perspective, you'd have a different image for each command... unless the commands are sufficiently similar that the settings for the image would remain the same.

lwaldron commented 5 years ago

The thing is, I am happy with the behavior of the R and Rdev commands, and -v ${HOME}:/home/rstudio is a workaround unwanted behavior of the /init entrypoint for launching RStudio. I'm not sure what happens to command-line use if I do the same thing, but I could test it.

There isn't a simple way to use different images here, since bioconductor/bioconductor_full is built on top of rocker/rstudio, as opposed to RStudio being added on top of a Bioconductor-enabled image. The contribution of bioconductor/bioconductor_full is to add system dependencies that allow installation of nearly every Bioconductor package.

lwaldron commented 5 years ago

OK - adding -v ${HOME}:/home/rstudio to the tool_args section of the bulker config seems harmless to command-line usage (it just shows the contents of my home directory under /home/rstudio as well), so I think I will go with the config approach.

nsheff commented 5 years ago

Right, this is what I was expecting. so we're in the situation that these two commands are sufficiently similar that the image-level settings suffice, which seems like the way it should be. the rstudio mount isn't helpful for one of the use cases, but it doesn't hurt anything, either.

lwaldron commented 5 years ago

Goal achieved with this change in config setting: https://github.com/waldronlab/config/commit/33855766427b9dcc05bebb23724752dfea9426a6