How to make a release for a system with erlang installed


I am a bit confused with the release process with mix.
I want to deploy my release on a server with erlang installed, but when I run MIX_ENV=prod mix release I don’t know what files I should take, how to send it to my server. I love that it comes with all batteries included (start, stop, daemon etc…) but it seems to also package erlang with it. I don’t need to package erlang with it.

I build on a Mac system but I want to run it on a Linux one.

My dream is a zip/tgz file that I can unzip on my server, run a start command and just works with my installed erlang unix binary, since beam files do not depend on the undelying system.

Any idea ?

I also have elixir on my server but running beam files should not need elixir to be present

Have you checked out this one:

:include_erts - a boolean, string, or anonymous function of arity zero. If a boolean, it indicates whether the Erlang Runtime System (ERTS), which includes the Erlang VM, should be included in the release. The default is true , which is also the recommended value. If a string, it represents the path to an existing ERTS installation. If an anonymous function of arity zero, it’s a function that returns any of the above (boolean or string).

The official documentation is here

Thanks for your input.

I tried to point it to an ERTS installation with the target unix path (different from mine on mac) and I got an error:

** (Mix) Could not find ERTS system at "/usr/bin/erl"

Okay, I’ll let the magic of the PATH happen : use false instead.

When I run start on my server (I scp-ed the whole prod dir to my server) I have a crash dump:

$ rel/xxx/bin/xxx start
{"init terminating in do_boot",{load_failed,[code_server,logger_server,logger_backend,logger_filters,logger,kernel,heart,gen_server,gen_event,gen,file_io_server,file,file_server,filename,erl_eval,ets,error_logger,erl_parse,erl_lint,code,application_master,application_controller,application,error_handler,supervisor,proc_lib,lists,logger_config,logger_simple_h]}}
init terminating in do_boot ({load_failed,[code_server,logger_server,logger_backend,logger_filters,logger,kernel,heart,gen_server,gen_event,gen,file_io_server,file,file_server,filename,erl_eval,ets,er

Crash dump is being written to: erl_crash.dump...done

I am more and more puzzled

sadly the documentation says I have to compile on my target:

Currently, there is no official way to cross-compile a release from one target triple to another, due to the complexities involved in the process.

Glad, you found it!