Problems deploying first Shiny app

Aloha. I've gotten a shiny server installed and working on Debian Linux but cannot get my first app to run there. The samples work (hello, rmd) and I put mine next to them with the same permissions but it is not executed. The directory and the app are visble but it's not being executed. Any suggestions greatly appreciated. BTW, the app runs in Rstudio.

1 Like

Can you show your app's logs? They are located at var/log/shiny-server/. I suspect your app doesn't have access to the required R packages.

Aloha. There's nothing. No log file is created. If I run the hello app, it creates a log file for that but nothing for my. I went back and created a test app with Rstudio and copied that over and it works as expected. There must be something about my app that is non-conforming but I can't see it.

Any chance you can show the actual code? Currently, we don't have enough information to help you out

Sure. I didn't want to just throw code at you. Here it is. It runs under Rstudio but not on the server.

# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
# Find out more about building applications with Shiny here:


ui <- fluidPage(
# ===========================================================================
# Set directories
# ===========================================================================
PROJECT_ROOT              ='/home/hellyj/Projects-400'
SRC_ROOT                  = paste(PROJECT_ROOT,     '/Project-OWIA-WaterBalance-src/R', sep='')
DATA_INPUT_LEVEL1         = paste(PROJECT_ROOT,     '/Project-OWIA-WaterBalance-data/level1', sep='')
DATA_INPUT_LEVEL2         = paste(PROJECT_ROOT,     '/Project-OWIA-WaterBalance-data/level2', sep='')
SPATIAL_METADATA          = paste(DATA_INPUT_LEVEL1, '/Spatial-Assignments-Georeferencing.csv', sep='')
TABLE_OUTPUT_HOME         = paste(PROJECT_ROOT,     '/Project-OWIA-WaterBalance/Tables',  sep='')
FIGURE_OUTPUT_HOME        = paste(PROJECT_ROOT,     '/Project-OWIA-WaterBalance/Figures', sep='')
GEOSPATIAL_METADATA       = paste('/Volumes/Pegasus32R6/Data-Geophysical',
# ===========================================================================
# Metadata
# ===========================================================================
COPYRIGHT   = paste("", expression(copyright), Sys.time())
SOURCE_FILE = paste(SRC_ROOT,'/AN-2000.R', sep='')
# ===========================================================================
# Main
# ===========================================================================
INPUT       = paste('/Users/hellyj/Projects/Project-OWIA-WaterBalance-data/level1/2020/2020-Master.csv', sep="")
INPUT_RDS   = paste(DATA_INPUT_LEVEL2,'WB-Master-2002-2020.RDS', sep='/')
rds01       = readRDS(INPUT_RDS)
rds02       = na.omit(rds01)
rds03       = aggregate(TAF ~ CategoryA + WY, sum, data=rds02)
# df01        = read.table(INPUT, header=TRUE, sep=',')
# df02        = melt(df01, id = c('CategoryA','CategoryB','CategoryC'))
# names(df02) = c('CategoryA','CategoryB','CategoryC','DAUCO','TAF')
# df03        = subset(df02, df02$CategoryA != "" & df02$TAF > 0)
# df04        = aggregate(TAF ~ DAUCO + CategoryA, df03, sum)
# df04$Z.Score= (df04$TAF - mean(df04$TAF))/sd(df04$TAF)
# df05        = subset(df04, df04$Z.Score < 4)
# Define UI for application that draws a histogram 
  tags$h3("Volumes (TAF) by DAUCO"),
  selectInput(inputId = "d", label = "DAUCO",    choices = sort(unique(rds02$DAU_NAME)), selected = "00125"),
  plotOutput(outputId = "scatterPlot")
server <- function(input, output, session) {
#  data <- reactive({mtcars})
	df1 <- reactive({
	  df0 = subset(rds02, grepl(input$d,rds02$DAU_NAME))
	  df2 = aggregate(TAF ~ WY + DAU_NAME + CategoryA, df0, sum)
  output$scatterPlot <- renderPlot({
     ggplot(data = df1(), aes_string(x = "WY", y = "TAF", color="CategoryA", group="CategoryA")) + 
#     ggplot(data = df1(), aes_string(x = input$x, y = input$y, color="CategoryA", group="CategoryA")) + 
     # ggplot(data = subset(rds02, grepl(input$d, rds02$DAU_NAME)), 
     #        aes_string(x = input$x, y = input$y)) + 
  	 #       facet_grid(rows=vars(CategoryA), scale="free_y") +
  		      geom_line() +
            geom_point(aes(size = 2.0)) + 
shinyApp(ui = ui, server = server)hellyj@P50:/opt/shiny-server/samples/sample-apps/WB$

Aloha. Figured it out. I wasn't aware that the underlying filename had to be app.R. You'd think this would be made obvious somewhere but it's not. Pg 3 of the Mastering Shiny book only says to create such an app.R file; not that it's required. I guess there are variants for ui.R and server.R also. Is this the only naming convention? Can it be modfied or is the uniqueness controlled by the directory name?

This topic was automatically closed 54 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.