R Shiny on Shiny server - how to access the app?

1.5k views Asked by At

I have Shiny Server installed and I can use the sample apps (i.e. http://serverip:3838/hello/).

But when I visit http://serverip:3838/myapp/ to use myapp, it's not working (loading till it stops).

Am I missing something in the code or in the way this should be done?

-- (running locally app.R from RStudio, works fine)

Info about the app:

  • Location: /srv/shiny-server/myapp

  • Filename: app.r

  • File structure:

    -- load libraries

    library(shiny)

    ...

    -- Connection and queries

    con <- dbConnect(MySQL(),
                     user = '#',
                     password = '#',
                     host = '#',
                     dbname='#')
    
    tickets<-dbGetQuery(con, "Select * from table")
    issues_speed_unique<-unique(na.omit(dbGetQuery(con,"Select * from table2")))
    dbDisconnect (con) 
    
    some aggregations....
    

    -- Server code

    shinyServer(
      function(input,output){
         ...
    

    -- ui code

    shinyUI(fluidPage(
         ...
    
    shinyApp(ui = ui, server = server)
    
1

There are 1 answers

2
yhf8377 On

Your code works fine in RStudio indicates that it is not something related to your program logic. It seems that your folder/file permission may be preventing Shiny Server from accessing your files. I have encountered similar issues before.

Please make sure that user shiny (if you used default installation options) have access to your folder and files. I would suggest that you use chown -R <yourself>:shiny <my-shiny-folder> and chmod -R g+s <my-shiny-folder> so that all files saved to this folder can be accessed by Shiny.