Hi friends!
We have being using kubernetes to deploy our shiny apps using shiny server pro on a cluster for the past year. It has been working perfectly. However after the shiny v1.3 come out there has been some issues.
After v1.3, our apps stoped working. The app url returned "400 Bad Request" error. What I found is this somehow related to the www
folder we have in the shiny app directory. So our shiny apps directory structure is like this ../shiny-server/a/app1
, ../shiny-server/a/app2
etc. In ../shiny-server/a/app1
we have the server.R
, ui.R
, global.R
files, and in ../shiny-server/a/app1/www
folder we put the pdfs and images we use in our app. If we rename the www
folder to something else, the apps start running again, but all the static files from shiny packages are not loaded except for sockjs-0.3.4.min.js
, shiny-server-client.min.js
, shiny-server.css
. See the image below.
If I use shiny 1.2 and its related dependencies instead, everything works fine again. The
www
problem goes away, and all the static files loads normally.
This is the not working docker file.
FROM r-base:latest
ENV http_proxy ""
ENV https_proxy ""
RUN apt-get update && apt-get install -y --allow-downgrades \
gdebi-core \
gsl-bin \
libcurl4-gnutls-dev \
libgsl0-dev \
libxt6=1:1.1.5-1+b3 \
libxt-dev \
pandoc \
pandoc-citeproc \
sudo \
libglib2.0-0 \
libglib2.0-dev \
libcairo2-dev \
rrdtool \
libpq-dev \
libgdal-dev \
libudunits2-dev \
libssl-dev \
psmisc
RUN R -e "install.packages(c( 'shiny', 'shinydashboard', 'dplyr', 'PerformanceAnalytics', 'tseries', 'zoo', 'TTR', 'quantmod', 'ggvis', 'reshape', 'plyr', 'leaflet', 'DT', 'RPostgreSQL', 'shinyWidgets', 'shinyBS', 'rjson', 'reshape2', 'data.table', 'maps', 'tigris', 'optparse', 'pool', 'tidyr', 'dygraphs' ), repos='http://cran.rstudio.com/')"
RUN MD5="c3146eaa5ba5f757d1088b5217c2a313" && \
wget --no-verbose http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb && \
echo "$MD5 multiarch-support_2.19-18+deb8u10_amd64.deb" | md5sum -c - && \
dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb && \
rm -f multiarch-support_2.19-18+deb8u10_amd64.deb
RUN MD5="988393d399c0c8776e0e05a505e68fe0" &&\
wget --no-verbose http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
echo "$MD5 libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb" | md5sum -c - && \
dpkg -i libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
rm -f libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN echo "9af7440986893c904f24c086c50846ddc5a0f24864f5566b747b8f1a17f7fd52 "\
"dumb-init_1.2.0_amd64.deb" | sha256sum -c -
RUN dpkg -i dumb-init_1.2.0_amd64.deb
# Download and install shiny server
RUN VERSION=1.5.10.990 && \
# WARNING: if we use a new version here we must test that log out, and logging still works
MD5="e70f46f8c43191be606dd507e33ed3c5" && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-pro-build/ubuntu-14.04/x86_64/shiny-server-commercial-$VERSION-amd64.deb" -O ss-latest.deb && \
echo "$MD5 ss-latest.deb" | md5sum -c - && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb
COPY app /srv/shiny-server/
COPY app/templates /etc/shiny-server/templates/
COPY app/shiny-server.sh /usr/bin/shiny-server.sh
COPY app/docker_entrypoint.sh /usr/bin/docker_entrypoint.sh
COPY app/dev-server.sh /usr/bin/dev-server.sh
EXPOSE 3838
ENTRYPOINT ["dumb-init", "--"]
CMD ["/bin/bash", "/usr/bin/docker_entrypoint.sh"]
This is the working docker file.
FROM r-base:latest
ENV http_proxy ""
ENV https_proxy ""
RUN apt-get update && apt-get install -y --allow-downgrades \
gdebi-core \
gsl-bin \
libcurl4-gnutls-dev \
libgsl0-dev \
libxt6=1:1.1.5-1+b3 \
libxt-dev \
pandoc \
pandoc-citeproc \
sudo \
libglib2.0-0 \
libglib2.0-dev \
libcairo2-dev \
rrdtool \
libpq-dev \
libgdal-dev \
libudunits2-dev \
libssl-dev \
psmisc
RUN R -e "install.packages(c( 'mime', 'jsonlite', 'digest', 'htmltools', 'R6', 'sourcetools', 'later', 'promises', 'crayon' ), repos='http://cran.rstudio.com/')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/xtable/xtable_1.8-3.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.3.1.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/httpuv/httpuv_1.5.0.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages('http://cran.r-project.org/src/contrib/Archive/shiny/shiny_1.2.0.tar.gz', repos=NULL, type='source')"
RUN R -e "install.packages(c( 'shinydashboard', 'dplyr', 'PerformanceAnalytics', 'tseries', 'zoo', 'TTR', 'quantmod', 'ggvis', 'reshape', 'plyr', 'leaflet', 'DT', 'RPostgreSQL', 'shinyWidgets', 'shinyBS', 'rjson', 'reshape2', 'data.table', 'maps', 'tigris', 'optparse', 'pool', 'tidyr', 'dygraphs' ), repos='http://cran.rstudio.com/')"
RUN MD5="c3146eaa5ba5f757d1088b5217c2a313" && \
wget --no-verbose http://ftp.us.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb && \
echo "$MD5 multiarch-support_2.19-18+deb8u10_amd64.deb" | md5sum -c - && \
dpkg -i multiarch-support_2.19-18+deb8u10_amd64.deb && \
rm -f multiarch-support_2.19-18+deb8u10_amd64.deb
RUN MD5="988393d399c0c8776e0e05a505e68fe0" &&\
wget --no-verbose http://security-cdn.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
echo "$MD5 libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb" | md5sum -c - && \
dpkg -i libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb && \
rm -f libssl1.0.0_1.0.1t-1+deb8u11_amd64.deb
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN echo "9af7440986893c904f24c086c50846ddc5a0f24864f5566b747b8f1a17f7fd52 "\
"dumb-init_1.2.0_amd64.deb" | sha256sum -c -
RUN dpkg -i dumb-init_1.2.0_amd64.deb
# Download and install shiny server
RUN VERSION=1.5.10.990 && \
# WARNING: if we use a new version here we must test that log out, and logging still works
MD5="e70f46f8c43191be606dd507e33ed3c5" && \
wget --no-verbose "https://s3.amazonaws.com/rstudio-shiny-server-pro-build/ubuntu-14.04/x86_64/shiny-server-commercial-$VERSION-amd64.deb" -O ss-latest.deb && \
echo "$MD5 ss-latest.deb" | md5sum -c - && \
gdebi -n ss-latest.deb && \
rm -f version.txt ss-latest.deb
COPY app /srv/shiny-server/
COPY app/templates /etc/shiny-server/templates/
COPY app/shiny-server.sh /usr/bin/shiny-server.sh
COPY app/docker_entrypoint.sh /usr/bin/docker_entrypoint.sh
COPY app/dev-server.sh /usr/bin/dev-server.sh
EXPOSE 3838
ENTRYPOINT ["dumb-init", "--"]
CMD ["/bin/bash", "/usr/bin/docker_entrypoint.sh"]