Deploying to ShinyApps.IO

,

Hi,

I've read the documentation here:
Documentation

I have a few questions on deploying my first Shiny App.

  1. Is there more thorough documentation?

In the documentation, under "Custom Domains" this is written:
Applications deployed on shinyapps.io are accessible by loading a URL of the form:
"//.shinyapps.io/application-name/)"

  1. I want to set my "application-name" to "RRTest1". How can I set that?

Just like any other Shiny App, my App.R code defines the UI and server and has a call to the shinyApp() function.

  1. Must the hardcoded filename be "App.R"?

  2. In "App.R", I am using the source() function call to "#include" a few utility functions - I sure hope that works once the app is deployed to ShinyApps.
    Source takes a filename which can include a path. Should the path be set to "" and the utility functions file be deployed to the same folder as "App.R"?

  3. Similar to #4, I am also loading "config.yml" using "config::get(file = ConfigFileName)". Once deployed, I suppose the yml file must be in the same location as "App.R".

  4. I have a "default:" and "production:" sections in "config.yml". How do I set things up so that the production settings are used when the app is deployed?

  5. I am also using sink() (to a text file on my hard drive locally) and print() for debugging. Where are those messages sent once the app is deployed? Are they sent into the magical bit bucket in the sky or do they crash the app deployed?

If you can answer any of these questions, please enlighten me.
I'll gladly buy you a beer for your help!!!

I hope this isn't against any rules - my email address is richardrogers@rogers.com.

Thank you,

Richard Rogers

I suspect for most of it, the best is to try and see what breaks!

  1. I want to set my "application-name" to "RRTest1". How can I set that?

I think by default it uses the same name as your RStudio Project name and directory that contains the app. When you are pushing with rsconnect, you might also be able to force a change of name, not sure.

  1. Must the hardcoded filename be "App.R"?

Not absolutely, but it's easier. If you just use this name (and the ui and server functions inside), everything is automatic. See the manpages for runApp() or shinyApp() for details on how you could customize. I wouldn't recommend if you are a beginner.

  1. and 5

Yes, source() works inside the app. The path has to be correct though, use only a relative path. If your file is called "utils.R" and is in the same directory as the app, then source("utils.R") should work without problem. Do not use any absolute path (such as "C:/Users/App"), since you don't know where the app is stored on the server.
If you want to organize a bit more, you can use subdirectories, e.g.:

myTestApp
  /App.R
  /assets/
    /config.yml
    /utils.R

and then call source("assets/utils.R") and get("assets/config.yml").

6

There may be answers here: rename your production: section to shinyapps: and that should work.

7

For print(), message(), and anything that would be written in the R console, they get written to a log instead. When you create an app on shinyapps.io you get access to a dashboard that allows you to see the logs for the app.

For sink(), as far as I can tell, it will be correctly written to a file, but the file will be deleted automatically between sessions: shinyapps.io does not allow persistent storage, each person opening the same app gets a fresh version, with only the files that were uploaded initially. If you need to write data to a file, you might want to host the file somewhere else and send messages from the Shiny app. I don't think that's a common feature of Shiny apps though.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.