rdrop2 shinyapp在本地工作,但不会部署到shinyapps.io由于启动时间太长,遵循各种建议仍然无法让它太工作

9gm1akwq  于 2023-04-03  发布在  其他
关注(0)|答案(1)|浏览(107)

我试图得到一个shinyapp,它使用持久性数据存储通过下拉框部署到shinyapps.io。该应用程序在本地工作,但当我部署它,它说 * 发生错误无法连接到工人后60.00秒;启动时间太长 *。
我尝试过用各种方法更改顶部的令牌部分,但无法将其部署,尽管部署已经完成,并且日志显示没有错误。(见下文)

----- Deployment log started at  2020-06-13 14:01:48  -----
Deploy command: 
 rsconnect::deployApp(appDir = "~/R/WHUAAPP3", appFileManifest = "C:/Users/Clare/AppData/Local/Temp/18ff-4edc-f7e3-ddae",      account = "clareb1992", server = "shinyapps.io", appName = "WHUAAPP3",      appId = 2449618, launch.browser = function(url) {         message("Deployment completed: ", url)     }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE),      logLevel = "verbose") 

Session information: 
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1   rsconnect_0.8.15
Cookies: 
[1] "None"
GET /v1/applications/2449618 499ms
----- Bundle upload started at  2020-06-13 14:01:48  -----
[2020-06-13 14:01:48] Inferring App mode and parameters 
[2020-06-13 14:01:48] Bundling app dir 
[2020-06-13 14:01:48] Generate manifest.json 
[2020-06-13 14:02:19] Writing Rmd index if necessary 
[2020-06-13 14:02:19] Compressing the bundle 
POST /v1/bundles 530ms
[2020-06-13 14:02:20] Starting upload now 
PUT /bundles/application-2449618/0b31cdcbc7da417c910efe4c49bb3eb1.tar.gz?AWSAccessKeyId=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VTfSbsLZnUUMBOok5uk37fx9r%2F7blBqVDASoO%2Fy5pBo8FaUKhQYcbFMjpOJc15jz3hXrpAjTwEcA8LpZnBY5PlKUdPK5SCMjaHRE9Vd7gXg%2FrfKQJ86xBW5wYLaF3jFXZjVyUzwlncuTg%3D%3D&Signature=cW1teEVyFR%2Bl4Q8X4IlygH51ysE%3D&content-type=application%2Fx-tar 1079ms
[2020-06-13 14:02:21] Upload complete 
POST /v1/bundles/3265302/status 509ms
GET /v1/bundles/3265302 450ms
[2020-06-13 14:02:22] Saving deployment record for WHUAAPP3 -  
----- Server deployment started at  2020-06-13 14:02:22  -----
POST /v1/applications/2449618/deploy 579ms
Waiting for task: 746557269
GET /v1/tasks/746557269 449ms
  building: Processing bundle: 3265302
GET /v1/tasks/746557269 500ms
  building: Building image: 3654460
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 490ms
  building: Fetching packages
GET /v1/tasks/746557269 520ms
  building: Installing packages
GET /v1/tasks/746557269 460ms
GET /v1/tasks/746557269 670ms
GET /v1/tasks/746557269 490ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 500ms
GET /v1/tasks/746557269 479ms
GET /v1/tasks/746557269 490ms
GET /v1/tasks/746557269 480ms
GET /v1/tasks/746557269 470ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 500ms
GET /v1/tasks/746557269 519ms
GET /v1/tasks/746557269 579ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 570ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 480ms
GET /v1/tasks/746557269 469ms
  building: Installing files
GET /v1/tasks/746557269 500ms
GET /v1/tasks/746557269 450ms
GET /v1/tasks/746557269 480ms
  building: Pushing image: 3654460
GET /v1/tasks/746557269 459ms
GET /v1/tasks/746557269 520ms
GET /v1/tasks/746557269 480ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 450ms
GET /v1/tasks/746557269 450ms
GET /v1/tasks/746557269 520ms
GET /v1/tasks/746557269 500ms
GET /v1/tasks/746557269 480ms
GET /v1/tasks/746557269 480ms
GET /v1/tasks/746557269 450ms
GET /v1/tasks/746557269 459ms
GET /v1/tasks/746557269 460ms
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 449ms
  deploying: Starting instances
GET /v1/tasks/746557269 469ms
GET /v1/tasks/746557269 500ms
  rollforward: Activating new instances
GET /v1/tasks/746557269 459ms
  success: Stopping old instances
----- Deployment log finished at  2020-06-13 14:03:35  -----
Deployment completed: https://clareb1992.shinyapps.io/WHUAAPP3/

当前代码
这里是我使用的最小代码,如有任何帮助将不胜感激.

library(shiny)
library(shinydashboard)
library(rdrop2)
library(DT)
library(rsconnect)
rsconnect::deployApp

token <- drop_auth()
saveRDS(token, "my-token.rds")
drop_auth(rdstoken = "my-token.rds")

outputDir <- "Games"

fields <-  
  c("Date","Umpire","UIN","Level","HomeTeam","AwayTeam","Coach","Assessor", 
   "Assessment","Good1","Good2","Bad1","Bad2","FurtherN")
    
    
    title<-tags$b(tags$img(src="WHUA_Logo.jpg",width=50, height=50),'WHUA Umpiring Game Tracker and 
     Reflection App')
    
    ui <-dashboardPage(skin= "yellow", #this gives the main app background colour
                       dashboardHeader(
                         title = title, titleWidth = 700),
    
    ## all mydashboard stuff
    
    server <- function(input, output) {
      
      saveData <- function(data) {
        data <- t(data)
        # Create a unique file name
        fileName <- sprintf("WHUAAppData3.csv", as.integer(Sys.time()), digest::digest(data))
        # Write the data to a temporary file locally
        filePath <- file.path(tempdir(), fileName)
        write.csv(data, filePath, row.names = FALSE, quote = TRUE)
        # Upload the file to Dropbox
        drop_upload(filePath, path = outputDir)
      }
      
      loadData <- function() {
        
        filesInfo <- drop_dir(outputDir)
        filePaths <- filesInfo$path_display
        data <- lapply(filePaths, drop_read_csv, stringsAsFactors = FALSE)
        # Concatenate all data together into one data.frame
        data <- do.call(rbind, data)
        data
      }
      
      
      # Whenever a field is filled, aggregate all form data
      #formData is a reactive function
      formData <- reactive({
        data <- sapply(fields, function(x) input[[x]])
        data
      })
      
      # When the Save button is clicked, save the form data
      observeEvent(input$save,{
        saveData(formData())
      })
      
      # Show the previous responses
      # (update with current response when save is clicked)
      output$responses <- DT::renderDataTable({
        input$save
        loadData()
      })   
      
    
    shinyApp(ui = ui, server = server)
0tdrvxhp

0tdrvxhp1#

这里的问题是过度复杂化。

token <- drop_auth()
saveRDS(token, "my-token.rds")

这些代码行只需要运行一次,然后需要从全局环境中删除它们,以使应用程序部署工作只需要你想要的

drop_auth(rdstoken = "my-token.rds")

在你的全球环境中。希望这在未来能帮助到其他人。

相关问题