Closed MarkEdmondson1234 closed 3 weeks ago
Shinyapps.io deployments working
A googleCloudRunner example needs a Docker with at least googleAnalyticsR and shiny installed.
deployed_url can only be seen if domain has been mapped or after first deployment e.g. deployed_url="https://cloudrun-test-ewjogewawq-ew.a.run.app"
ga_model_shiny(
ga_model_example("decomp_ga.gamr"),
auth_dropdown = "universal",
template = ga_model_shiny_template("basic_app"),
deployed_url="https://cloudrun-test-ewjogewawq-ew.a.run.app",
local_folder = "cloudrun_test")
Copy in Dockerfile and shiny-customised.config
FROM rocker/shiny
# install googleanalyticsr
RUN install2.r --error \
-r 'http://cran.rstudio.com' \
googleAnalyticsR \
## install Github packages
&& installGithub.r MarkEdmondson1234/googleAnalyticsR \
## clean up
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
COPY app.R /srv/shiny-server/app.R
COPY app/ /srv/shiny-server/app/
COPY shiny-customised.config /etc/shiny-server/shiny-server.conf
EXPOSE 8080
USER shiny
# avoid s6 initialization
# see https://github.com/rocker-org/shiny/issues/79
CMD ["/usr/bin/shiny-server"]
Deploy
library(googleCloudRunner)
cr_deploy_run("cloudrun_test/",
remote = "cloudrun_test",
tag = c("latest","$BUILD_ID"),
max_instances = 1, # required for shiny
concurrency = 80,
launch_browser = FALSE)
Cloud Run working now, included the Docker image from above to make it easier to use which will be included when writing to the local folder, gcr.io/gcer-public/googleanalyticsr-shiny-cloudrun
# from rocker/shiny with googleAnalyticsR installed & configued for Cloud Run
FROM gcr.io/gcer-public/googleanalyticsr-shiny-cloudrun
# add any dependencies for your app here
# RUN install2.r --error -r 'http://cran.rstudio.com' googleAnalyticsR
# RUN installGithub.r MarkEdmondson1234/googleAnalyticsR
COPY . /srv/shiny-server/
Can write the files to the local folder, but how to deploy it to shinyapps.io etc with:
shinyApp(gar_shiny_ui(ui, login_ui = silent_auth), server)
etc. ?Its ok for Shiny single file app.R which includes it