使用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: 07001) 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.