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

Image build on top of rocker/rstudio to start shiny and rstudio simultaneously on two different ports #565

Open
nikofleischer opened this issue Dec 4, 2024 · 0 comments

Comments

@nikofleischer
Copy link

Dear All,
I am currently working on setting up a docker image based on rocker/rstudio image to run a shiny app + providing access to the raw data using RStudio. I know this goes somewhat against the docker philosophy of providing one function/container. Coming from a science background, the reason why I chose this route is for reasons of reproducibility and ease of sharing, rather than deploying something on a larger scale. If this is the wrong place to ask, please rm.

I would like to automatically start both the shiny app and RStudio in the same container bound to two different ports

  • This would give me direct access via Rstudio to the underlying data displayed in the Shiny app on the same dependency system as the Shiny app.
  • This would allow for plotting the same plots manually and adding in new data/editing old data without breaking any dependencies
  • This would allow me to send the same docker image to someone to use with the Shiny app without having to even see Rstudio.
  • If they ran into problems I could easily debug things by logging into R Studio on a different port.
  • If they wanted to dive deeper into the data they could do so by logging into RStudio without having to pull a different Image.

This proved to be very hard, as docker is designed to run only one process.
What already works:

  • Correctly building an image from the rocker/rstudio base with all required dependencies and R Packages installed and Data copied into the image
  • Starting either the Shiny app or Rstudio using CMD [“/init”] or CMD Rscript scrnaseqapp.R in the dockerfile before building
  • Starting Rstudio, logging in, and then starting starting the Shiny app by running scrnaseqapp.R manually
  • Connecting to either RStudio or Shiny app from a different host within the same LAN

Things I tried that didn’t work

  • Editing Rprofile to run the Shiny App after starting RStudio This results in RStudio never starting, as the shiny app runs in an infinite loop. RStudio can be started by restarting in save mode, works but is a hacky workaround
  • Running the Shiny app using the CMD Rscript scrnaseqapp.R directive in the dockerfile. This replaces the standard CMD [“/init”] directive, which starts Rstudio, so Rstudio is never actually run
  • Adding two CMD directives CMD Rscript scrnaseqapp.R CMD [“/init”]. Not supported by docker and only one is run

Things I haven’t tried yet

  • The rocker/rstudio image is managed using a service manager called S6 that would theoretically easily be able to manage this exact use case. However, the documentation on the rocker Git Hub is sparse on this topic and I could not seem to make sense of the scripts enough to modify them myself w/o any hints.

Thank's a lot for any hints,
best Niko

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

No branches or pull requests

1 participant