I am having issues with permission being denied when trying to use a persistent cache with the new bindCache()
function. Everything works perfectly fine on my own computer, but when I build it with docker the plot does not show up and I get the following error:
cannot open compressed file '/srv/shiny-server/plot-cache/c0e050396e438974429673dba2aad4e4.rds-temp-389d897bab8657c8', probable reason 'Permission denied'
Warning: Error in cache$set: Error setting value for key "c0e050396e438974429673dba2aad4e4".
I am using the following in my server.R file:
output$plot <- renderPlot({plot_here }) %>%
shiny::bindCache(input$cloud_n, Text_Data()
# If the line below this is commented out, the default behavior works well
, cache = cachem::cache_disk("./plot-cache")
)
My dockerfile looks something like this:
FROM rocker/shiny:4.0.3
LABEL org.label-schema.license="GPL-2.0" \
org.label-schema.vcs-url="https://github.com/rocker-org/rocker-versioned" \
org.label-schema.vendor="Rocker Project" \
maintainer="Carl Boettiger <cboettig@ropensci.org>"
RUN /rocker_scripts/install_tidyverse.sh
RUN /rocker_scripts/install_geospatial.sh
# Install R packages that are required
RUN R -e "install.packages('shinydashboard')"
RUN R -e "install.packages('leaflet')"
RUN R -e "install.packages('DT')"
RUN R -e "install.packages('pdp')"
RUN R -e "install.packages('randomForest')"
RUN R -e "install.packages('wordcloud')"
# Added this to insure I get the latest shiny with bindCache()
RUN R -e "install.packages('shiny')"
COPY /App /srv/shiny-server/
Is there a way to set the permissions in my dockerfile to give my app the permission it needs to write files in the persistent cache folder?
If not in the dockerfile, is there some other way to specify permissions for the cache folder? Maybe a simple shell script that is run in the dockerfile? I am not sure the best way to go about this. I found this about shiny file permissions but I do not know how to implement for my use case. Thanks!