idi527
How to include ranch in a supervision tree
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
First Post!
idi527
So the question is, how do I include :ranch in a supervision tree, that is, include the application (so that it gets into a release) while not starting it?
Popular in Questions
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir
iex(2)...
New
Other popular topics
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New







