-
-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
I am using orca inside a downloadHandler function in an R-Shiny app inside Docker. When I click on the download button to generate and dowonload a plot I get disconnected from the session. Moreover, on the log file I get:
Warning: Error in processx::run: System command error
I am using xvfb-run to run orca with a script like this:
xvfb-run -a /squashfs-root/app/orca "$@"
Here is a minimal example of the shiny app:
library(shiny)
library(plotly)
ui <- fluidPage(
downloadButton('plot_download', 'Download plot')
)
server <- function(input, output) {
output$plot_download <- downloadHandler(
filename = function(){
plot_file_name<-'plot.png'
},
content = function(file) {
path_split<-unlist(strsplit(file,'/'))
download_path<-paste(path_split[1:length(path_split)-1],collapse='/')
p <- plot_ly(x = 1:10, y = 1:10, color = 1:10)
withr::with_dir(download_path, orca(p, path_split[length(path_split)]))
})}
shinyApp(ui = ui, server = server)
Moreover, when I use orca in the R terminal inside Docker to generate the same plot, it works.
Here is my dockerfile:
# Install R version 3.5
FROM r-base:3.5.0
# Install Ubuntu packages
RUN apt-get update && apt-get install -y \
sudo \
gdebi-core \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev/unstable \
libxt-dev \
libssl-dev \
libpq-dev \
libgtk2.0-bin \
libx11-xcb1 \
libxtst6 \
libgconf-2-4 \
libnss3 \
libasound2 \
xvfb
# Download and install ShinyServer (latest version)
RUN wget --no-verbose https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/VERSION -O "version.txt" && \
VERSION=$(cat version.txt) && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-os-build/ubuntu-12.04/x86_64/shiny-server-$VERSION-amd64.deb" -O ss-latest.deb && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb
# Install R packages that are required
RUN R -e "install.packages(c('shiny', 'devtools', 'processx'), repos='http://cran.rstudio.com/')"
RUN R -e "devtools::install_github('ropensci/plotly')"
COPY orca_xvfb.sh /srv/shiny-server/orca_xvfb.sh
RUN chmod +x /srv/shiny-server/orca_xvfb.sh
# Download install orca (plotly library to download plots)
RUN wget --no-verbose -P /srv/shiny-server/ "https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage"
RUN chmod +x /srv/shiny-server/orca-1.2.1-x86_64.AppImage
RUN .//srv/shiny-server/orca-1.2.1-x86_64.AppImage --appimage-extract
RUN ln -s /srv/shiny-server/orca_xvfb.sh /usr/bin/orca
# Copy configuration files into the Docker image
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
COPY /app /srv/shiny-server/
# Make the ShinyApp available at port 80
EXPOSE 80
# Copy further configuration files into the Docker image
COPY shiny-server.sh /usr/bin/shiny-server.sh
CMD ["/usr/bin/shiny-server.sh"]
I am using the github version of plotly. If I use the CRAN version and I try to download the plot, I get an error message saying that I need a mapbox token.
I really appreciate any help on this.
Metadata
Metadata
Assignees
Labels
No labels