lpvm

lpvm

Init terminating in do_boot - distillery migrations

I’m trying to have migrations automatically configured to be setup in the build and production servers as mentioned in Running Migrations, etc. – distillery v1.5.2
The module, the command and the configuration were done.

In the build server, after successful build, when tried to run bin/myapp migrate it failed.
Read this topic made the change me = :orif in the above mentioned module, as suggested but it is not possible to migrate.
The error is:

{"init terminating in do_boot",{{badmatch,{error,{already_loaded,orif}}},[{'Elixir.Orif.ReleaseTasks',seed,0,[{file,"lib/orif/release_tasks.ex"},{line,20}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}                                                                        
init terminating in do_boot ()
Crash dump is being written to: erl_crash.dump...done

Read elsewhere that this could happen because of different versions of elixir and erlang.
In fact, my development is done in Linux with:


Elixir 1.7.3 (compiled with Erlang/OTP 21)

and my build box is FreeBSD running:

Elixir 1.7.3 (compiled with Erlang/OTP 19)

Installed the erlang-runtime21: 21.1 package, modified the PATH to have access to the new installed runtime:

Elixir 1.7.3 (compiled with Erlang/OTP 19)

and

Eshell V10.1  (abort with ^G)
"21"

But the same error is daunting me.

What to do to solve this issue?

First Post!

NobbZ

NobbZ

The OTP version doesn’t seem to be an issue according to the error message, for me it seems as if you were starting your application twice when it should be started only once.

As I’m not using distillery, I can’t give you much more hints, but you probably need to reveal a bit of your distillery config/scripts.

Last Post!

pierreabreup

pierreabreup

You dont need to run bin/orif/ foregound or bin/orif start. You only need run your task. In my case, I have this task

defmodule ContentProxy.ReleaseTasks do
  @otp_app :content_proxy

  defp init(app) do
    IO.puts "Starting dependencies.."
    {:ok, _} = Application.ensure_all_started(app)
  end

  def seed do
    init(@otp_app)

    seed_data = seed_file_path(@otp_app)
      |> File.read!()
      |> Jason.decode!()

    Enum.each seed_data, fn(content) ->
      ContentProxy.Resources.create_content(content)
      IO.puts("DOCUMENT #{content["name"]} INSERTED")
    end

    stop()
  end

  defp seed_file_path(app),
    do: priv_dir(app, ["seed_data", "contents.json"])

  defp priv_dir(app, path) when is_list(path) do
    case :code.priv_dir(app) do
      priv_path when is_list(priv_path) or is_binary(priv_path) ->
        Path.join([priv_path] ++ path)

      {:error, :bad_name} ->
        raise ArgumentError, "unknown application: #{inspect app}"
    end
  end

  defp stop do
    IO.puts "Success!"
    :init.stop()
  end

end

inside of the terminal session, I run my task typing _build/prod/rel/content_proxy/bin/content_proxy command "Elixir.ContentProxy.ReleaseTasks" seed and its works like a charm!

It is worth noting {:ok, _} = Application.ensure_all_started(app) already start to you all children process that you’ve configured in application.ex

I’ve notice that if I run the app with start or foreground before run command, when I run command "Elixir.ContentProxy.ReleaseTasks" seed I get the following error:

22:01:18.737 [error] Failed to start Ranch listener ContentProxyWeb.Endpoint.HTTP in :ranch_tcp:listen([{:cacerts, :...}, {:key, :...}, {:cert, :...}, :inet6, {:port, 4000}]) for reason :eaddrinuse (address already in use)

22:01:18.759 [info] Application content_proxy exited: ContentProxy.Application.start(:normal, []) returned an error: shutdown: failed to start child: ContentProxyWeb.Endpoint
    ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, ContentProxyWeb.Endpoint.HTTP}
        ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup
            ** (EXIT) {:listen_error, ContentProxyWeb.Endpoint.HTTP, :eaddrinuse}
22:01:18.762 [info] Application mongodb exited: :stopped
22:01:18.772 [info] Application db_connection exited: :stopped
22:01:18.772 [info] Application connection exited: :stopped
22:01:18.773 [info] Application gettext exited: :stopped
22:01:18.773 [info] Application poolboy exited: :stopped
22:01:18.773 [info] Application absinthe_relay exited: :stopped
22:01:18.773 [info] Application jason exited: :stopped
22:01:18.774 [info] Application atomic_map exited: :stopped
22:01:18.774 [info] Application absinthe_plug exited: :stopped
22:01:18.774 [info] Application absinthe exited: :stopped
22:01:18.774 [info] Application phoenix exited: :stopped
22:01:18.775 [info] Application eex exited: :stopped
22:01:18.775 [info] Application phoenix_pubsub exited: :stopped
22:01:18.775 [info] Application distillery exited: :stopped
22:01:18.776 [info] Application runtime_tools exited: :stopped
22:01:18.776 [info] Application artificery exited: :stopped
22:01:18.777 [info] Application plug_cowboy exited: :stopped
22:01:18.777 [info] Application cowboy exited: :stopped
22:01:18.777 [info] Application cowlib exited: :stopped
22:01:18.778 [info] Application ranch exited: :stopped
22:01:18.778 [info] Application ssl exited: :stopped
22:01:18.778 [info] Application public_key exited: :stopped
22:01:18.779 [info] Application asn1 exited: :stopped
22:01:18.779 [info] Application phoenix_ecto exited: :stopped
22:01:18.779 [info] Application plug exited: :stopped
22:01:18.780 [info] Application mime exited: :stopped
22:01:18.780 [info] Application plug_crypto exited: :stopped
22:01:18.780 [info] Application ecto exited: :stopped
=INFO REPORT==== 27-Jan-2019::22:01:18.817574 ===
    application: logger
    exited: stopped
    type: temporary
{"init terminating in do_boot",{{badmatch,{error,{content_proxy,{{shutdown,{failed_to_start_child,'Elixir.ContentProxyWeb.Endpoint',{shutdown,{failed_to_start_child,{ranch_listener_sup,'Elixir.ContentProxyWeb.Endpoint.HTTP'},{shutdown,{failed_to_start_child,ranch_acceptors_sup,{listen_error,'Elixir.ContentProxyWeb.Endpoint.HTTP',eaddrinuse}}}}}}},{'Elixir.ContentProxy.Application',start,[normal,[]]}}}}},[{'Elixir.ContentProxy.ReleaseTasks',init,1,[{file,"lib/content_proxy/release_tasks.ex"},{line,7}]},{'Elixir.ContentProxy.ReleaseTasks',seed,0,[{file,"lib/content_proxy/release_tasks.ex"},{line,16}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({{badmatch,{error,{content_proxy,{_}}}},[{Elixir.ContentProxy.ReleaseTasks,init,1,[{_},{_}]},{Elixir.ContentProxy.ReleaseTasks,seed,0,[{_},{_}]},{init,start_em,1,[]},{init

Crash dump is being written to: erl_crash.dump...done

Where Next?

Popular in Questions Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
axelson
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...
239 49266 226
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement