我正在尝试在 Google Cloud App Engine 灵活环境中部署一个 Shiny 的应用程序(没有 Shiny 的服务器)。因此,我对我的 shiny 应用程序进行了 docker 化,它在我的计算机上运行良好。
这是 app.yaml :
runtime: custom
env: flex
这是我的 docker 文件:
# start with the official R project base image
FROM r-base:latest
# copy this github repo into the Docker image and set as the working directory
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
# Install the C/C++ libraries needed to run the script
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libssl-dev \
libcurl4-openssl-dev \
libxml2-dev
# Install the R libraries needed to run the scripts
RUN /usr/bin/R --vanilla -f install_libraries.R
EXPOSE 8080
# Execute the target script
CMD ["Rscript", "run.R"]
这是我的 Rcode 启动我 Shiny 的应用程序:run.R
library(shiny)
runApp(port = 8080, host = "0.0.0.0",launch.browser = FALSE)
所有部署都进行得很顺利,但是当我转到我的应用程序引擎时 - https://.appspot.com/- 我在控制台中出现此错误。应用程序看起来是灰色的。
有没有办法将我 Shiny 的应用放在应用引擎而不是计算引擎上?
最佳答案
Shiny 基于 App Engine 目前不支持的 WebSockets。但是,它们现在(link)在灵活环境中开箱即用。这使得 Shiny App 非常容易在 App Engine 上部署。从本质上讲,您的代码现在应该可以正常工作。
关于r - 在 Google Cloud App Engine 上部署 Shiny 的应用程序会返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53051531/