I have a package, MetFamily (https://github.com/ipb-halle/MetFamily/tree/master), which is web based shiny app. the following is the list of all files in the its directory structure:
[1] "binder/install.R"
[2] "binder/runtime.txt"
[3] "DESCRIPTION"
[4] "Dockerfile"
[5] "Dockerfile-base"
[6] "Dockerfile-rstudio"
[7] "inst/data/showcase/Fragment_matrix_showcase.csv"
[8] "inst/data/showcase/Metabolite_profile_showcase.txt"
[9] "inst/data/showcase/MSMS_library_showcase.msp"
[10] "inst/data/showcase/Project_file_showcase_annotated.csv.gz"
[11] "inst/data/showcase/Project_file_showcase_annotated_reduced.csv.gz"
[12] "inst/data/showcase/Project_file_showcase_reduced.csv.gz"
[13] "inst/MetFamily/app_files/server_functionsDownloads.R"
[14] "inst/MetFamily/app_files/server_functionsFilters.R"
[15] "inst/MetFamily/app_files/server_functionsSelections.R"
[16] "inst/MetFamily/app_files/server_functionsSerialization.R"
[17] "inst/MetFamily/app_files/server_functionsTableGui.R"
[18] "inst/MetFamily/app_files/server_guiAnnotation.R"
[19] "inst/MetFamily/app_files/server_guiDialogs.R"
[20] "inst/MetFamily/app_files/server_guiMs2plot.R"
[21] "inst/MetFamily/app_files/server_guiPlotControls.R"
[22] "inst/MetFamily/app_files/server_guiPlots.R"
[23] "inst/MetFamily/app_files/server_guiTabAnnotation.R"
[24] "inst/MetFamily/app_files/server_guiTabClassifier.R"
[25] "inst/MetFamily/app_files/server_guiTabExport.R"
[26] "inst/MetFamily/app_files/server_guiTabHca.R"
[27] "inst/MetFamily/app_files/server_guiTabInput.R"
[28] "inst/MetFamily/app_files/server_guiTabMsmsFilter.R"
[29] "inst/MetFamily/app_files/server_guiTabPca.R"
[30] "inst/MetFamily/app_files/server_guiTabSampleFilter.R"
[31] "inst/MetFamily/app_files/server_guiTabSearch.R"
[32] "inst/MetFamily/app_files/ui_rightColumn.R"
[33] "inst/MetFamily/server.R"
[34] "inst/MetFamily/ui.R"
[35] "inst/MetFamily/version.R"
[36] "inst/MetFamily/www/css/ipb-styles.css"
[37] "inst/MetFamily/www/img/2013_IPB_Logo_EN.png"
[38] "inst/MetFamily/www/img/2019_wch_logo_de_invertiert.png"
[39] "inst/MetFamily/www/img/2020_Logo_schrift_weiß_Trans_EN.png"
[40] "inst/MetFamily/www/img/body-bg.png"
[41] "inst/MetFamily/www/img/denbi-logo-white.svg"
[42] "inst/MetFamily/www/img/Leibniz__Logo_EN_Negative_100mm.svg"
[43] "inst/MetFamily/www/img/Metfamily.gif"
[44] "inst/MetFamily/www/ipbfooter.html"
[45] "inst/MetFamily/www/logo_ipb_en.png"
[46] "LICENSE"
[47] "man/startMetFamily.Rd"
[48] "NAMESPACE"
[49] "R/Analysis.R"
[50] "R/Annotation.R"
[51] "R/Classifiers.R"
[52] "R/DataProcessing.R"
[53] "R/FragmentMatrixFunctions.R"
[54] "R/Plots.R"
[55] "R/R_packages.R"
[56] "R/StartApp.R"
[57] "R/TreeAlgorithms.R"
[58] "README.md"
[59] "supervisord-rstudio.conf"
[60] "supervisord.conf"
[61] "tests/testthat.R"
[62] "tests/testthat/test_fileinput.R"
this is how I run the MetFamily web shiny app in the container:
#install Docker Desktop for Windows and start it.
#Open a command prompt or terminal window.
#Build the MetFamily container in the directory, E:\soft\MetFamily-master:
docker build -t sneumann/metfamily .
#Run the MetFamily container:
docker run -p 3838:3838 sneumann/metfamily:latest
#Open a web browser and navigate to http://localhost:3838/
I am using the following strategy to access the log of shiny app running in the container at http://localhost:3838/:
I make app.R file in the package directory. the content of the app.R is:
app.R
source("server.R")
source("ui.R")
#also copy it to inst/metfamily
Also I make an run_profvis.R file in the package directury. the content of the run_profvis.R is::
run_profvis.R
library(shiny)
library(profvis)
setwd("/tmp/MetFamily/inst/MetFamily") # Set the correct path to your Shiny app directory in the container
Define the Shiny application by sourcing both ui.R and server.R
ui <- source("ui.R", local = TRUE)valueserver<−source("server.R",localvalue
Wrap the Shiny app initialization in profvis
p <- profvis({
runApp(shinyApp(ui, server))
})
After receiving the profvis object with the profiling results
Save it to a file or render the results
saveRDS(p, file = "profiling_results.rds")
You can also use print(p) to see where most of the time is spent or,
If running this in an interactive R session (not via Rscript), you can use profvis's built-in viewer:
print(profvis::profvisOutput(p))
Optional: if you want to automatically open the profiling results in a browser,
you can add this line after saving the results. Note that you need to run R in an interactive mode.
if(interactive()) { profvis::print(p) }
Instruct the script to wait before exiting
to give some time for the app to run and be profiled
Sys.sleep(60)
than I build and run the container by following command in CMD:
cd E:\soft\MetFamily-master_14122023\MetFamily-master
docker build -t sneumann/metfamily .
docker run -p 3838:3838 sneumann/metfamily:latest
than I root in the containar as follows :
#get container ID:
docker ps
#access the Docker container root:
docker exec -it d47207e50eba /bin/bash
#navigate to the /tmp directory
cd /tmp
tan I copy run_profvis.R to the rootID/temp (root@d47207e50eba:/tmp#) directory of the container by the following command in bash in powershell:
PS C:\Program Files\Docker\Docker> docker cp E:\soft\MetFamily-master_14122023\MetFamily-master\run_profvis.R d47207e50eba:/tmp/
than I run the run_profvis.R in the container file in bash in powershell:
root@d47207e50eba:/tmp# Rscript run_profvis.R
mow I dont know how to see the log and the details of the running code in real time in the Metfamily shiny web which is running in container
Please tell me how can I get all R cods which is runing in real time in the Metfamily shiny web which is running in container?