shinyproxy icon indicating copy to clipboard operation
shinyproxy copied to clipboard

Having pre-initialised containers compile R Markdown before assigned to a user

Open eturkes opened this issue 1 year ago • 2 comments

Is it possible to do this? My containers pre-initialise fine but I can see that they only start to compile once launched by a user. The files take a long time to compile (it uses Shiny and I've looked into shiny_prerendered but it's incompatible with some components I'm using), so it'd be nice to have them compile as part of the pre-initialisation and when a user starts to use the container it's already ready to go.

eturkes avatar Nov 14 '24 11:11 eturkes

Working through this I've realized it's probably way out of scope of ShinyProxy. I was able to manage a solution using CRIU and forking of R Markdown, Shiny, and Flexdashboard which was of course very hacky. It works outside of ShinyProxy through reverse SSH tunneling, as one normally does to access a remote Shiny instance without completely opening the ports.

But this solution hasn't been working with ShinyProxy. I can get the HTML and CSS loading but the Shiny elements fail to return. I suspect this has something to do with changing environment variables whenever ShinyProxy launches a new container.

I realize this is no longer a proper issue at this point and can probably be closed, but if anyone has insight on how to get ShinyProxy to produce instances with identical environment variables that would be helpful. Although this seems to defeat the purpose of ShinyProxy somewhat, I can see it working with user login, so I can prespec the environment for each user in the application.yml or something.

eturkes avatar Nov 25 '24 09:11 eturkes

Hi

As you mentioned, it's quite difficult for ShinyProxy to fix this. You could try running the R process in some isolated environment (maybe. by launching a fresh bash session without envv ars?). Since I don't think we can fix this issue, I'll close it. If you have other suggestions or ideas to fix this, feel free to still comment. Of course we would be happy to fix this if possible!

LEDfan avatar Jul 08 '25 07:07 LEDfan