I build now with distillery, but unfortunately I haven’t got it working yet:
Application my_app exited: exited in: MyApp.start(:normal, [])
** (EXIT) exited in: GenServer.call(Mix.State, {:get, {Map, :get, [:env, :dev]}}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with
the given name, possibly because its application isn't started
Kernel pid terminated (application_controller) ({application_start_failure,my_app,{bad_return,
{{'Elixir.MyApp',start,[normal,[]]},{'EXIT',{noproc,{'Elixir.GenServer',call,['Elixir.
{"Kernel pid terminated",application_controller,"{application_start_failuremy_app,{bad_return,
{{'Elixir.MyApp',start,[normal,[]]},{'EXIT',{noproc,{'Elixir.GenServer',call,['Elixir.Mix.State',{get,
{'Elixir.Map',get,[env,dev]}},5000]}}}}}}"}
I wonder why it wants to access dev
stuff even though I’m building with prod and have set MIX_ENV=prod
. I build my release with MIX_ENV=prod mix release --env=prod
and execute my application with the following commands:
/phoenix/bin/my_app migrate
trap 'exit' INT; exec /phoenix/bin/my_app foreground
Funnily, the migration step works like a charm, just the second crashes.
Thats my distillery config:
~w(rel plugins *.exs)
|> Path.join()
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))
use Mix.Releases.Config,
# This sets the default release built by `mix release`
default_release: :default,
# This sets the default environment used by `mix release`
default_environment: Mix.env()
environment :dev do
set dev_mode: true
set include_erts: false
set cookie: :"sfds"
end
environment :prod do
set config_providers: [
{Mix.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/etc/config.exs"]}
]
set overlays: [
{:copy, "rel/config/config.exs", "etc/config.exs"}
]
set include_erts: true
set include_src: false
set cookie: :"sdfsfd"
set vm_args: "rel/vm.args"
end
release :sports_connected do
set version: current_version(:sports_connected)
set applications: [
:runtime_tools
]
set commands: [
migrate: "rel/commands/migrate.sh"
]
end