2

I have a shiny app with Shiny Server (open-source version), containerized with docker, deployed to AWS Fargate. The app is fairly basic, in that it does three things:

  1. Takes user input and retrieves data from Google Analytics based upon that input;
  2. Processes those data through an .Rmd file;
  3. Offers the .pdf output for download.

When run locally (with runApp() or with docker run --rm -p 3838:3838 [image]), the app works without issue. When deployed to AWS Fargate (after having nailed down some deployment issues), the app is, I think, running into "health check"-related issues. These issues arise, I'm fairly certain, because Step 2 above can take several minutes (and generates a multi-Mb size .pdf report). The app grays out, a 503 Service Temporarily Unavailable error appears, and after a few minutes, appears to return to normal upon reloading the page.

I can edit the health checks to allow for more time before AWS EC2 thinks that my container is "unhealthy" (based upon unresponsiveness from the Shiny Server) but this is decidedly not best practice for software development (according to software devs in my org).

Is there a way to allow for a long-running Shiny app on open-source Shiny Server to process the R logic while also allowing health checks? I think this would essentially be keeping the Shiny Server "partially awake" to listen for health checking while also running any R stuff in the background.

I have the sneaking suspicion that this is not possible as R itself is single threaded and only the Shiny Server PRO version allows a health-check endpoint.

Steven
  • 3,238
  • 21
  • 50
  • 1
    You may want to look into putting some operations into `asynch` with `promises`: https://blog.rstudio.com/2018/06/26/shiny-1-1-0/ – Ryan Morton Sep 04 '18 at 22:23
  • @RyanMorton OOH. Looks promising. Thanks for the heads up. – Steven Sep 04 '18 at 22:38
  • "I can edit the health checks to allow for more time before AWS EC2 thinks that my container is "unhealthy"". Does this work? Does your app survive the health checks if you make them adequately long in polling? – bluescores Sep 05 '18 at 16:41

0 Answers0