[英]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. 我想将具有Elixir后端的应用程序分发给最终用户,以便可以在自己的计算机上运行。 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. 假设将Elixir系统开发为适当的OTP应用程序,则可以使用exrm构建OTP版本,并将其分发给客户端。 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: 基本上,您需要将exrm作为依赖添加到
mix.exs
,然后:
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. 生成的发行版将位于项目根目录下的
rel/your_app_name
文件夹中。 It will also contain embedded Erlang runtime in erts-XY
subfolder. 它还将在
erts-XY
子文件夹中包含嵌入式Erlang运行时。 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). 这意味着您不需要在目标计算机上安装Erlang,但是需要在它的精确副本上构建发行版(OS版本和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. 如果删除
erts-XY
文件夹,则生成的发行版仍然可以使用,但是需要将Erlang安装在系统上并且在路径中可用。 This makes the release more cross-platform, but less self-contained. 这使发行版更具跨平台性,但自包含性较低。
Either way, you don't need to require Elixir on the target machine. 无论哪种方式,您都不需要在目标计算机上使用Elixir。 Necessary files will be included in the generated OTP release.
必要的文件将包含在生成的OTP版本中。
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. 最后说明:当前
exrm
在Windows上不起作用(但已完成一些工作以解决此问题),因此,如果这是您的目标操作系统,则需要寻找其他方式来生成发行版。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.