Phoenix在Heroku上:错误R10 [英] Phoenix on Heroku: error R10

查看:90
本文介绍了Phoenix在Heroku上:错误R10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku上的Phoenix遇到了一个奇怪的错误,似乎无法正确绑定到端口.

Running into an odd error with Phoenix on Heroku, where it doesn't seem to bind to the port properly.

遇到凤凰未绑定到$ PORT的情况. Heroku的日志:

Running into a situation where phoenix is not binding to $PORT. Heroku's log:

2016-03-25T22:22:54.716907 + 00:00 heroku [web.1]:状态从崩溃更改为开始

2016-03-25T22:22:54.716907+00:00 heroku[web.1]: State changed from crashed to starting

2016-03-25T22:23:03.156662 + 00:00 heroku [web.1]:使用命令mix phoenix.server

2016-03-25T22:23:03.156662+00:00 heroku[web.1]: Starting process with command mix phoenix.server

2016-03-25T22:23:07.985368 + 00:00 app [web.1]:[info]使用牛仔在端口4000上运行带有牛仔的AppName.Endpoint

2016-03-25T22:23:07.985368+00:00 app[web.1]: [info] Running AppName.Endpoint with Cowboy using http on port 4000

2016-03-25T22:23:10.027386 + 00:00 app [web.1]:25 Mar 22:23:10-信息:将5个文件编译为2个文件,在1.5秒内复制3个

2016-03-25T22:23:10.027386+00:00 app[web.1]: 25 Mar 22:23:10 - info: compiled 5 files into 2 files, copied 3 in 1.5 sec

2016-03-25T22:24:03.442109 + 00:00 heroku [web.1]:错误R10(启动超时)-> Web进程在启动后60秒内未能绑定到$ PORT

2016-03-25T22:24:03.442109+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2016-03-25T22:24:03.442109 + 00:00 heroku [web.1]:使用SIGKILL停止进程

2016-03-25T22:24:03.442109+00:00 heroku[web.1]: Stopping process with SIGKILL

2016-03-25T22:24:04.195291 + 00:00 heroku [web.1]:进程退出,状态为137

2016-03-25T22:24:04.195291+00:00 heroku[web.1]: Process exited with status 137

2016-03-25T22:24:04.211713 + 00:00 heroku [web.1]:状态从开始更改为崩溃

2016-03-25T22:24:04.211713+00:00 heroku[web.1]: State changed from starting to crashed

我的prod.exs:

My prod.exs:

config :appname, AppName.Endpoint,
  http: [port: {:system, "PORT"}],
  url: [scheme: "https", host: "AppName.herokuapp.com", port: 443],
  force_ssl: [rewrite_on: [:x_forwarded_proto]],
  cache_static_manifest: "priv/static/manifest.json",
  secret_key_base: System.get_env("SECRET_KEY_BASE")

看来它将连接到端口4000,而不是Heroku想要的任何端口,我不确定为什么.

It looks like it's going to port 4000 instead of whatever port Heroku wants, and I'm not sure why.

推荐答案

修复方法有两个:

  1. 使用phoenix buildpack配置并导出PORT,如下所示:config_vars_to_export=(DATABASE_URL PORT)
  2. 避免更改MIX_ENV而不重新编译应用程序,因为该行为不受支持,如此处.
  1. to use the phoenix buildpack config and export the PORT as well, like so: config_vars_to_export=(DATABASE_URL PORT)
  2. Avoid changing the MIX_ENV without recompiling the app, as that behavior is unsupported, as explained here.

这篇关于Phoenix在Heroku上:错误R10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