I am trying to create a release of a stock Phoenix
application (based on Elixir and Erlang) using exrm
.
The first release for the dev
mix environment is created fine, but crashes when run using ./rel/my_app/bin/my_app console
. This happens running Ubuntu 14.04 inside a Vagrant/Virtual Box virtual machine.
On my Mac, the same setup runs fine. Unfortunately, I need to build the release on a machine with the same architecture as the target server, which will run Ubuntu.
You can find the application here: https://github.com/mavenastic/my_app. It includes the steps taken to install dependencies and create the project on the VM (see STEPS.md
) as well as a Erlang crash dump.
Here is the error I get from attempting to run the console:
{"Kernel pid terminated",application_controller,"{application_start_failure,my_app,{{shutdown,{failed_to_start_child,'Elixir.MyApp.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.CodeReloader.Server',{undef,[{'Elixir.Mix.Project',config,[],[]},{'Elixir.Phoenix.CodeReloader.Server',init,1,[{file,\"lib/phoenix/code_reloader/server.ex\"},{line,29}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}}},{'Elixir.MyApp',start,[normal,[]]}}}"}
EDIT:
I tried to create a release for the production environment as well with MIX_ENV=prod mix release
. The release is successfully generated and MIX_ENV=prod PORT=8889 ./rel/my_app/bin/my_app console
runs fine. However, I cannot ping the server nor run a remote console once it starts, so it seems something is still missing for the application to run properly.
$ MIX_ENV=prod PORT=8889 ./rel/my_app/bin/my_app start
$ MIX_ENV=prod PORT=8889 ./rel/my_app/bin/my_app ping
=INFO REPORT==== 24-Oct-2015::10:28:25 ===
Protocol: "inet_tcp": register/listen error: econnrefused
escript: exception error: no match of right hand side value
{error,
{{shutdown,
{failed_to_start_child,net_kernel,
{'EXIT',nodistribution}}},
{child,undefined,net_sup_dynamic,
{erl_distribution,start_link,
[['[email protected]',longnames]]},
permanent,1000,supervisor,
[erl_distribution]}}}
$ ps aux | grep my_app
vagrant 2572 0.0 0.0 7532 96 ? S 10:28 0:00 /vagrant/my_app/rel/my_app/erts-7.1/bin/epmd -daemon
vagrant 2575 0.0 0.2 9448 2256 pts/0 S+ 10:28 0:00 grep --color=auto my_app
$ MIX_ENV=prod PORT=8889 ./rel/my_app/bin/my_app remote_console
$
Also, from what I gathered, I should be able to create a release for the dev
or any other environment as well. So the missing piece might affect both environments.
Thanks in advance!
To me it looks like the problem is that you're creating the release in your dev
environment (instead of the prod
env).
This part:
{undef,[{'Elixir.Mix.Project',config,[],[]}
of the (terribly and awesomely à la Erlang) error message basically says that Mix.Project.config/0
is undefined. Mix is not included in releases but I'm guessing Phoenix uses it in its code reloader, which you usually don't run in production.
Try generating the release with MIX_ENV=prod
and see if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With