使用 shinyproxy 部署 shiny - 没有应用程序显示
Deploy shiny with shinyproxy - no app showing
我开发了一个闪亮的应用程序,我正在尝试使用 shinyproxy 进行首次轻量级部署。
所有安装似乎都很好。
我已经安装了 docker, java.
我认为构建一个包装应用程序和其他功能的包是个好主意。
所以我开发了一个包(CI),CI::launch_application
基本上是 shiny
包的 RunApp
功能的包装器。这是代码:
launch_application <- function(launch.browser = interactive(), ...) {
runApp(
appDir = system.file("app", package = "CI"),
launch.browser = launch.browser,
...
)
}
我用这个 Dockerfile
成功构建了 docker 镜像
FROM rocker/r-base:latest
## Install required dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
## for R package 'curl'
libcurl4-gnutls-dev \
apt-utils \
## for R package 'xml2'
libxml2-dev \
## for R package 'openssl'
libssl-dev \
zlib1g-dev \
default-jdk \
default-jre \
&& apt-get clean \
&& R CMD javareconf \
&& rm -rf /var/lib/apt/lists/
## Install major fixed R dependencies
# - they will always be needed and we want them in a dedicated layer,
# as opposed to getting them dynamically via `remotes::install_local()`
RUN install2.r --error \
shiny \
dplyr \
devtools \
rJava \
RJDBC
# copy the app to the image
RUN mkdir /root/CI
COPY . /root/CI
# Install CI
RUN install2.r --error remotes \
&& R -e "remotes::install_local('/root/CI')"
# Set host and port
RUN echo "options(shiny.port = 80, shiny.host = '0.0.0.0')" >> /usr/local/lib/R/Rprofile.site
EXPOSE 80
CMD ["R", "-e", "CI::launch_application()"]
这是我的 application.yml 文件
proxy:
title:
logo-url: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
admin-groups: scientists
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
authentication: simple
# Docker configuration
docker:
cert-path: /home/none
url: http://localhost:2375
port-range-start: 20000
specs:
- id: home
display-name: Customer Intelligence
description: Segment your customer
container-cmd: ["R", "-e", "CI::launch_application()"]
container-image: company/image
access-groups: scientist
logging:
file:
shinyproxy.log
当我启动 java shinyproxy.jar
并使用我公开的端口访问 url 时,我看到了一个登录掩码。
我使用简单身份验证登录(从 shinyproxy.log 成功登录)但既没有显示应用程序也没有显示应用程序列表。
当我在本地启动应用程序时一切正常。
谢谢
Dzimitry 是对的。这是一个打字错误:scientists over scientist.
在application.yml允许的用户组有一个错误(应该是scientists over scientist):
access-groups: scientists
我开发了一个闪亮的应用程序,我正在尝试使用 shinyproxy 进行首次轻量级部署。 所有安装似乎都很好。 我已经安装了 docker, java.
我认为构建一个包装应用程序和其他功能的包是个好主意。
所以我开发了一个包(CI),CI::launch_application
基本上是 shiny
包的 RunApp
功能的包装器。这是代码:
launch_application <- function(launch.browser = interactive(), ...) {
runApp(
appDir = system.file("app", package = "CI"),
launch.browser = launch.browser,
...
)
}
我用这个 Dockerfile
成功构建了 docker 镜像FROM rocker/r-base:latest
## Install required dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
## for R package 'curl'
libcurl4-gnutls-dev \
apt-utils \
## for R package 'xml2'
libxml2-dev \
## for R package 'openssl'
libssl-dev \
zlib1g-dev \
default-jdk \
default-jre \
&& apt-get clean \
&& R CMD javareconf \
&& rm -rf /var/lib/apt/lists/
## Install major fixed R dependencies
# - they will always be needed and we want them in a dedicated layer,
# as opposed to getting them dynamically via `remotes::install_local()`
RUN install2.r --error \
shiny \
dplyr \
devtools \
rJava \
RJDBC
# copy the app to the image
RUN mkdir /root/CI
COPY . /root/CI
# Install CI
RUN install2.r --error remotes \
&& R -e "remotes::install_local('/root/CI')"
# Set host and port
RUN echo "options(shiny.port = 80, shiny.host = '0.0.0.0')" >> /usr/local/lib/R/Rprofile.site
EXPOSE 80
CMD ["R", "-e", "CI::launch_application()"]
这是我的 application.yml 文件
proxy:
title:
logo-url: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
admin-groups: scientists
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
authentication: simple
# Docker configuration
docker:
cert-path: /home/none
url: http://localhost:2375
port-range-start: 20000
specs:
- id: home
display-name: Customer Intelligence
description: Segment your customer
container-cmd: ["R", "-e", "CI::launch_application()"]
container-image: company/image
access-groups: scientist
logging:
file:
shinyproxy.log
当我启动 java shinyproxy.jar
并使用我公开的端口访问 url 时,我看到了一个登录掩码。
我使用简单身份验证登录(从 shinyproxy.log 成功登录)但既没有显示应用程序也没有显示应用程序列表。
当我在本地启动应用程序时一切正常。
谢谢
Dzimitry 是对的。这是一个打字错误:scientists over scientist.
在application.yml允许的用户组有一个错误(应该是scientists over scientist):
access-groups: scientists