Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom tasks fail with Erlang/OTP 21 (nonexistent no_dot_erlang.boot file) #426

Closed
amalbuquerque opened this issue Jun 21, 2018 · 11 comments
Assignees
Labels
bug:compatibility A bug related to breaking changes in OTP or other tools deployment:scripts Anything to do with the management scripts

Comments

@amalbuquerque
Copy link

amalbuquerque commented Jun 21, 2018

Steps to reproduce

After building a release with the new Elixir 1.6.6 and Erlang/OTP 21, I'm unable to run custom release tasks.

N.B: this didn't happened with the previous Erlang/OTP 20.1. The application still runs OK (e.g. console, foreground, etc.)

I get the following error:

root@3411ff09020c:~/my_app/_build/prod/rel/my_app/bin# ./my_app command Elixir.MyApp.ReleaseTasks migrate_up
init terminating in do_boot ({cannot get bootfile,no_dot_erlang.boot})

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

This is the bin folder content:

root@3411ff09020c:~/my_app/_build/prod/rel/my_app/bin# ll
total 112
drwxr-xr-x 2 root root  4096 Jun 21 12:41 .
drwxr-xr-x 7 root root  4096 Jun 21 11:13 ..
-rwxrwxrwx 1 root root   794 Jun 21 11:13 my_app
-rwxrwxrwx 1 root root   334 Jun 21 11:13 my_app.bat
-rwxrwxrwx 1 root root  2049 Jun 21 11:13 my_app_loader.sh
-rw-r--r-- 1 root root  6906 Jun 21 11:13 nodetool
-rw-r--r-- 1 root root 10835 Jun 21 11:13 release_utils.escript
-rw-r--r-- 1 root root 20794 Jun 21 11:13 start_clean.boot

If I copy the start_clean.boot to no_dot_erlang.boot, everything works as expected.

Maybe Erlang/OTP 21 changed the name of the .boot file it generates?

Verbose Logs

==> Loading configuration..
==> Assembling release..
==> Building release my_app:0.0.1 using environment prod
==> One or more direct or transitive dependencies are missing from
    :applications or :included_applications, they will not be included
    in the release:

    :parse_trans

    This can cause your application to fail at runtime. If you are sure
    that this is not an issue, you may ignore this warning.

