Closed StevenMaude closed 1 year ago
This is great to see.
I had a go at running r-docker in a devcontainer and it worked ok. My .devcontainer/devcontainer.json was simply
{
"image": "ghcr.io/opensafely-core/r:latest",
"postCreateCommand": "R"
}
My test repo is here.
Also, I have my own version of r-docker built on rocker/rstudio:4.0.5
(with the same packages and their respective versions as r-docker) so that would be easy to include if you wanted that to test using that (I can provide Docker Hub repo and Dockerfile if interested).
@remlapmot: this is still an early days experiment, and we're not sure how this will progress yet!
But we'd certainly welcome your input and feedback, particularly on the R side, if we were to build a self-contained OpenSAFELY development environment around this idea :smiley:
If you'd like a version of the R image built on rocker/rstudio
instead of the base you use, I've done that (documentation for rocker/rstudio
is here). (Then you don't need special permission to include rstudio-server
in an image as you're just using one that already has that - I think).
You can try it with (if on Windows launch from Git Bash, or I guess WSL2) - it's quite a large image - compressed at 1.34 GB on Docker Hub
docker pull remlapmot/r-docker:2023-06-16-rstudio
docker run --rm -ti -e DISABLE_AUTH=true -p 8787:8787 -v "/$PWD:/home/rstudio" remlapmot/r-docker:2023-06-16-rstudio
It launches rstudio-server
at localhost:8787
, going to that, you should see
I guess it should be possible to use this in a devcontainer like the repo of the Microsoft developer you found has done. I did try a naive attempt at this but I couldn't get it to work (obtained a long Docker error that I couldn't decipher). I also tried his repo and that didn't work for me either.
Thanks for the extra context, Tom!
Then you don't need special permission to include
rstudio-server
in an image as you're just using one that already has that - I think
Is this alluding to some licensing issue?
I don't really know about licenses. I think there may be a license issue for Posit (formerly RStudio) products. Simon may have looked at what license RStudio Server has. The webpage for that download is here, maybe the license is within the installation.
One solution would be to use your r image on the TPP server and with the CLI but give users a matching R image based on rocker/rstudio
for interactive local development. Given that users are developing on dummy data, so that the two images might have a few different system libraries shouldn't really matter.
Coming back to using your r image in a devcontainer, I have managed to get the R language server working in your r image in a devcontainer.
When the necessary R packages are installed in the r image this just requires adding the VSCode R (REditorSupport.r) extension into the devcontainer, the entry in the devcontainer.json is
"customizations": {
"vscode": {
"extensions": ["REditorSupport.r"]
}
}
So to get this to work in the current r image I had to install a few missing R packages (languageserver and httpgd and some missing/updated dependencies for them). It would be good to get these packages installed into the r image. Let me know if I should request those on the r-docker repo.
My updated demo repo showing this working is https://github.com/remlapmot/r-docker-devcontainer.
I looked in my rstudio-server installation and it seems to have the same license as RStudio Desktop, which is AGPLv3.
@remlapmot: thanks for your effort; that's really, really great that you got something working for R!
At the moment, we want to get a minimal setup going that we can test with users who can't easily get the OpenSAFELY CLI installed. So I'll merge this PR shortly as is.
But I've opened a new issue (#104) to track what we could do to make this more viable as a more complete development setup for OpenSAFELY users. So we'll return to this, and your ideas are certainly welcome on the R side.
That's great
This is a proof-of-concept, but opening a PR for comments/ideas/feedback.
To try it out, see the updated README.