elixir - 如何在版本 (elixir/exrm) 上运行 'mix' 命令?

标签 elixir elixir-mix exrm

处理使用 Elixir/mix 构建的应用程序。

我们有一堆实用函数(即:seed/clear Mnesia db),我们以 elixir mix foo 运行它们。 .

一旦构建了一个版本(使用 mix + exrm)并部署在目标机器上(我们不希望有完整的构建链或完整的源代码),是否有一种实用的方法来访问这些命令?

最佳答案

请查看 https://github.com/bitwalker/exrm/issues/67#issuecomment-183457937

Now that #286 is fixed I would recommend the following approach, which is how we're doing it:

Build an escript which invokes the tasks you want available in the release (using an exrm plugin: https://gist.github.com/MSch/9cfc185e24e2f3509650) and invoke it from the release:

rel/pssync/bin/pssync escript bin/release_tasks.escript migrate This way we can control when and where to migrate, seed, etc.

There is some duplication/indirection since we want (most) of the tasks available both via mix in development and release_tasks.escript in production, but that is manageable. It also means we can migrate without fully starting our OTP application.

In an ideal future this would be upstreamed into exrm and more tightly integrated so that I can just do rel/pssync/bin/pssyc migrate but so far we've already had a great experience with our approach.

关于elixir - 如何在版本 (elixir/exrm) 上运行 'mix' 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36345776/

相关文章:

elixir - 何时在 Elixir 中使用仅编译依赖项

elixir - List.flatten 返回意外值

Elixir:如何从列表创建一对元素

phoenix-framework - Elixir/Phoenix 重定向到当前页面

elixir - 什么相当于 npm install --save in elixir mix with hex

elixir - 无法编译简单的 Elixir 项目

elixir - 无法部署在 "mix.exs"中具有 github 依赖项的网站

elixir - 在 exrm 版本中加载文件

hex - 如何获取每个环境的 Elixir 依赖项?

node.js - ** (CaseClauseError) 没有匹配 : :eacces - Building release with MIX_ENV=prod 的 case 子句