我已经使用命令创建了构建MIX_ENV=prod mix release --env=prod --verbose
。它成功创建了构建,我可以运行console
andping
命令并给我pid
. 即使我运行 start 命令,它也成功启动,但是当我转到 时htttp://localhost:4000
,服务器没有运行。当我运行_build/prod/rel/project/bin/project foreground
命令时,它只是挂在那里没有输出。
我正在使用 MacOS 版本:10.13.2,elixir:1.6.5(使用 OTP 19 编译),otp:Erlang/OTP 20。这是日志
$ MIX_ENV=prod mix release --env=prod --verbose
Generated project app
==> Loading configuration..
==> Assembling release..
==> Building release project:0.0.1 using environment prod
==> One or more direct or transitive dependencies are missing from
:applications or :included_applications, they will not be included
in the release:
:jsx
This can cause your application to fail at runtime. If you are sure that this is not an issue, you may ignore this warning.
==> Release successfully built!
You can run it in one of the following ways:
Interactive: _build/prod/rel/project/bin/project console
Foreground: _build/prod/rel/project/bin/project foreground
Daemon: _build/prod/rel/project/bin/project start
我已经包含了所有显示为警告的应用程序,除了jsx
因为它显示未定义应用程序的错误。
我还经历了酿酒厂问题https://github.com/bitwalker/distillery/issues/276并且因为这个问题表明我检查了我的应用程序名称并且服务器在配置文件中设置为 true,所以它没有帮助。我还在这里更详细地记录了问题https://github.com/bitwalker/distillery/issues/433。
这是我的发布文件配置
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"lfHBC,7lDxe6kbZJ%M.x4=r!>[F*DhL)ly`?d$>%iE=9y)V4_Oulis?4Rvm)~!55"
end
# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default
release :project do
set version: current_version(:project)
set applications: [
:runtime_tools
]
end
当我尝试创建一个新的 phoenix 应用程序并执行相同操作时,它正常运行并侦听端口 4000 并输出前台命令,但在我的应用程序中使用相同的配置,它不侦听 4000 端口并挂起前台命令。当我看到netstat
两者时,我的应用程序似乎没有运行 4000 端口,请参阅
我不知道我应该如何调试这个问题我尝试了所有我能做的事情。如果有人需要更多信息,请告诉我。我将不胜感激这方面的任何帮助/建议。
编辑: 这是我的配置和产品文件。我刚刚粘贴了端点详细信息,让我知道是否还有其他需要。
# config.exs
config :project, Project.Endpoint,
url: [host: "localhost"],
secret_key_base: some_secret_key,
render_errors: [view: Project.ErrorView, accepts: ~w(html json)],
check_origin: false,
pubsub: [name: Project.PubSub, adapter: Phoenix.PubSub.PG2]
# prod.exs
config :project, Project.Endpoint,
http: [port: 4000],
url: [scheme: "https", host: "server.example.com", port: 443],
server: true,
code_reloader: false