I have the following supervisor children:
[
%{
id: :ranch_sup,
start: {:ranch_sup, :start_link, []},
restart: :permanent,
shutdown: 5000,
type: :supervisor
},
:ranch.child_spec(Server, :ranch_tcp, [port: 6666], Server, [])
]
and in mix.exs
:
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
included_applications: [:ranch],
mod: {Server.Application, []}
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ranch, "~> 1.7", runtime: false}
]
end
The problem is that elixir makes :ranch
start its supervisor automatically, I guess … which causes
18:00:50.418 [info] Application server exited: Server.Application.start(:normal, []) returned an error: shutdown: failed to start child: :ranch_sup
** (EXIT) already started: #PID<0.895.0>
{"Kernel pid terminated",application_controller,"{application_start_failure,server,{{shutdown,{failed_to_start_child,ranch_sup,{already_started,<0.895.0>}}},{'Elixir.Server.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,server,{{shutdown,{failed_to_start_child,ranch_sup,{already_started,<0.895.0>}}},{'Elixir.Server.Application',start,
Crash dump is being written to: erl_crash.dump...done