timur
MyApp.Repo configuration not found in an exrm release migration task
I’m following the approach from this post to make my release_tasks module which is as follows:
defmodule :release_tasks do
def migrate do
{:ok, _} = Application.load(:myapp)
Enum.map(Application.spec(:myapp, :applications), &Application.load(&1))
Enum.map(Application.spec(:myapp, :applications), &Application.ensure_all_started(&1))
path = Application.app_dir(:myapp, "priv/repo/migrations")
Ecto.Migrator.run(MyApp.Repo, path, :up, all: true)
:init.stop()
end
end
When I try to run the task I get configuration for MyApp.Repo not specified in :myapp environment error which I’m having trouble to explain:
{"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.ArgumentError',message=><<"configuration for MyApp.Repo not specified in :myapp environment">>},[{'Elixir.Ecto.Repo.Supervisor',config,3,[{file,"lib/ecto/repo/supervisor.ex"},{line,23}]},{'Elixir.Ecto.Migration.SchemaMigration',get_source,1,[]},{'Elixir.Ecto.Migration.SchemaMigration',create_migrations_table,3,[{file,"lib/ecto/migration/schema_migration.ex"},{line,38}]},{'Elixir.Ecto.Migrator',migrated_versions,2,[{file,"lib/ecto/migrator.ex"},{line,43}]},{'Elixir.Ecto.Migrator',run,4,[{file,"lib/ecto/migrator.ex"},{line,142}]},{release_tasks,migrate,0,[{file,"lib/release_tasks.ex"},{line,9}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
In release sys.config Elixir.MyApp.Repo is present under myapp.
What’s happening?
Any ideas appreciated!
Most Liked
benwilson512
Author of Craft GraphQL APIs in Elixir with Absinthe
Why aren’t you using {:ok, _} = Application.ensure_all_started(:my_app) like in the example you linked?
2
timur
@ASCrookes I ended up w/ the following task code:
defmodule Release.Tasks do
def migrate do
:ok = Application.load(:myapp)
Enum.each [:ecto, :postgrex, :logger], fn(app) ->
{:ok, _} = Application.ensure_all_started(app)
end
MyApp.Repo.start_link
path = Application.app_dir(:myapp, "priv/repo/migrations")
Ecto.Migrator.run(MyApp.Repo, path, :up, all: true)
:init.stop()
end
end
It works. Not sure if using Elixir module instead of Erlang one matters in my case (Elixir 1.3.2, Erlang 18.3)
2
Popular in Questions
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Other popular topics
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









