2
votes

I have written a Hello World shiny app as following:

/local/sampleShinyApp/ui.R:

library(shiny)
ui <- shinyUI(fluidPage(h1('Hello World')))

/local/sampleShinyApp/server.R:

library(shiny)
shinyServer(function(input, output){})

When directly running R on command line, and run the following in R console, the app works correctly. When I go to http://my_hostname:3838, I saw a Hello World page.

shiny::runApp('/local/sampleShinyApp/', host='172.XX.XXX.XXX(my host ip)', port=3838)

However, When I setup shiny server pro with the exact same application, I got an error on the page. Can someone help me debug through this?

Error message on the webpage:

An error has occurred
The application failed to start.
The application exited during initialization.

Log file (sampleShinyApp-shizhe-20170719-185527-37309.log):

Error: unexpected '/' in "/"
Error: unexpected symbol in "28abbec4a109de74238ef34e00c83359"
Error: unexpected numeric constant in "1.5.3"
Error: unexpected symbol in "3468d94033c5b8761545f25784af09680d2ed8577323298b"
Error: object 'shiny' not found
Error: unexpected '/' in "/"
Error: object 'true' not found
Error: object 'true' not found
Error: unexpected '/' in "/"

/etc/shiny-server/shiny-server.conf:

run_as shizhe shiny;
server {
  listen 3838;                                                                                        
  location / {                                                                                                          
    utilization_scheduler 20 .9 3;                                                                            
    app_dir /local/sampleShinyApp;                                                                         
    log_dir /var/log/shiny-server;                                                                                                     
    run_as shizhe shiny;                                                                               
  }
}

Start shiny-server:

sudo stop shiny-server; sudo start shiny-server
1
Seems shiny is not recognized, have you tried with run_as shizhe;?HubertL
Yes I did. Changing the user from run_as shiny shizhe; to run_as shizhe; gives the exact same error page.HiLos

1 Answers

0
votes

You didn't bind ui and sever in the Shiny app. Try running the following code instead:

library(shiny)

# Define UI for application 
ui <- fluidPage(
  h1("hello world")
)
 # Define server logic required to draw a histogram
server <- function(input, output) {
}
# Run the application 
shinyApp(ui = ui, server = server)