plumber icon indicating copy to clipboard operation
plumber copied to clipboard

Support plumber.autoreload option

Open blairj09 opened this issue 4 years ago • 5 comments

Shiny has an option called shiny.autoreload that monitors source files for changes and automatically reloads the Shiny app. It would be nice if Plumber had a similar option.

blairj09 avatar Sep 10 '19 21:09 blairj09

https://github.com/siegerts/drip

blairj09 avatar Sep 25 '19 20:09 blairj09

This is a non-R auto reload process. BUT, it looks like it works (untested).

schloerke avatar Sep 26 '19 01:09 schloerke

A live-reload feature would be very nice to have!

I tried to do some tests, with drip installed in the rstudio/plumber container. I tried using one of the existing bundled examples in the plumber R package that has an entrypoint.R (the example with a counter). It seems drip expects the entrypoint.R to do pr$run() - which seems to clash with the example I was using. I tried just to add that and then got it to run. A couple of reflections from testing this setup (container with latest version of drip + plumber) can be found here: https://github.com/mskyttner/plumber-dripdrop

mskyttner avatar Jan 29 '21 12:01 mskyttner

Another variant https://github.com/mskyttner/trickler is using the official plumber container but extends it with inotify-tools which is used to monitor a directory (mounted from the host) with plumber files. A bash script reloads the server automatically when there are changes made to files mounted in the directory. Tested briefly and seems to resolve some issues I had with drip and later versions of plumber (like "createTcpServer: address already in use" on some restarts and dealing with entrypoint.R-files which return a (not running) plumber router object).

mskyttner avatar Nov 19 '21 17:11 mskyttner