HTTP 500将ElixirPhoenix部署到AWS Elastic Beanstalk

HTTP 500将ElixirPhoenix部署到AWS Elastic Beanstalk,第1张

概述HTTP 500将Elixir / Phoenix部署到AWS Elastic Beanstalk

我在configurationAWS / Elastic Beanstalk所需的elixir / phoenixconfiguration时遇到了问题。 (遵循在这里find的指南: https ://robots.thoughtbot.com/deploying-elixir-to-aws-elastic-beanstalk-with-docker – 我的Dockerfile除了更新的库看起来相似)。

我可以在eb local run ,但是在推进生产时遇到了麻烦。

但是,当我尝试部署到EB,我得到以下警告,并崩溃:

Environment health has Transitioned from Degraded to Severe. 100.0 % of the requests are failing with http 5xx. Command Failed on all instances. Incorrect application version found on all instances. Expected version "app-8412-171116_115503" (deployment 5). ELB processes are not healthy on all instances. 100.0 % of the requests to the ELB are erroring with http 4xx. InsufficIEnt request rate (0.5 requests/min) to determine application health (5 minutes ago). ELB health is failing or not available for all instances.

我想知道如果有人可以让我知道,如果我的configuration看起来是正确的。

如何设置PHP日志logging以转到远程服务器?

ELB和ApacheconfigurationhttpS网站

应用程序负载平衡器上的状态码460

100个docker集装箱与100个小型机器

如何configuration我的nodeJs应用程序只响应SSL连接?

我一直在尝试一些东西,但是我觉得我感到困惑,因为我只是在猜测这一点。

config.exs

use Mix.Config config :newsly,ecto_repos: [Newsly.Repo] config :logger,:console,format: "$time $Metadata[$level] $messagen",Metadata: [:request_ID] import_config "#{Mix.env}.exs"

prod.exs

use Mix.Config config :logger,format: "[$level] $messagen" config :phoenix,:stacktrace_depth,5 import_config "prod.secret.exs"

prod.secret.exs

use Mix.Config config :ex_aws,access_key_ID: System.get_env("AWS_ACCESS_KEY_ID"),secret_access_key: System.get_env("AWS_SECRET_ACCESS_KEY"),bucket_name: System.get_env("BUCKET_name"),s3: [ scheme: "https://",host: System.get_env("BUCKET_name"),region: "us-west-2" ] config :newsly,Newsly.Repo,adapter: Ecto.Adapters.Postgres,username: System.get_env("USERname"),password: System.get_env("PASSWORD"),database: System.get_env("DATABASE"),hostname: System.get_env("DBHOST"),# sometimes hostname is db (like in the docker-compose method - play with this one) pool_size: 10 config :newsly,Newsly.Endpoint,http: [port: 4000],deBUG_errors: true,code_reloader: false,url: [scheme: "http",host: System.get_env("HOST"),port: 4000],secret_key_base: System.get_env("SECRET_KEY_BASE"),pubsub: [adapter: Phoenix.PubSub.PG2,pool_size: 5,name: Newsly.PubSub],check_origin: false,watchers: [node: ["node_modules/brunch/bin/brunch","watch","--stdin",cd: Path.expand("../",__DIR__)]]

在我的Dockerfile中,我设置了如下的环境variables:

ENV AWS_ACCESS_KEY_ID=nottelling ENV AWS_SECRET_ACCESS_KEY=nottelling ENV BUCKET_name=s3 storage bucket (not eb related) ENV SECRET_KEY_BASE=nottelling ENV HOST=host name of my eb instance im uploading to ENV DBHOST=AWS rds host that holds postgres ENV USERname=nottelling ENV PASSWORD=nottelling

关于实例的我的健康报告未能显示以下警告:

Environment health has Transitioned from Warning to Severe. 100.0 % of the requests are failing with http 5xx. ELB processes are not healthy on all instances. ELB health is failing or not available for all instances.

Nginx似乎在窒息

2017/11/16 17:59:46 [error] 28815#0: *99 connect() Failed (113: No route to host) while connecting to upstream,clIEnt: 172.31.20.108,server:,request: "GET / http/1.1",upstream: "http://172.17.0.2:4000/",host: "172.31.38.244"

在Nginx日志中。

如果我看看我有的eb活动日志

duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11

这似乎是杀Nginx

[2017-11-16T18:02:33.927Z] INFO [29355] - [Application update app-8412-171116_115503@5/AppDeployStage1/AppDeployEnactHook/01flip.sh] : Completed activity. Result: Nginx: [warn] duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11 StopPing Nginx: [ OK ] Starting Nginx: Nginx: [warn] duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11 [ OK ] iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ] StopPing current app container: e0161742ee69... Error response from daemon: No such image: aws_beanstalk/current-app:latest Making STAGING app container current... Untagged: aws_beanstalk/staging-app:latest eb-docker start/running,process 1398 Docker container e25f2b562f4f is running aws_beanstalk/current-app.

