Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Running Release Fails after "set include_erts: false" #25

Open
Faolain opened this issue Apr 8, 2017 · 14 comments
Open

Running Release Fails after "set include_erts: false" #25

Faolain opened this issue Apr 8, 2017 · 14 comments

Comments

@Faolain
Copy link

Faolain commented Apr 8, 2017

I followed the guide here at https://shovik.com/blog/8-deploying-phoenix-apps-with-docker and it was advised to not bundle the erts files, that is, set include_erts: false in the rel/config.exs. I was both able to run mix docker.build and mix docker.release but when it comes time to running the container it errors out stating

{"init terminating in do_boot",{load_failed,[file_io_server,heart,lists,error_handler,erl_eval,code_server,erl_lint,application_master,gen_server,kernel,file_server,application,filename,gen_event,gen,supervisor,code,ets,erl_parse,proc_lib,file,application_controller,error_logger]}}
init terminating in do_boot ()

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

Shutting down..
Node is not running!

If I then instead set to include erts to true
set include_erts: true

then it is able to run the container/initiate the phoenix server. If it helps at all I'm running this on OSX without any other changes to the standard included Dockerfile build and release files.

@tlvenn
Copy link
Contributor

tlvenn commented Apr 12, 2017

Seems related to this issue: bitwalker/distillery#20

It should be fixed with Distillery 1.3.3 which is used by the latest version of mix_docker

@tlvenn
Copy link
Contributor

tlvenn commented Apr 13, 2017

@Faolain can you tell us if you still have the issue with the latest version of mix_docker ?

@Faolain
Copy link
Author

Faolain commented Apr 14, 2017

Thanks for the fast response unfortunately although I updated there seems to be another issue before even being able to address the erts boolean. I'm not sure what has changed (is it the alpine image itself?) but now I am unable to even run mix docker.build at all even with set include_erts: false.

Step 10/12 : RUN mix do deps.get, deps.compile
 ---> Running in a6ec85f0ac7c
* Getting stripity_stripe (https://github.com/code-corps/stripity_stripe.git)
remote: Counting objects: 1873, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 1873 (delta 2), reused 0 (delta 0), pack-reused 1848
Receiving objects: 100% (1873/1873), 502.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1112/1112), done.

06:07:30.756 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.756 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.756 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.757 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.764 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.775 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.790 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.806 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.810 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.826 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

Failed to fetch record for 'mix_docker' from registry (using cache)

06:07:30.839 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.845 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}
Failed to fetch record for 'phoenix' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}
Failed to fetch record for 'postgrex' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}

06:07:30.854 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

Failed to fetch record for 'guardian' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}

06:07:30.874 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

Failed to fetch record for 'plug' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}

06:07:30.901 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

Failed to fetch record for 'cors_plug' from registry (using cache)

06:07:30.908 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}
Failed to fetch record for 'ecto' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}

06:07:30.912 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

Failed to fetch record for 'mochiweb_html' from registry (using cache)
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}
Failed to check for new Hex version

06:07:30.929 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired


06:07:30.932 [error] SSL: :certify: ssl_handshake.erl:1605:Fatal error: certificate expired

** (Mix) Unknown package mochiweb_html in lockfile
{:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:tls_alert, 'certificate expired'}}]}
The command '/bin/sh -c mix do deps.get, deps.compile' returned a non-zero code: 1
** (MatchError) no match of right hand side value: {%IO.Stream{device: :standard_io, line_or_bytes: :line, raw: false}, 1}
    lib/mix_docker.ex:179: MixDocker.system!/2
    lib/mix_docker.ex:20: MixDocker.build/1
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
    (elixir) lib/code.ex:363: Code.require_file/2

@teamon
Copy link
Contributor

teamon commented Apr 14, 2017

@Faolain This is definitely not a mix_docker issues - I just got the same SSL error in one project that is still using quite old version of mix_docker and custom Dockerfiles that hasn't been changes for a while.

