闪亮的服务器docker应用程序在本地运行,但在部署到AWS Fargate时不会运行

时间:2018-08-20 19:40:58

标签: r docker shiny-server aws-fargate

我有一个容器化的R闪亮应用程序,当与docker run --rm -p 3838:3838 [image]在本地运行时,可以正常运行。当我转到localhost:3838时,将显示“着陆”页面,一切都很好。但是,当将此容器部署到AWS Fargate时,情况就会恶化。该容器似乎已启动并运行,但是即使所有端口都指向Fargate中的38383838上也没有提供任何网页。

我正在使用dockerfile

FROM rocker/verse:3.5.1

LABEL Steven "email"

## Add shiny capabilities to container
RUN export ADD=shiny && bash /etc/cont-init.d/add

## Update and install 
RUN tlmgr update --self 
RUN tlmgr install beamer translator

## Add R packages
RUN R -e "install.packages(c('shiny', 'googleAuthR', 'dplyr', 'googleAnalyticsR', 'knitr', 'rmarkdown', 'jsonlite', 'scales', 'ggplot2', 'reshape2', 'Cairo', 'tinytex'), repos = 'https://cran.rstudio.com/')"

#Copy app dir and them dirs to their respective locations
COPY app /srv/shiny-server/ga-reporter
COPY app/report/themes/SwCustom /opt/TinyTeX/texmf-dist/tex/latex/beamer/

#Force texlive to find my custom beamer thems
RUN texhash

EXPOSE 3838

## Add shiny-server information
COPY shiny-server.sh /usr/bin/shiny-server.sh
COPY shiny-customized.config /etc/shiny-server/shiny-server.conf

## Add dos2unix to eliminate Win-style line-endings and run
RUN apt-get update && apt-get install -y dos2unix
RUN dos2unix /usr/bin/shiny-server.sh && apt-get --purge remove -y dos2unix && rm -rf /var/lib/apt/lists/*

RUN ["chmod", "+x", "/usr/bin/shiny-server.sh"]

CMD ["/usr/bin/shiny-server.sh"]

shiny-server.conf

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    app_dir /srv/shiny-server/ga-reporter;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

shiny-server.sh

#!/bin/sh

# ShinyServer: Make sure the directory for individual app logs exists
mkdir -p /var/log/shiny-server
chown -R shiny.shiny /var/log/shiny-server

# RUN ShinyServer
exec shiny-server >> /var/log/shiny-server.log 2>&1

我已经编辑了.conf文件以在location /中显示应用程序(即/srv/shiny-server/ga-reporter),这也是我在Dockerfile中复制了app_dir的地方。 Shiny正在端口3838上监听,应该在该页面上提供服务。同样,这在本地发生,但在部署到AWS Fargate时不会发生。我曾尝试使用the first answer provided here将Shiny日志记录到stdout,但没有运气看到任何错误。 Server "health checking" is only offered in the "pro" version so I can't check to see if the server is actually running.

在AWS上,容器启动并似乎正常运行(即,出现“正常”启动日志):

enter image description here

但是在我希望将其投放的位置上根本没有页面显示。

我找到了another Shiny app that is on dockerhub running under the same configuration as the Fargate cluster ,但是没有运气尝试在其中的shiny-server.confshiny-server.sh文件中实现任何东西。

我想念什么? Fargate上的所有内容都指向收听3838.conf文件中肯定缺少某些内容,导致部署失败。


编辑

我无法在Fargate上猛扑到正在运行的容器,因为我无权访问正在运行docker的服务器。

Fargate的UI可以接受主机端口和容器端口:

enter image description here


编辑2 (2018-08-27)

正在部署此功能的工程师能够解决此问题:

”是端口更改,我忘记了ALB安全组上的端口,我只更新了群集的入站规则

因此群集允许连接,但是ALB安全组没有允许连接“

0 个答案:

没有答案