HTML Flexdashboard does not show in dockerized shiny proxy, although it gets rendered

Hi,

I have a Dockerfile for an Rmarkdown Flexdashboard with shiny elements. Those Flexdashboards containers are started via a dockerized Shiny Proxy. The Container starts fine, but I only see a blank page in the Browser. I have no Error in any logs and if I look at the docker logs of the newly started flexdashboard cointainer, the Rmarkdown renders completely fine. Also, the Flexdashboard works fine if I start the container alone without shiny proxy. The test shiny app also works fine- I think it is a Rmarkdown render/display problem.
I would verily appreciate help. Please see my Dockerfile and attached application.yml. I thought it might be a conflict with the locale of shiny proxy and the Flexdashboard Dockerfiles as described here, but so far it did not help: https://github.com/rstudio/shiny-server/issues/144#issuecomment-140212179

Dockerfile

FROM rocker/shiny-verse

MAINTAINER Tobias Verbeke "tobias.verbeke@openanalytics.eu"


RUN R -e "install.packages(c( 'flexdashboard', 'plotly', 'knitr', 'd3heatmap'), dependencies = TRUE)"

	
RUN mkdir -p /bin
COPY dashboard_example.Rmd   /bin/dashboard_example.Rmd  


# make all app files readable (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /bin

EXPOSE 3838

CMD ["R", "-e", "rmarkdown::run('/bin/dashboard_example.Rmd', shiny_args = list(port = 3838, host = '0.0.0.0'))"]

application.yml

proxy:
  title: Data Dashboards
  hide-navbar: true
  landing-page: /
  port: 3838
  authentication: none
  docker:
    internal-networking: true    

  specs:
          
  - id: 06_test
    display-name: test Shiny
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
    container-image: openanalytics/shinyproxy-demo
    container-network:  kt-net

  - id: 07_test
    display-name: test Flexdashboard
    description: Application which demonstrates the basics of Flexdashboard
    container-cmd: ["R", "-e", "rmarkdown::run('/bin/dashboard_example.Rmd', shiny_args = list(port = 3838, host = '0.0.0.0'))"]
    container-image: example_dashboard
    container-network:  kt-net

logging:
  file:
   shinyproxy.log

Do you have container logs turned on?

maybe there is some useful info in the browser console?

Can you provide a reproducible example? Since this particular Dockerfile misses some system dependencies…

Do you have container logs turned on?

Well is it not sufficient to look at the docker container output via docker logs [containername]? Here I can see the Rmarkdown document is rendered completely.

maybe there is some useful info in the browser console?

This is my Chrome console output of the blank page:

    at invokePostRenderHandlers (eval at <anonymous> (jquery.min.js:2), <anonymous>:848:31)
    at Object.window.HTMLWidgets.staticRender (eval at <anonymous> (jquery.min.js:2), <anonymous>:659:5)
    at HTMLDocument.eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:688:26)
    at i (jquery.min.js:2)
    at Object.add [as done] (jquery.min.js:2)
    at n.fn.init.n.fn.ready (jquery.min.js:2)
    at new n.fn.init (jquery.min.js:2)
    at n (jquery.min.js:2)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:687:12)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:890:3)

Can you provide a reproducible example? Since this particular Dockerfile misses some system dependencies…

I am not sure what I should provide? The one thing missing is the Dockerfile for the shiny proxy:


RUN mkdir -p /opt/shinyproxy/

RUN wget https://www.shinyproxy.io/downloads/shinyproxy-2.3.0.jar -O /opt/shinyproxy/shinyproxy.jar

COPY application.yml /opt/shinyproxy/application.yml

# make all app files readable (solves issue when dev in Windows, but building in Ubuntu)

RUN chmod -R 755 /opt/shinyproxy/

RUN useradd shinyproxy -u 1000 -d /opt/shinyproxy \

    && chown -R shinyproxy /opt/shinyproxy/

WORKDIR /opt/shinyproxy/config

CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]```

What I meant is that I can’t build a docker image from the Dockerfile you pasted in the first post, since some system dependencies are missing for some of the R packages, so i get an error. Since I assume you have the image working, I wonder if you can share the complete Dockerfile you used. (otherwise you might want to check if in your case all the packages were correctly installed in the docker image)

Regarding the browser console, it is a bit cryptic, but maybe there are some JS issues, so another thing to try is to to remove some parts from the rmarkdown file to isolate the issue.

What I meant is that I can’t build a docker image from the Dockerfile you pasted in the first post, since some system dependencies are missing for some of the R packages, so i get an error. Since I assume you have the image working, I wonder if you can share the complete Dockerfile you used. (otherwise you might want to check if in your case all the packages were correctly installed in the docker image)

I rebuild the Docker image with my file I specified, the Docker image gets build and the flexdashboard loads fine on the specified port localhost:3838. I get some warning messages about some of the package dependencies, but those are not critical for the deployment:

image
Did the docker build process throw an error when you tried? Thanks

Hi, I went as you suggested and excluded parts of R code of the flexdashboard.Rmd. The issue is caused apparently if there is a graphing function either from plotly or the d3heatmap package. Maybe there is an issue with missing package dependencies, base R plot() is working. However it is weird to me that the standalone Dockerimage was working properly, but if it was managed by shiny proxy not.

Yes, I had the same errors. Are you sure that the errors you see in the application are not related to the fact that some R packages failed to install?

This is indeed weird, if you find the root cause, let me know I would be curious to know.

Hi mnazarov,

I made it work with another Dockerfile which uses another base:

FROM openanalytics/r-shiny

 
# Install dependencies 
RUN apt-get update && apt-get install -y  \
            libxml2-dev \
            libudunits2-dev \
            # some libs not installed as no DB connection needed
            #libmariadbd-dev \  
            #libmariadb-client-lgpl-dev \
            #unixodbc-dev \
            #libpq-dev \
            libssh2-1-dev \
            libcurl4-openssl-dev \
            libsasl2-dev \
            && rm -rf /var/lib/apt/lists/*
	

# install R packages
RUN    R -e "install.packages(c('tidyverse', 'flexdashboard', 'knitr', 'plotly'), dependencies = TRUE, repo='http://cran.r-project.org')"


RUN mkdir -p /bin
COPY dashboard_example.Rmd    /bin/dashboard_example.Rmd


# make all app files readable (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /bin

EXPOSE 3838

CMD ["R", "-e", "rmarkdown::run('/bin/dashboard_example.Rmd', shiny_args = list(port = 3838, host = '0.0.0.0'))"]

There might have been missing some critical libs, likely ssh/ssl libs for the deployment. What I am still wondering, there is no shiny-server installed, why is the base image without shiny proxy still working? Can I deploy this without shiny-server without disadvantage?

Thanks for sharing, indeed as I mentioned above you probably missed some system dependencies needed for some of the R packages…Normally you should see them mentioned in the log (whenever installation fails).
The whole point of shinyproxy is that you don’t need shiny server (see https://www.shinyproxy.io/#open-source-shiny-package), and you can deploy your apps without it, as you would run them locally (i.e. you only need R package dependencies).

Update 2020-01-29:
I updated the Dockerfile I used for the image, which was later used in Shinyproxy. You can find it in on of blog posts: https://medium.com/analytics-vidhya/deploying-a-shiny-flexdashboard-with-docker-cca338a10d12