antarctica / asliapp

A minimal Shiny application to demonstrate EDS services, using the Amundsen Sea Low Index as a case study.
https://ditbas-asliapp.datalabs.ceh.ac.uk/
MIT License
0 stars 0 forks source link

shinyserver, renv and DESCRIPTION file #2

Open thomaszwagerman opened 3 months ago

thomaszwagerman commented 3 months ago

When deploying a Shiny application "as a package", the shinyserver fails to launch the application and gives the following error:

*** /var/log/shiny-server//shiny-server-shiny-20240607-152055-44137.log ***
su: ignoring --preserve-environment, it's mutually exclusive with --login
[2024-06-07T15:21:10.364] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
Error in loadNamespace(x) : there is no package called ‘jsonlite’
Calls: local ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted

This is despite running renv::restore(), renv::isolate() and jsonlite being present in the lock file.

App deployment

As per mastering shiny deployment and golem's instructions, a root-level app.R controls application launch.

The following fails to launch:

# With DESCRIPTION file, fails to launch
pkgload::load_all(".")
asliApp()

But when removing the DESCRIPTION file, and while sourcing without using pkgload (this demands a DESCRIPTION file), this runs with success.

# Without DESCRIPTION file, launches successfully
source("R/asliApp.R")
source("R/object_store.R")
asliApp()

renv cache

On the development notebook, .libPaths() returns:

[1] "/data/notebooks/rstudio-asliappbackend/.cache/R/renv/library/asliapp-ce9aabba/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"
[2] "/data/notebooks/rstudio-asliappbackend/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/25ebdc09"  

On the deployed application:

[1] "/srv/shiny-server/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu"            
[2] "/home/shiny/.cache/R/renv/sandbox/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/25ebdc09"

and installed.packages() returns:

  [1] "askpass"                      "base64enc"                   
  [3] "bit"                          "bit64"                       
  [5] "brew"                         "brio"                        
  [7] "bslib"                        "cachem"                      
  [9] "callr"                        "cli"                         
 [11] "clipr"                        "commonmark"                  
 [13] "cpp11"                        "crayon"                      
 [15] "credentials"                  "curl"                        
 [17] "desc"                         "diffobj"                     
 [19] "digest"                       "downlit"                     
 [21] "ellipsis"                     "evaluate"                    
 [23] "fansi"                        "fastmap"                     
 [25] "fontawesome"                  "fs"                          
 [27] "gert"                         "gh"                          
 [29] "gitcreds"                     "glue"                        
 [31] "highr"                        "hms"                         
 [33] "htmltools"                    "htmlwidgets"                 
 [35] "httpuv"                       "httr"                        
 [37] "httr2"                        "ini"                         
 [39] "jquerylib"                    "jsonlite"                    
 [41] "knitr"                        "later"                       
 [43] "lifecycle"                    "magrittr"                    
 [45] "memoise"                      "mime"                        
 [47] "miniUI"                       "openssl"                     
 [49] "paws"                         "paws.analytics"              
 [51] "paws.application.integration" "paws.common"                 
 [53] "paws.compute"                 "paws.cost.management"        
 [55] "paws.customer.engagement"     "paws.database"               
 [57] "paws.developer.tools"         "paws.end.user.computing"     
 [59] "paws.machine.learning"        "paws.management"             
 [61] "paws.networking"              "paws.security.identity"      
 [63] "paws.storage"                 "pillar"                      
 [65] "pkgbuild"                     "pkgconfig"                   
 [67] "pkgdown"                      "pkgload"                     
 [69] "praise"                       "prettyunits"                 
 [71] "processx"                     "profvis"                     
 [73] "progress"                     "promises"                    
 [75] "ps"                           "purrr"                       
 [77] "R6"                           "ragg"                        
 [79] "rappdirs"                     "rcmdcheck"                   
 [81] "Rcpp"                         "readr"                       
 [83] "rematch2"                     "remotes"                     
 [85] "renv"                         "rlang"                       
 [87] "rmarkdown"                    "roxygen2"                    
 [89] "rprojroot"                    "rstudioapi"                  
 [91] "rversions"                    "sass"                        
 [93] "sessioninfo"                  "shiny"                       
 [95] "sourcetools"                  "stringi"                     
 [97] "stringr"                      "sys"                         
 [99] "systemfonts"                  "testthat"                    
[101] "textshaping"                  "tibble"                      
[103] "tidyselect"                   "tinytex"                     
[105] "tzdb"                         "urlchecker"                  
[107] "usethis"                      "utf8"                        
[109] "vctrs"                        "vroom"                       
[111] "waldo"                        "whisker"                     
[113] "withr"                        "xfun"                        
[115] "xml2"                         "xopen"                       
[117] "xtable"                       "yaml"                        
[119] "zip"                          "base"                        
[121] "boot"                         "class"                       
[123] "cluster"                      "codetools"                   
[125] "compiler"                     "datasets"                    
[127] "foreign"                      "graphics"                    
[129] "grDevices"                    "grid"                        
[131] "KernSmooth"                   "lattice"                     
[133] "MASS"                         "Matrix"                      
[135] "methods"                      "mgcv"                        
[137] "nlme"                         "nnet"                        
[139] "parallel"                     "rpart"                       
[141] "spatial"                      "splines"                     
[143] "stats"                        "stats4"                      
[145] "survival"                     "tcltk"                       
[147] "tools"                        "utils"   

Also see rstudio/rsconnect#192, rstudio/rsconnect#197 and rstudio/rsconnect#199 - these relate to rsconnect (not shinyserver!) but I suspect it may be related.

thomaszwagerman commented 3 weeks ago

Tried following, datalabs/renv documentation written by AV, but no luck