I don't know yet what is causing this. I'll let you know as soon as I find anything.

@teamon
Copy link
Contributor

teamon commented Apr 14, 2017

In my case this was a clock sync issue:

Before fix

⌘ ~ λ date -u
Fri Apr 14 11:31:40 UTC 2017
⌘ ~ λ docker run --rm -it bitwalker/alpine-erlang:6.1 date -u
Thu Apr 13 20:37:38 UTC 2017

The fix - source

⌘ ~ λ docker run -it --rm --privileged --pid=host debian nsenter -t 1 -m -u -n -i date -u $(date -u +%m%d%H%M%Y)

After fix

⌘ ~ λ date -u
Fri Apr 14 11:48:37 UTC 2017
⌘ ~ λ docker run --rm -it bitwalker/alpine-erlang:6.1 date -u
Fri Apr 14 11:48:07 UTC 2017

@Faolain
Copy link
Author

Faolain commented Apr 14, 2017

Thanks so much @teamon that fixed the date/SSL issue. Strange how that suddenly came up.

@tlvenn Sigh :/ even with the most recent mix_docker update with distillery at 1.3.4 the following still occurs when setting set include_erts: false

 {"init terminating in do_boot",{load_failed,[ets,kernel,erl_parse,gen_event,code,code_server,lists,gen_server,file_server,supervisor,application,proc_lib,application_master,gen,file,heart,file_io_server,erl_eval,application_controller,error_handler,filename,error_logger,erl_lint]}}
init terminating in do_boot ()

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

@tlvenn
Copy link
Contributor

tlvenn commented Apr 19, 2017

Ya I have the same issue @Faolain

@Faolain
Copy link
Author

Faolain commented Apr 23, 2017

@tlvenn, @teamon 's suggestion worked for me! I would say try that.

Also on a sidenote @teamon beside the erts issue I tried commenting on your blog post for clustering but unfortunately Discus threw my comment into spam. I was wondering how you take care of migrations as I am trying to do so with RPC but currently I believe after changing my hostname using the vm.args...I am no longer able to RPC connect to my node and run my migration scripts. Is there a way to set the RPC to a particular destination or a better way to run migrations instead of calling a bash script in post_start with distillery? Since Mix is not available this was the only way I saw how.

https://gist.github.com/Faolain/9312eb507d19c6992d5055ab3296e677

@tlvenn
Copy link
Contributor

tlvenn commented Apr 24, 2017

@Faolain do you mean you solved the original issue with set include_erts: false ?

Running migration with distellery is actually easy, have a look at: https://hexdocs.pm/distillery/running-migrations.html#content

@Faolain
Copy link
Author

Faolain commented Apr 24, 2017

@tlvenn unfortunately no, only the clock sync issue teamon pointed out.

I was able to run the migration without having a cluster(changing the node name) but once I change the node away from whatever the default is(I'm assuming 127.0.0.1) the rpc call states that
Node is not running!

@tlvenn
Copy link
Contributor

tlvenn commented Apr 24, 2017

But what do you need RPC to run migrations ?

@Faolain
Copy link
Author

Faolain commented Apr 24, 2017

I assume it is using RPC in the background, in any case, running the bin/app migrate within my application returns

/opt/app $ bin/hello migrate
{"init terminating in do_boot",{undef,[{'Elixir.Release.Tasks',migrate,[],[]},{i
nit,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ()

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

so I'd love to know how @teamon ended up running migrations using a cluster

@tlvenn
Copy link
Contributor

tlvenn commented Apr 24, 2017

It works fine on my side but I had the above issue with set include_erts: false. As soon as I put it back to true, things started to work properly.

@mfcollins3
Copy link

I was trying this for the first time after reading this article. I had a similar error. Changing set include_erts: true in my config.exs file, it worked correctly as well. I generated the standard Dockerfiles using the mix docker.customize command.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants