Hello all, I’m in the situation where I have to take my Phoenix app and generate a release that contains the app + a github private repository.
After asking for suggestions on Slack, I discovered distillery and I’m attempting to build my first release.
After installing it as a dependency I succeeded at generating a release, but when I try to start the app it crashes, and I have no idea what are the next steps I can do to debug it: the erl_crash.dump leaves me completely clueless
What I did is just “mix release” + “_build/dev/rel/owl/bin/owl console”, same computer, that’s it.
“mix phoenix.server” runs just fine.
Are there any logs? You may find them at
_build/dev/rel/owl/var/log. They would probably be a bit more helpful than the
Well not really, at least for me…
mix release is probably missing the enviroment setting.
MIX_ENV=prod mix release --env=prod might help
Are there any errors printed when you execute
Distillery is using
dev environment by default so that shouldn’t be an issue.
:mix to the list of applications in your mixfile. See https://github.com/bitwalker/distillery/issues/25 for more.
You should not add Mix to the list of your runtime applications. A lot of functions from Mix need a Mixfile (mix.exs) to be present in a directory. Many of them would probably crash when calling them in a release.
The problem you are facing may be related to the fact that you are compiling your project and generating a release in
dev environment. IIRC Phoenix project template enables live reloading by default in dev environment and your crash log confirms that. Try generating a release in a
prod environment, something like:
MIX_ENV=prod mix release [any other options you pass to distillery]
Your app crashes because your endpoint tries to enable live reloading (because it was compiled in
:phoenix_live_reload is not present in a
:application list (and it should not be, because it relies on Mix ).
Let me know if that works for you
I faced this problem before.
What @jur0 sugggests will fix this problem.
And you must set the option to start the phoenix server also when the release application start.
Just to be more “official” about this: the problem is that the code reloader is enabled in the environment you are building the release in. You can’t use the code reloader in a release because it relies on Mix, and you can’t bundle Mix in a release because it’s not intended for use outside of a standard MIx project structure. While you can bundle Mix into a release, doing so is unlikely to work for the vast majority of things you’ll want it for, so it’s better to assume you just can’t at all.