Mix tasks in an OTP release
Pleroma is almost ready from being OTP release ready. The remaining issue is the mix tasks. Mix is a dev tool, and it's not present in an OTP releases.
Instead, we can run mfa RPC calls into the running app node: we just have to change the existing tasks to not use any of the Mix functions at runtime (Mix.shell
, …) while still respecting the Mix.Task
contract (keep the use Mix.Task
), so we'll just execute them with an array of arguments that has been passed to a custom command shell script with (release_remote_ctl()
).
An exception is the migrations: it would need to be outside of a running node (because before running the migrations you'll have to restart the node to get the new code; and the new code may/will crash because it misses the migrations) with release_ctl()
. We can also envisage to just run them automatically in Pleroma.Application.start/2
.
(note: Mix.Task.run("app.start")
should be remplaced with Application.ensure_all_started(:pleroma)
).
(depends on !568 (closed) to properly test with a release built by distillery.)