有没有人有任何想法?

编辑:

挖掘我find的Nginx的日志

map $http_upgrade $connection_upgrade { default "upgrade"; "" ""; } server { Listen 80; gzip on; gzip_comp_level 4; gzip_types text/HTML text/plain text/CSS application/Json application/x-JavaScript text/xml application/xml application/xml+RSS text/JavaScript; if ($time_iso8601 ~ "^(d{4})-(d{2})-(d{2})T(d{2})") { set $year $1; set $month $2; set $day $3; set $hour $4; } access_log /var/log/Nginx/healthd/application.log.$year-$month-$day-$hour healthd; access_log /var/log/Nginx/access.log; location / { proxy_pass http://docker; proxy_http_version 1.1; proxy_set_header Connection $connection_upgrade; proxy_set_header Upgrade $http_upgrade; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }

所以,

duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11

似乎是指这一行:

gzip_types text/HTML text/plain text/CSS application/Json application/x-JavaScript text/xml application/xml application/xml+RSS text/JavaScript;

但在这一点上,我会发现,如果Nginx只是因为它定义了text/HTML两次而窒息,才会感到惊讶。 所以现在我不确定….

编辑编辑:我应该提到,我的Nginx / error.logs看起来像下面(最后一行重复ad-infinum):

2017/11/16 17:19:22 [warn] 18445#0: duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11 2017/11/16 17:19:22 [warn] 18460#0: duplicate MIME type "text/HTML" in /etc/Nginx/sites-enabled/elasticbeanstalk-Nginx-docker-proxy.conf:11 2017/11/16 17:20:06 [error] 18467#0: *11 connect() Failed (113: No route to host) while connecting to upstream,clIEnt: 172.31.32.139,host: "172.31.38.244" 2017/11/16 17:20:15 [error] 18467#0: *13 connect() Failed (113: No route to host) while connecting to upstream,host: "172.31.38.244" 2017/11/16 17:20:21 [error] 18467#0: *15 connect() Failed (113: No route to host) while connecting to upstream,host: "172.31.38.244" 2017/11/16 17:20:30 [error] 18467#0: *17 connect() Failed (113: No route to host) while connecting to upstream,upstream:

这是问题的核心

Nginx从根本上不能将入口点连接到应用程序,我不知道为什么!

更新:

使用凯文·约翰逊的build议,我成功地把我的Docker文件推到AWS ECR,并且当我用一个好的Dockerrun.aws.Json eb deploy '我的应用程序'时,编译正确。 这实际上是一个首选的方法来做到这一点。 不过 ,我仍然得到同样的错误! 我不知道发生了什么,但我想我可以放心地说,我的Dockerfile成功编译。

我认为在AWS中有些东西被破坏,我不知道是什么。

UPDATE

问题与Nginx路由问题有关。 在一个干净的问题中的更多信息: 如何修改Elastic Beanstalk AWS上的Nginx路由?

Nginx的:我怎样才能提供Nginxconfiguration的pathvariables?

如何使用Nginx在EC2上运行两个应用程序

Nginx代理服务器本地权限被拒绝

Python Django Gmail SMTP设置

使用云初始化用户数据

我高度怀疑你正在处理的问题是:

您的Dockerrun.aws.config文件指向ECS Repository上的不存在的泊坞窗图像。 这是由错误消息指出: Error response from daemon: No such image: aws_beanstalk/current-app:latest Making STAGING app container current...当EB无法用最新的配置替换实例,它将诉诸回到旧的,可能是AWS的Hello World应用程序,您可能已经利用它来设置EB。 该容器没有在端口4000上运行的Web服务,而您的Dockerrun.aws.config指定了端口4000.(我会感到惊讶的是,您的Dockerrun.aws.config不会被EB替换为以前的工作版本)因此,检查Dockerrun.aws.config并确保其中提到的图像端点确实存在。 尝试在本地拉,并相应地运行。 首先清理所有图像的本地环境,并在需要时运行Docker容器。

在Docker中运行的应用程序在启动时立即崩溃。 再一次,EB会检测到这个,并用先前的容器替换掉了崩溃的容器,而这个容器又没有打开端口4000 。

总结

以上是内存溢出为你收集整理的HTTP 500将Elixir / Phoenix部署到AWS Elastic Beanstalk全部内容,希望文章能够帮你解决HTTP 500将Elixir / Phoenix部署到AWS Elastic Beanstalk所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1269005.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存