Reputation: 797
I've made a release of my elixir application.
It starts to run a supervised task using DB when the app is lunched.
When the DB is not migrated, the task keep error and app is terminated.
I read http://blog.firstiwaslike.com/elixir-deployments-with-distillery-running-ecto-migrations/, https://hexdocs.pm/distillery/running-migrations.html, and tried to implement migration function following them, but failed because the app needs to be started to load config of the app and it make the command terminated.
When I run Application.get_all_env(:my_app)
without start my app, it returns empty list []
.
Is there anyway to run Ecto.Migrator.run(MyApp.Repo, path, :up, all: true)
without start the app?
Upvotes: 2
Views: 577
Reputation: 11278
It is enough to load the application with Application.load(:my_app)
to have access to the env - it doesn't need to be started.
A detailed guide on running migrations with releases is available in the distillery documentation.
Upvotes: 3