简体   繁体   中英

Elixir source code in an application

I would like to distribute my application that has backend in Elixir to the end user, so it can be run on their own machines. Is there a way to do this so they do not have access to the original source code, but can send me crash reports I can analyze?

Assuming that Elixir system is developed as a proper OTP application, you could build an OTP release using exrm , and distribute it to clients. Release is stripped of all compile time constructs such as source code or tests.

Basically, you'd need to add exrm as a dependency in mix.exs and then:

mix deps.get
MIX_ENV=prod mix compile --no-debug-info
MIX_ENV=prod mix release

The generated release will reside in rel/your_app_name folder under your project root. It will also contain embedded Erlang runtime in erts-XY subfolder. This means that you don't need to have Erlang installed on the target machine, but you need to build a release on an exact copy of it (OS version & arch).

If you remove the erts-XY folder, the generated release will still work, but it will require that Erlang is installed on the system and available in path. This makes the release more cross-platform, but less self-contained.

Either way, you don't need to require Elixir on the target machine. Necessary files will be included in the generated OTP release.

Final note: currently exrm doesn't work on Windows (but some work is being done to fix this), so if that's your target OS, you'll need to look for other ways to generate a release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM