Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do pass custom erl options for a Phoenix app?

My Phoenix app is hitting the Erlang VM's max process limit, what is the best way to specify custom options for erl (like +P) for a specific Phoenix app (or even better, only for MIX_ENV=PROD)? Is there a way to do this via the app's configuration files? Or if not, maybe when I run "mix phoenix.server"?

like image 830
jd20 Avatar asked Mar 26 '16 06:03

jd20


1 Answers

You can use elixir to run the application with the --erl flag:

elixir --erl "+P 10000000" -S mix phoenix.server

If you want a shell you can use iex instead:

iex --erl "+P 10000000" -S mix phoenix.server

Here is a copy of the usage for the elixir command.

Usage: elixir [options] [.exs file] [data]

-v Prints version and exits
-e "command" Evaluates the given command ()
-r "file" Requires the given files/patterns (
)
-S "script"   Finds and executes the given script
-pr "file" Requires the given files/patterns in parallel ()
-pa "path" Prepends the given path to Erlang code path (
)
-pz "path" Appends the given path to Erlang code path ()
--app "app" Start the given app and its dependencies (
)
--erl "switches" Switches to be passed down to Erlang (*)
--name "name" Makes and assigns a name to the distributed node
--sname "name" Makes and assigns a short name to the distributed node
--cookie "cookie" Sets a cookie for this distributed node
--hidden Makes a hidden node
--detached Starts the Erlang VM detached from console
--werl Uses Erlang's Windows shell GUI (Windows only)
--no-halt Does not halt the Erlang VM after execution

** Options marked with (*) can be given more than once
** Options given after the .exs file or -- are passed down to the executed code
** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS or --erl

If you are using exrm then you can also provide this in the vm.args file https://hexdocs.pm/exrm/release-configuration.html

like image 125
Gazler Avatar answered Dec 13 '22 18:12

Gazler