plumber
plumber copied to clipboard
Support plumber.autoreload option
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.
https://github.com/siegerts/drip
This is a non-R auto reload process. BUT, it looks like it works (untested).
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
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).