almahmoud / gha-build

0 stars 3 forks source link

Can we use these binaries on shinyapps.io? #2

Open lcolladotor opened 1 year ago

lcolladotor commented 1 year ago

Hi,

Me and my colleagues frequently deploy shiny apps to shinyapps.io where we use Bioconductor packages. This involves deploying an app with the rsconnect package, as for example you can see at https://github.com/LieberInstitute/spatialDLPFC/blob/840700ae86cdd414e024d9658b09dd11712ef470/code/deploy_app_k09/deploy.R#L17. Prior to running rsconnect::deployApp(), we typically have to use BiocManager to specify the Bioconductor repositories as I do at https://github.com/LieberInstitute/spatialDLPFC/blob/840700ae86cdd414e024d9658b09dd11712ef470/code/deploy_app_k09/deploy.R#L14. Deploying these apps can take several minutes as Bioconductor packages are compiled from source by shinyapps.io, and well, it would be a prime use case of the new ubuntu Bioconductor binaries that would have a positive impact for users deploying apps with Bioconductor dependencies to shinyapps.io like us.

From Alex's great talk at BioC2023 and my question after his talk, my understanding is that BiocManager::repositories() provides output that is dependent on the OS you are running it on. In my use case, it would be my laptop (say a macOS one), so it doesn't include the URLs for these new ubuntu binaries. Thus shinyapps.io doesn't even know they exist.

```R > BiocManager::repositories() 'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories", package = "BiocManager")' for details. Replacement repositories: CRAN: https://cloud.r-project.org/ BioCsoft "https://bioconductor.org/packages/3.17/bioc" BioCann "https://bioconductor.org/packages/3.17/data/annotation" BioCexp "https://bioconductor.org/packages/3.17/data/experiment" BioCworkflows "https://bioconductor.org/packages/3.17/workflows" BioCbooks "https://bioconductor.org/packages/3.17/books" CRAN "https://cloud.r-project.org/" > sessioninfo::session_info() ─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.3.1 (2023-06-16) os macOS Ventura 13.4 system aarch64, darwin20 ui X11 language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz America/New_York date 2023-08-10 pandoc 3.1.5 @ /opt/homebrew/bin/pandoc ─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date (UTC) lib source BiocManager 1.30.22 2023-08-08 [1] CRAN (R 4.3.0) brio 1.1.3 2021-11-30 [1] CRAN (R 4.3.0) cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.0) callr 3.7.3 2022-11-02 [1] CRAN (R 4.3.0) cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0) colorout 1.2-2 2023-05-06 [1] Github (jalvesaq/colorout@79931fd) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.3.0) devtools * 2.4.5 2022-10-11 [1] CRAN (R 4.3.0) digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0) fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0) fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0) glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0) htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.3.0) htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.0) httpuv 1.6.11 2023-05-11 [1] CRAN (R 4.3.0) later 1.3.1 2023-05-02 [1] CRAN (R 4.3.0) lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.0) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.0) mime 0.12 2021-09-28 [1] CRAN (R 4.3.0) miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0) pkgbuild 1.4.2 2023-06-26 [1] CRAN (R 4.3.0) pkgload 1.3.2.1 2023-07-08 [1] CRAN (R 4.3.0) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.3.0) processx 3.8.2 2023-06-30 [1] CRAN (R 4.3.0) profvis 0.3.8 2023-05-02 [1] CRAN (R 4.3.0) promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0) prompt 1.0.1 2023-05-06 [1] Github (gaborcsardi/prompt@7ef0f2e) ps 1.7.5 2023-04-18 [1] CRAN (R 4.3.0) purrr 1.0.1 2023-01-10 [1] CRAN (R 4.3.0) R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0) Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.0) remotes 2.4.2.1 2023-07-18 [1] CRAN (R 4.3.0) rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.0) rsthemes 0.4.0 2023-05-06 [1] Github (gadenbuie/rsthemes@34a55a4) rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0) shiny 1.7.4.1 2023-07-06 [1] CRAN (R 4.3.0) stringi 1.7.12 2023-01-11 [1] CRAN (R 4.3.0) stringr 1.5.0 2022-12-02 [1] CRAN (R 4.3.0) testthat * 3.1.10 2023-07-06 [1] CRAN (R 4.3.0) urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.3.0) usethis * 2.2.2 2023-07-06 [1] CRAN (R 4.3.0) vctrs 0.6.3 2023-06-14 [1] CRAN (R 4.3.0) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0) [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── > ```

