Silk Web Hosting: R
ModifiedThe most recent release of R is available from the command-line and for web applications written with Shiny.
Packages
You can install CRAN packages within
your own library. First, create a directory for them with mkdir ~/R
. All of
your installed packages will live in subdirectories under that.
For example, you can install caret
within R by typing the following:
install.packages("caret")
Web applications
Web applications written with Shiny use Shiny Server Open Source as an application server. This will automatically take care of starting up your code when someone tries to access it with a web browser. To deploy your application, do the following:
-
Place your application files in a directory under your site root.
-
Edit the
.silk.ini
file in your site root. Add a section similar to the following.[app] type = rlang root = myapp uri = /myapp
The
.silk.ini
section name should be either “app” or any descriptive name you wish for your application that starts with “app: “. This could be useful if you wish to configure multiple apps.root is the directory under your site root containing all your application files.
uri is the path part of a browser URL after the hostname at which your app should be reached.
-
Your
.silk.ini
changes will take effect within ten minutes and your application will be configured in Shiny Server. If you would like to force this to occur, faster, you can reload your site’s settings withsilk site <hostname> load
.
Reloading applications
Shiny Server looks for changes to applications and will usually reload them
automatically when necessary. If it misses a change, just update the timestamp
on one of your files. For example, touch myapp/server.R
.
Changing server options
Certain application options for timeouts and HTTP headers can be configured by
creating a .shiny_app.conf
file in your application directory that specifies
the new settings. See the Local App
Configurations
section in the Shiny Server documentation for a list of settings, and further
down the page for the full description of each
option.
Console logs
App server logs are available in /var/log/shiny-server/
. Log file names are
prefixed with the app path, your username, and a timestamp, with a new file
each time your app is relaunched (e.g.,
myApp-mynetid-20191202-142304-23813.log
). When debugging, make sure to view
the most recent file.