Today I tried to make new release of a long time not touched Phoenix app which I needed to make adjustments to and couldn’t because after I issue the command:
mix edeliver build release
it gives me an error:
using mix to generate release
** (Mix) Could not invoke task "release": 3 errors found!
--verbose : Unknown option
--env : Unknown option
--name : Unknown option
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 1:
[ -f ~/.profile ] && source ~/.profile
set -e
cd /home/build/apps/jp/builds
if [ "mix" = "rebar" ]; then
echo "using rebar to generate release"
./rebar -f generate
elif [ "mix" = "relx" ]; then
echo "using relx to generate release"
./relx release
elif [ "mix" = "mix" ]; then
echo "using mix to generate release"
MIX_ENV="prod" LINK_SYS_CONFIG="" LINK_VM_ARGS="" APP="jp" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix release --verbose --env="prod" --name="jp"
fi
I changed nothing serious in the app, just a few tweaks in templates. It worked before with no problem.
What can I do with the problem? I’ve looked in the mix’s docs and release command options seem to be valid for current version of mix.
Distillery 2.0 can’t work with elixir 1.9+. Edeliver probably needs to get updated as well to be able with distillery 2.1 or newer/elixir 1.9 and newer.
Because Distillery used to have the command mix release but now that is builtin to Elixir. So it tries to call Elixir’s release task but give it the arguments that work for Distillery’s release task. So it complains about unknown options.
Distillery’s command is nowadays named mix distillery.release.
Ok, so I’ve updated edeliver and distillery and got another error:
-----> Generating release
using mix to generate release
==> Loading configuration..
** (Distillery.Releases.Config.LoadError) could not load release config rel/config.exs
** (CompileError) nofile:10: module Mix.Releases.Config is not loaded and could not be found
(elixir 1.10.2) expanding macro: Kernel.use/2
nofile:10: (file)
So yes, after upgrading distillery and edeliver and changing one line in rel/config.exs file from Mix.Releases.Config
to Distillery.Releases.Config
release was made and deployed.
The problem was that at some point I’ve upgraded elixir language to the latest version on my Ubuntu build server but it came with changes which touched the way distillery package works.