Minex allows you to create your own re-usable deployment tasks to setup deployment to your own needs. I created it to replace bash script with something more configurable/re-usable. It contains helpers to run commands locally and remotely (on the target specified by :host). It doesn’t contain specific deployment strategies, except for the example deploy tasks.
It’s possible to generate a bash script for enabled tasks (by passing a [generate_script: true] as options or using generate_script_task(...). This is useful for when you need a full shell/tty. For example when starting a remote console session)
I would use similar approach to the ExUnit for Minex.run(). So you would do System.at_exit(fn -> Minex.run(System.argv()) end) in Minex.__using__/1 so the user would not need to remember to run it on their own (probably add a flag that would allow disabling such behaviour).
I’ve considered the at_exit but this seems more flexible. You can for example extract a target (staging/production) out of System.argv() and pass the rest to Minex.run.
I did create a mix task to help run tasks: mix minex task_name. Is that what you mean?
I have something similar that I use internally (it’s like an elixir-ish ansible): it’s like ansible and minex in that it can either issue locally via cmd or via ssh. I’ve been thinking about open sourcing it, but am slightly afraid in that people might make fun of me for reimplementing ansible (with less yaml, things are more obviously functions, you can IO.inspect everywhere, etc etc etc). Is that something y’all might use if I open sourced it or if we joined forces?
Why not both? By default you could do the at_exit (so people do not have to remember), and provide an option for the use which switches that off, when the user desires to do so.
defmodule Minex do
defmacro __using__(opts) do
autorun = Keyword.get(opts, :autorun, true)
quote do
if unquote(autorun), do: System.at_exit(fn -> unquote(__MODULE__).run(System.argv())) end)
end
end
end