Running phoenix apps directly from ErlangVM?

I have a webserver that have erlang but no elixir (so no mix) and I want to use for some testing of phoenix web project.

Since elixir share the same erlang VM in theory if project is compiled in another machine it might run by invoking erlang directly, but how can “mix phx.server” be replaced by corresponding erlangVM shell command?


If the app has been built with the mix release command then it can be ran like any command on the terminal e.g. your_app start (and other verbs, check the docs on Elixir releases). You can also start an iex session.


Thanks for your reply!

I’ve tested doing the release, however I found a problem:

When releasing, a copy of erts binaries are bundled and used. While this is ok in most situations, if you copy data to another machine not binary compatible (or with different libraries, for example, no systemd in target) beam will refuse to work.

Is there a way to use native erts binaries and beam VM from target machine instead of the bundled copy?

I’ve tried to edit the script which runs to point to new binaries but that attempt failed.

1 Like

You can build a release without erts bundled, which will then try to use one installed on the system you run the release on.

You can also pull erts from a separate system and tell the release to bundle that instead of one build on the current host.

1 Like

while BEAM byte code are portable, the BIF/NIF may not. so I strongly suggest you to make your releasing environment exactly the same as your deployment environment. With various container technology, this has become trivial.