==> Discovered applications:
  poolboy-1.5.1
    from: _build/prod/lib/poolboy
    applications:
      :kernel
      :stdlib
    includes: none

  ecto-2.2.10
    from: _build/prod/lib/ecto
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :decimal
      :poolboy
      :crypto
    includes: none

  phoenix_ecto-3.3.0
    from: _build/prod/lib/phoenix_ecto
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :ecto
      :plug
    includes: none

  distillery-1.5.2
    from: _build/prod/lib/distillery
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  decimal-1.5.0
    from: _build/prod/lib/decimal
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  connection-1.0.4
    from: _build/prod/lib/connection
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  db_connection-1.1.3
    from: _build/prod/lib/db_connection
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :connection
    includes: none

  postgrex-0.13.5
    from: _build/prod/lib/postgrex
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :db_connection
      :decimal
      :crypto
    includes: none

  eex-1.6.6
    from: /elixir/bin/../lib/eex
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  mime-1.2.0
    from: _build/prod/lib/mime
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  plug-1.5.1
    from: _build/prod/lib/plug
    applications:
      :kernel
      :stdlib
      :elixir
      :crypto
      :logger
      :mime
    includes: none

  phoenix-1.3.2
    from: _build/prod/lib/phoenix
    applications:
      :kernel
      :stdlib
      :elixir
      :plug
      :poison
      :logger
      :eex
      :phoenix_pubsub
      :crypto
    includes: none

  ex_statsd-0.5.3
    from: _build/prod/lib/ex_statsd
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  cowlib-1.0.2
    from: _build/prod/lib/cowlib
    applications:
      :kernel
      :stdlib
      :crypto
    includes: none

  ranch-1.3.2
    from: _build/prod/lib/ranch
    applications:
      :kernel
      :stdlib
      :ssl
    includes: none

  cowboy-1.1.2
    from: _build/prod/lib/cowboy
    applications:
      :kernel
      :stdlib
      :ranch
      :cowlib
      :crypto
    includes: none

  phoenix_pubsub-1.0.2
    from: _build/prod/lib/phoenix_pubsub
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :crypto
    includes: none

  ex_aws_kms-2.0.0
    from: _build/prod/lib/ex_aws_kms
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :ex_aws
    includes: none

  ex_aws_s3-2.0.0
    from: _build/prod/lib/ex_aws_s3
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :ex_aws
    includes: none

  ex_aws-2.0.2
    from: _build/prod/lib/ex_aws
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :crypto
    includes: none

  metrics-1.0.1
    from: _build/prod/lib/metrics
    applications:
      :kernel
      :stdlib
    includes: none

  ssl_verify_fun-1.1.1
    from: _build/prod/lib/ssl_verify_fun
    applications:
      :kernel
      :stdlib
      :ssl
    includes: none

  certifi-2.3.1
    from: _build/prod/lib/certifi
    applications:
      :kernel
      :stdlib
    includes: none

  mimerl-1.0.2
    from: _build/prod/lib/mimerl
    applications:
      :kernel
      :stdlib
    includes: none

  unicode_util_compat-0.3.1
    from: _build/prod/lib/unicode_util_compat
    applications:
      :kernel
      :stdlib
    includes: none

  idna-5.1.1
    from: _build/prod/lib/idna
    applications:
      :kernel
      :stdlib
      :unicode_util_compat
    includes: none

  ssl-9.0
    from: /usr/local/lib/erlang/lib/ssl-9.0
    applications:
      :crypto
      :public_key
      :kernel
      :stdlib
    includes: none

  public_key-1.6
    from: /usr/local/lib/erlang/lib/public_key-1.6
    applications:
      :asn1
      :crypto
      :kernel
      :stdlib
    includes: none

  asn1-5.0.6
    from: /usr/local/lib/erlang/lib/asn1-5.0.6
    applications:
      :kernel
      :stdlib
    includes: none

  crypto-4.3
    from: /usr/local/lib/erlang/lib/crypto-4.3
    applications:
      :kernel
      :stdlib
    includes: none

  hackney-1.12.1
    from: _build/prod/lib/hackney
    applications:
      :kernel
      :stdlib
      :crypto
      :asn1
      :public_key
      :ssl
      :idna
      :mimerl
      :certifi
      :ssl_verify_fun
      :metrics
    includes: none

  poison-3.1.0
    from: _build/prod/lib/poison
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  gettext-0.15.0
    from: _build/prod/lib/gettext
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
    includes: none

  runtime_tools-1.13
    from: /usr/local/lib/erlang/lib/runtime_tools-1.13
    applications:
      :kernel
      :stdlib
    includes: none

  logger-1.6.6
    from: /elixir/bin/../lib/logger
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  compiler-7.2
    from: /usr/local/lib/erlang/lib/compiler-7.2
    applications:
      :kernel
      :stdlib
    includes: none

  elixir-1.6.6
    from: /elixir/bin/../lib/elixir
    applications:
      :kernel
      :stdlib
      :compiler
    includes: none

  stdlib-3.5
    from: /usr/local/lib/erlang/lib/stdlib-3.5
    applications:
      :kernel
    includes: none

  kernel-6.0
    from: /usr/local/lib/erlang/lib/kernel-6.0
    applications: none
    includes: none

  my_app-0.0.1
    from: _build/prod/lib/my_app
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
      :runtime_tools
      :gettext
      :poison
      :hackney
      :ex_aws
      :ex_aws_s3
      :ex_aws_kms
      :phoenix_pubsub
      :cowboy
      :ex_statsd
      :phoenix
      :postgrex
      :distillery
      :phoenix_ecto
    includes: none

  iex-1.6.6
    from: /elixir/bin/../lib/iex
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  sasl-3.2
    from: /usr/local/lib/erlang/lib/sasl-3.2
    applications:
      :kernel
      :stdlib
    includes: none

==> Generated overlay vars:
    release_name=:my_app
    release_version="0.0.1"
    is_upgrade=false
    upgrade_from=:latest
    dev_mode=false
    include_erts=true
    include_src=false
    include_system_libs=true
    erl_opts=""
    run_erl_env=""
    erts_vsn="10.0"
    output_dir="_build/prod/rel/my_app"
