Closed bjuretic closed 5 years ago
@bjuretic this might be related to #568
I'm also having the same issue. Notice that configuration are correctly loaded if I run, for example, the remote_console
command or when starting the app (for example, with the foreground
command).
@bugant have you ever had issues with the start
command?
@imranismail never tried start
, I always start the app with foreground
, will give it a try as soon as I can.
Just to be clear, configuration is only loaded in custom commands if the release has already been started (or at least run) and the sys.config
file has been generated. If you need to generate the configs without starting the release for your custom command, then you will want to invoke the configure_release
function from your command before doing anything else, this will ensure those configs are generated and that the env vars are set so that any subsequent commands will pick up those configs.
@bitwalker this is not clear to me. I'm following this guide https://hexdocs.pm/distillery/guides/running_migrations.html but still have the same error:
Starting repos..
** (EXIT from #PID<0.92.0>) an exception was raised:
** (ArgumentError) configuration for MyApp.Repo not specified in :my_app environment
(ecto) lib/ecto/repo/supervisor.ex:32: Ecto.Repo.Supervisor.runtime_config/4
(ecto) lib/ecto/repo/supervisor.ex:153: Ecto.Repo.Supervisor.init/1
(stdlib) supervisor.erl:295: :supervisor.init/1
(stdlib) gen_server.erl:374: :gen_server.init_it/2
(stdlib) gen_server.erl:342: :gen_server.init_it/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
@bitwalker this is not clear to me. I'm following this guide https://hexdocs.pm/distillery/guides/running_migrations.html but still have the same error:
Starting repos.. ** (EXIT from #PID<0.92.0>) an exception was raised: ** (ArgumentError) configuration for MyApp.Repo not specified in :my_app environment (ecto) lib/ecto/repo/supervisor.ex:32: Ecto.Repo.Supervisor.runtime_config/4 (ecto) lib/ecto/repo/supervisor.ex:153: Ecto.Repo.Supervisor.init/1 (stdlib) supervisor.erl:295: :supervisor.init/1 (stdlib) gen_server.erl:374: :gen_server.init_it/2 (stdlib) gen_server.erl:342: :gen_server.init_it/6 (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Did you find a way around this issue?
Release config is pretty typical:
and environment :prod has
include_erts: false
(also tried with :dev environment - same issue).When include_erts is :true, configuration is available in custom command:
When I run a custom command:
But when ERTS is not included (and the release is run locally - so the same ERTS version used to compile it), this happens:
... so no config is loaded.
I've checked, the config.exs is indeed present in etc/config.exs and all seems to be in order on that level.
BTW I have to say you are doing a heroic work on the whole release story for Elixir. The problem is Erlang VM was never made for what we are using it. It requires a big overhaul internally, then you wouldn't need to solve a million of small problems.