Shining server docker应用程序在本地运行,但部署到AWS Fargate时不运行
我有一个集装箱化的Shining server docker应用程序在本地运行,但部署到AWS Fargate时不运行,r,docker,shiny-server,aws-fargate,R,Docker,Shiny Server,Aws Fargate,我有一个集装箱化的R闪亮的应用程序,当在本地运行docker run--rm-p3838:3838[image]时,它可以按预期工作。当我转到localhost:3838时,会出现“登录”页面,一切正常。然而,当这个容器部署到AWS Fargate时,情况就不一样了。容器似乎已启动并运行,但3838上没有提供任何网页,即使Fargate中的所有端口都指向3838 我在用dockerfile FROM rocker/verse:3.5.1 LABEL Steven "email" ## Add
R
闪亮的应用程序,当在本地运行docker run--rm-p3838:3838[image]
时,它可以按预期工作。当我转到localhost:3838
时,会出现“登录”页面,一切正常。然而,当这个容器部署到AWS Fargate时,情况就不一样了。容器似乎已启动并运行,但3838
上没有提供任何网页,即使Fargate中的所有端口都指向3838
我在用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"]
和shinny 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;
}
}
使用shinny 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
文件以在/srv/shinny server/ga reporter
中显示应用程序(即位置/
),这也是我在Dockerfile中复制应用程序目录的地方。Shiny正在监听端口3838
,应该在那里提供页面。同样,这在本地发生,但部署到AWS Fargate时不会发生。我曾尝试使用将闪亮的日志记录到stdout
,但没有发现任何生成的错误
在AWS上,容器启动并显示正常运行(即显示“正常”启动日志):
但在我期望的位置上根本没有显示页面
我发现,但是在shinny server.conf
或位于那里的shinny server.sh
文件中,我没有实现任何东西
我错过了什么?Fargate上的所有内容都指向收听3838
;.conf
文件中一定有我缺少的东西,这样在部署时就会失败
编辑
我无法访问Fargate上正在运行的容器,因为我无法访问docker正在运行的服务器
Fargate有一个接受主机和容器端口的UI:
编辑2(2018-08-27)
部署此功能的工程师已能够解决此问题:
“这是端口更改,我忘了在ALB的安全组上打开端口,我只更新了集群的入站规则
因此,集群允许连接,但ALB安全组没有释放它“指向另一个闪亮应用程序的链接指向正在运行的闪亮服务器,而不是某个代码库。你在说什么文件?我对AWS Fargate一无所知。知道的人可能想知道,您是如何从docker命令行模拟-p 3838:3838
的,即您是如何将容器的3838端口发布为主机上的3838端口的。@RalfStubner表示歉意。我将链接更改为转到github页面。谢谢此外,Fargate还有一个用于编辑主机/容器端口的UI。我包括了端口的屏幕截图。但不确定这有多大帮助。任务ENI的安全组是什么样子的?显然,部署此应用程序的工程师发现了错误:“这是端口更改,我忘了在ALB的安全组上打开端口,我只更新了集群的入站规则。因此群集允许连接,但ALB安全组不允许”