Hi all.
I’m using Elixir/Phoenix v1.2.1.
Production Server is Ubuntu 16.04.2 LTS (AWS)
Test Server is Ubuntu 16.04.2 LTS (Azure)
DB Server is MySQL.
I created a task (priv/repo/reset_units.exs
) that is supposed to run a DB update on server startup. Its code is simple as follows:
alias Myserver.Repo
alias Myserver.MyUnit
Repo.update_all(MyUnit, set: [online: false])
I also changed the start/2 function of lib/Myserver.ex including this:
Mix.Tasks.Run.run(["priv/repo/reset_units.exs"])
Logger.info ("[INIT] DB table updated.")
It runs fine on test server, but when I build the release and try to start it on production I get the following exception
[info] Application myserver exited: exited in: myserver.start(:normal, [])
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Mix.Tasks.Run.run/1 is undefined (module Mix.Tasks.Run is not available)
Mix.Tasks.Run.run(["priv/repo/reset_units.exs"])
(myserver) lib/myserver.ex:29: myserver.start/2
(kernel) application_master.erl:273: :application_master.start_it_old/4
Does anybody had a similar issue?
Thanks!