Creating elixir microkernel but failure running hello_phoenix

I am the author of Erlang microkernel (powered by rumprun unikernel) and building support for running elixir, so it will be an elixir microkernel. I have spent only a couple of hours looking at elixir, so a lot of what I am about to say may appear basic but need to get something working quick and need help. I am intentionally excluding the details of the build to avoid any unnecessary confusion, while trying to understand the error message. I am in the process of creating a github project which I will refer later tonight for anyone to go through (in case that is required).

Basically, I followed the tutorial to get phoenix working and got on to a stage of making a release, but running that directly with Erlang beam vm is a source of an issue at present. The following command line is eventually used while trying to start the elixir application (hello_phoenix), which is giving the error (at present) and I need help in deciphering the error message.

beam -- -no_epmd -root /opt/erlang/lib/erlang -boot_var ERTS_LIB_DIR /opt/erlang/lib/erlang/lib -progname erl -- -home /tmp -noshell -noinput -mode embedded

The start.boot is set such that it uses the hello_phoenix.boot script, so things are being started automatically which it fails as follows.

warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

16:16:45.392 [info]  Application hello_phoenix exited: HelloPhoenix.start(:normal, []) returned an error: shutdown: failed to start child: HelloPhoenix.Repo
    ** (EXIT) an exception was raised:
        ** (ArgumentError) configuration for HelloPhoenix.Repo not specified in :hello_phoenix environment
            (ecto) lib/ecto/repo/supervisor.ex:23: Ecto.Repo.Supervisor.config/3
            (ecto) lib/ecto/repo/supervisor.ex:9: Ecto.Repo.Supervisor.start_link/4
            (stdlib) supervisor.erl:358: :supervisor.do_start_child/2
            (stdlib) supervisor.erl:341: :supervisor.start_children/3
            (stdlib) supervisor.erl:307: :supervisor.init_children/2
            (stdlib) gen_server.erl:328: :gen_server.init_it/6
            (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,hello_phoenix,{{shutdown,{failed_to_start_child,'Elixir.HelloPhoenix.Repo',{'EXIT',{#{'__exception__' => true,'__struct__' => 'Elixir.ArgumentError',message => <<\"configuration for HelloPhoenix.Repo not specified in :hello_phoenix environment\">>},[{'Elixir.Ecto.Repo.Supervisor',config,3,[{file,\"lib/ecto/repo/supervisor.ex\"},{line,23}]},{'Elixir.Ecto.Repo.Supervisor',start_link,4,[{file,\"lib/ecto/repo/supervisor.ex\"},{line,9}]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,358}]},{supervisor,start_children,3,[{file,\"supervisor.erl\"},{line,341}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,307}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}},{'Elixir.HelloPhoenix',start,[normal,[]]}}}"}

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

That error means that the Database Repo configuration was not configured from within the environment you are currently running. Did you setup the Repo config? Are you running in the right environment? Or if you are using exrm or similar to make a release, did you specify the correct environment (prod usually for such a release) for it to generate out?

The Config files get compiled at compile-time, where the data is then hard-coded into the program as an actual module, basically it sounds like it is either missing that entirely or missing some information in the environment you selected.

I believe you are correct because I just ran the example without any database configuration. Having said that I am about to add a lot of stuff in the github project where the exact set of steps will become clear.
I did generate a release with ‘prod’ and used the hello_phoenix.tar.gz generated out of the following command

MIX_ENV=prod mix release

I will be posting the complete set of workflow on github shortly for a complete review.

1 Like

The configuration was not setup correctly and neighter was the database connection. Now things are working as expected.

1 Like