==> Copying applications to _build/prod/rel/my_app
==> Generating nodetool
==> Generating start_erl.data
==> Generating vm.args from rel/custom.vm.args
==> Generating sys.config from config/config.exs
==> Including ERTS 10.0 from /usr/local/lib/erlang/erts-10.0
==> Generating boot script
==> Generating RELEASES
==> Generating start_clean.boot
==> Applying overlays
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/pre_configure.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/post_configure.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/pre_start.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/post_start.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/pre_stop.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/post_stop.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/pre_upgrade.d
==> Applying mkdir overlay
    dst: releases/0.0.1/hooks/post_upgrade.d
==> Applying copy overlay
    src: _build/prod/lib/distillery/priv/libexec
    dst: releases/0.0.1/libexec
==> Applying mkdir overlay
    dst: releases/0.0.1/commands
==> Applying copy overlay
    src: rel/commands/migrate_up.sh
    dst: releases/0.0.1/commands/migrate_up.sh
==> Applying copy overlay
    src: rel/commands/migrate_down.sh
    dst: releases/0.0.1/commands/migrate_down.sh
==> Packaging release..
==> Archiving my_app-0.0.1
==> Writing tarball to _build/prod/rel/my_app/releases/0.0.1/my_app.tar.gz
==> Updating tarball
==> Tarball updated!
==> Release successfully built!
    You can run it in one of the following ways:
      Interactive: _build/prod/rel/my_app/bin/my_app console
      Foreground: _build/prod/rel/my_app/bin/my_app foreground
      Daemon: _build/prod/rel/my_app/bin/my_app start

Description of issue

  • What are the expected results?

    I should be able to run my custom task.

  • What OS, Erlang/Elixir versions are you seeing this issue on?

    Linux (Debian container), Elixir 1.6.6, Erlang/OTP 21.

  • If possible, also provide your rel/config.exs, as it is often
    my first troubleshooting question, and you'll save us both time :)

Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Mix.Releases.Config,
    default_release: :default,
    default_environment: Mix.env()

environment :dev do
  set dev_mode: true
  set include_erts: false
  set cookie: :"REDACTED"
end

environment :prod do
  set include_erts: true
  set include_src: false
  set cookie: :"won't be used, we set it via a custom vm.args file (rel/custom.vm.args)"
end

release :media_provider do
  set vm_args: "rel/custom.vm.args"
  set version: current_version(:media_provider)
  set applications: [
    :runtime_tools
  ]
  set commands: [
    "migrate_up": "rel/commands/migrate_up.sh",
    "migrate_down": "rel/commands/migrate_down.sh"
  ]
end
$ cat rel/custom.vm.args
-name <%= release_name %>@${POD_IP}

-setcookie ${ERLANG_COOKIE}

-smp auto
@lessless
Copy link
Contributor

Here it is erlang/otp@11fcc4b#diff-ca4358fbed781931ba20cdecd94e3ac0R258

Seems that default boot script was changed

@joshuataylor
Copy link

How would this be handled to support both OTP21 and older?

@bitwalker
Copy link
Owner

We just need to be explicit about the boot script we are targeting when executing commands.

@bitwalker
Copy link
Owner

I'm planning to cut a new release on Monday, FYI

@bitwalker bitwalker added deployment:scripts Anything to do with the management scripts bug:compatibility A bug related to breaking changes in OTP or other tools labels Jun 24, 2018
@joshuataylor
Copy link

Awesome, thanks @bitwalker. Everything else is working fine, so will test that release to check commands work and let you know 👍.

@bitwalker bitwalker self-assigned this Jun 24, 2018
@tsloughter
Copy link

In relx we just always create the no_dot_erlang boot now, erlware/relx@78561dc

@mschae
Copy link

mschae commented Jun 27, 2018

@bitwalker Any news on this? Any way I can help?

@bitwalker
Copy link
Owner

This is fixed in 1.5.3 (on Hex) and in master for the 2.x work

@joshuataylor
Copy link

Can confirm that 1.5.3 works as it did before, thank you so much! 🎉

@jimsynz
Copy link

jimsynz commented Jun 28, 2018

All working. Thank you so much! ✨

@ruannawe
Copy link

ruannawe commented Nov 7, 2018

use erlang version >= 21.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:compatibility A bug related to breaking changes in OTP or other tools deployment:scripts Anything to do with the management scripts
Projects
None yet
Development

No branches or pull requests

8 participants