I am thinking about this too. I have an existing app that I developed using a package-like structure. I run it in a microservices framework using docker. Having plumber API would be a great way to add additional usefulness to my app. Here are some thoughts specific to my situation, but I'm curious what other more experience users think.
It makes sense to keep plumber.R within the shiny R package because it would essentially just wrap the already-existing R functions into API calls. The tricky part in my view is mapping the ports correctly: docker exposes a specific port and that's mapped to the shiny app. But plumber requires mapping another port, or is there a way to make these ports the same?
e.g. Shiny app maps to 8000, so localhost:8000 shows the shinyApp, if I call pr("plumber.R") %>% pr_run(port=8000)
then can I still access API calls such as localhost:8000/plot
?
Perhaps a simpler solution would be to run the app and the plumber process in two separate services/containers (using different exposed ports). I could build a new image off of my shiny app image, with an end CMD statement calling plump()
.