So a potential test would be to provide the URLs for these binaries and see if rsconnect::deployApp() passes that info to shinyapps.io and hopefully they are used there.

I do think that they use ubuntu for the apps they deploy, but I could be wrong. Actually I see this https://docs.posit.co/shinyapps.io/getting-started.html#using-your-r-packages-in-the-cloud :

shinyapps.io is built using Ubuntu Linux as the base operating system, and is likely to be different from most users’ systems.

Also from https://libd.shinyapps.io/spatialDLPFC_Visium_Sp09/ (the deployed version of the app), I do see that they are using Ubuntu 20.04.5 LTS under the sessioninfo::session_info() output:

─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.2 (2022-10-31)
 os       Ubuntu 20.04.5 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       Etc/UTC
 date     2023-08-10
 pandoc   2.16.2 @ /opt/connect/ext/pandoc/2.16/pandoc

In that same section they mention this about Bioconductor:

In order for BioConductor packages to install succesfully on shinyapps.io, the repos option must be configured, either directly or by using setRepositories(), to include the BioConductor repositories in addition to CRAN. Failure to do so will result in an error on deployment of the form:

Error parsing manifest: Unable to determine package source for Bioconductor package BiocGenerics: Repository must be specified

So in theory, if the ubuntu Bioconductor binaries support version 20.04.5, I think that we could use them on shinyapps.io. So it seems promising.

Could be of note, recently rsconnect changed to use renv behind the scenes. So I'm not 100% if this affects the repositories and how renv passes that information. I ran into this update while deploying this app https://github.com/LieberInstitute/Visium_SPG_AD/blob/88515bc81315d9ed0cdd830ced359b14d14ff8bb/code/20_deploy_app_wholegenome_Abeta_and_pTau_microenv/deploy.R#L16-L24 and https://github.com/rstudio/rsconnect/issues/934#issuecomment-1654104704 was useful. In any case, the old behavior of rsconnect can be recovered through options(rsconnect.packrat = TRUE).

If this of interest, I'll make a small example to show this as the apps I linked to are rather large dataset-wise.

Best, Leo

almahmoud commented 1 year ago

Thanks for opening the issue to keep the conversation going! For Ubuntu 20, we have binaries built for our Terra BiocJupyter container. Here is the output of BiocManager::repositories() in that container:

'getOption("repos")' replaces Bioconductor standard repositories, see
'help("repositories", package = "BiocManager")' for details.
Replacement repositories:
    CRAN: https://cloud.r-project.org
                                                             BioCcontainers
"https://bioconductor.org/packages/3.17/container-binaries/terra-jupyter-r"
                                                                   BioCsoft
                              "https://bioconductor.org/packages/3.17/bioc"
                                                                    BioCann
                   "https://bioconductor.org/packages/3.17/data/annotation"
                                                                    BioCexp
                   "https://bioconductor.org/packages/3.17/data/experiment"
                                                              BioCworkflows
                         "https://bioconductor.org/packages/3.17/workflows"
                                                                  BioCbooks
                             "https://bioconductor.org/packages/3.17/books"
                                                                       CRAN
                                              "https://cloud.r-project.org"

with the first URL https://bioconductor.org/packages/3.17/container-binaries/terra-jupyter-r being the binary repository.

If you want to try that out, please let me know how it goes.

With that being said, the Jupyter container was recently upgraded to Ubuntu 22 which is also the base of our rstudio container, so we won't be supporting binaries for Ubuntu 20 by default going forward, however we could build them specifically for the shiny container if we get more info on it.