pachadotdev / analogsea

Digital Ocean R client
https://pacha.dev/analogsea/
Apache License 2.0
157 stars 24 forks source link

todo: adding an example to docklet_shinyserver() #207

Open pachadotdev opened 3 years ago

pachadotdev commented 3 years ago

...that highlights the default volume settings that allow multiple Shiny apps to be run on a single droplet.

kdpsingh commented 3 years ago

Thank you for opening this issue based on our Twitter conversation.

I'll first share what the documentation currently says and will give an example for what I think it should say.

Currently, the documentation gives this example for the use of docket_shinyserver(). It shows how to spin up a Shiny server using the following code:

d %>% docklet_shinyserver()

Then, it suggests using the docklet_shinyapp() function to actually install/launch Shiny apps as follows:

path <- system.file("examples", "widgets", package = "analogsea")
d %>% docklet_shinyapp(path)

The problem is that using docklet_shinyapp(path) essentially overwrites the home page of your docker instance. While this behavior is desired in some cases, it may not be desired when you want to run multiple Shiny apps in subfolders of the website.

If you want to run multiple Shiny apps, then this code is preferred:

# Launch Shiny server such that all subfolders placed in /srv/shinyapps and /srv/shiny-server contain Shiny apps
d %>% docklet_shinyserver(volume = '/srv/shinyapps/:/srv/shiny-server/')

Then, when you use droplet_upload() to upload folders containing Shiny apps, they are accessible as subfolders (e.g., www.yourwebsite.com:3838/app1 and /app2).

So my only suggestion is to add this latest piece of code to the examples. Happy to put in a PR.

pachadotdev commented 2 years ago

hi @kdpsingh do you have an example on this?