# R/01-shiny-server.R#' Create Shiny Server configuration#'#' @param server_config Server configuration#' @return Shiny Server configurationcreate_shiny_server_config<-function(server_config){config<-list(server=create_server_config(server_config),applications=create_applications_config(server_config),security=create_security_config(server_config))return(config)}#' Create server configuration#'#' @param server_config Server configuration#' @return Server configurationcreate_server_config<-function(server_config){server_config<-c("# Shiny Server Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }","}")return(server_config)}#' Create applications configuration#'#' @param server_config Server configuration#' @return Applications configurationcreate_applications_config<-function(server_config){applications_config<-c("# Applications Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(applications_config)}#' Create security configuration#'#' @param server_config Server configuration#' @return Security configurationcreate_security_config<-function(server_config){security_config<-c("# Security Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(security_config)}
# R/01-shiny-server.R (continued)#' Create Shiny Server Pro configuration#'#' @param server_config Server configuration#' @return Shiny Server Pro configurationcreate_shiny_server_pro_config<-function(server_config){config<-list(server=create_pro_server_config(server_config),applications=create_pro_applications_config(server_config),security=create_pro_security_config(server_config),monitoring=create_pro_monitoring_config(server_config))return(config)}#' Create Pro server configuration#'#' @param server_config Server configuration#' @return Pro server configurationcreate_pro_server_config<-function(server_config){pro_server_config<-c("# Shiny Server Pro Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(pro_server_config)}#' Create Pro applications configuration#'#' @param server_config Server configuration#' @return Pro applications configurationcreate_pro_applications_config<-function(server_config){pro_applications_config<-c("# Pro Applications Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(pro_applications_config)}#' Create Pro security configuration#'#' @param server_config Server configuration#' @return Pro security configurationcreate_pro_security_config<-function(server_config){pro_security_config<-c("# Pro Security Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(pro_security_config)}#' Create Pro monitoring configuration#'#' @param server_config Server configuration#' @return Pro monitoring configurationcreate_pro_monitoring_config<-function(server_config){pro_monitoring_config<-c("# Pro Monitoring Configuration","server {"," listen 3838;"," "," # Define the user we should use to spawn R processes"," run_as shiny;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/shiny-server;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/shiny-server;"," }","}")return(pro_monitoring_config)}
# R/02-rstudio-connect.R#' Create RStudio Connect configuration#'#' @param connect_config Connect configuration#' @return RStudio Connect configurationcreate_rstudio_connect_config<-function(connect_config){config<-list(server=create_connect_server_config(connect_config),applications=create_connect_applications_config(connect_config),security=create_connect_security_config(connect_config),monitoring=create_connect_monitoring_config(connect_config))return(config)}#' Create Connect server configuration#'#' @param connect_config Connect configuration#' @return Connect server configurationcreate_connect_server_config<-function(connect_config){connect_server_config<-c("# RStudio Connect Configuration","server {"," listen 3939;"," "," # Define the user we should use to spawn R processes"," run_as rstudio-connect;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," }","}")return(connect_server_config)}#' Create Connect applications configuration#'#' @param connect_config Connect configuration#' @return Connect applications configurationcreate_connect_applications_config<-function(connect_config){connect_applications_config<-c("# Connect Applications Configuration","server {"," listen 3939;"," "," # Define the user we should use to spawn R processes"," run_as rstudio-connect;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," }","}")return(connect_applications_config)}#' Create Connect security configuration#'#' @param connect_config Connect configuration#' @return Connect security configurationcreate_connect_security_config<-function(connect_config){connect_security_config<-c("# Connect Security Configuration","server {"," listen 3939;"," "," # Define the user we should use to spawn R processes"," run_as rstudio-connect;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," }","}")return(connect_security_config)}#' Create Connect monitoring configuration#'#' @param connect_config Connect configuration#' @return Connect monitoring configurationcreate_connect_monitoring_config<-function(connect_config){connect_monitoring_config<-c("# Connect Monitoring Configuration","server {"," listen 3939;"," "," # Define the user we should use to spawn R processes"," run_as rstudio-connect;"," "," # Define a location that can be used to run R scripts"," location / {"," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," "," # When a user visits the base URL, make sure they see the index page"," directory_index on;"," }"," "," # Define a location for the admin interface"," location /admin {"," # Only allow access from localhost"," allow 127.0.0.1;"," deny all;"," "," # Host the directory of Shiny Apps stored in this directory"," site_dir /srv/rstudio-connect;"," "," # Log all Shiny output to files in this directory"," log_dir /var/log/rstudio-connect;"," }","}")return(connect_monitoring_config)}