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

a dependency is not included in release #55

Closed
slashmili opened this issue Aug 20, 2016 · 5 comments
Closed

a dependency is not included in release #55

slashmili opened this issue Aug 20, 2016 · 5 comments
Labels
wontfix This is either not a bug, or a feature/request which will not be implemented

Comments

@slashmili
Copy link

Steps to reproduce

Check out this code https://github.com/slashmili/distillery-sample/tree/ecto-enum

Verbose Logs

mix release --verbose --profile=myapp:prod
==> distillery
Compiling 17 files (.ex)
Generated distillery app
==> myapp
Compiling 1 file (.ex)
Generated myapp app
==> Loading configuration..
==> Assembling release..
==> Building release myapp:0.1.0 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:

    :ecto_enum

    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:
  sasl-3.0
    from: /usr/local/Cellar/erlang/19.0.2/lib/erlang/lib/sasl-3.0
    applications:
      :kernel
      :stdlib
    includes: none

  iex-1.3.2
    from: /usr/local/Cellar/elixir/1.3.2/bin/../lib/iex
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

  myapp-0.1.0
    from: _build/dev/lib/myapp
    applications:
      :kernel
      :stdlib
      :elixir
      :logger
    includes: none

  kernel-5.0
    from: /usr/local/Cellar/erlang/19.0.2/lib/erlang/lib/kernel-5.0
    applications: none
    includes: none

  stdlib-3.0.1
    from: /usr/local/Cellar/erlang/19.0.2/lib/erlang/lib/stdlib-3.0.1
    applications:
      :kernel
    includes: none

  elixir-1.3.2
    from: /usr/local/Cellar/elixir/1.3.2/bin/../lib/elixir
    applications:
      :kernel
      :stdlib
      :compiler
    includes: none

  compiler-7.0.1
    from: /usr/local/Cellar/erlang/19.0.2/lib/erlang/lib/compiler-7.0.1
    applications:
      :kernel
      :stdlib
    includes: none

  logger-1.3.2
    from: /usr/local/Cellar/elixir/1.3.2/bin/../lib/logger
    applications:
      :kernel
      :stdlib
      :elixir
    includes: none

==> Generated overlay vars:
    release_name=:myapp
    release_version="0.1.0"
    is_upgrade=false
    upgrade_from=:latest
    dev_mode=false
    include_erts=true
    include_src=false
    include_system_libs=true
    erl_opts=""
    erts_vsn="8.0.2"
    output_dir="rel/myapp"
==> Copying applications to rel/myapp
==> Generating nodetool
==> Generating start_erl.data
==> Generating vm.args
==> Generating sys.config from config/config.exs
==> Including ERTS 8.0.2 from /usr/local/Cellar/erlang/19.0.2/lib/erlang/erts-8.0.2
==> Generating boot script
==> Generating RELEASES
==> Generating start_clean.boot
==> Applying overlays
==> Applying mkdir overlay
    dst: releases/0.1.0/hooks
==> Applying mkdir overlay
    dst: releases/0.1.0/commands
==> Packaging release..
==> Archiving myapp-0.1.0
==> Writing tarball to rel/myapp/releases/0.1.0/myapp.tar.gz
==> Updating tarball
==> Tarball updated!
==> Release successfully built!
    You can run it in one of the following ways:
      Interactive: rel/myapp/bin/myapp console
      Foreground: rel/myapp/bin/myapp foreground
      Daemon: rel/myapp/bin/myapp start

Description of issue

  • What are the expected results?

Since ecto_enum is in my deps list I'm expecting that distillery includes ecto_enum in the OTP release

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

Elixir 1.3.2, Erlang/OTP 19, Mac 10.12 and Ubuntu 16.04

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

Refer to the repo

  • Is there documentation that says one thing, but Distillery does
    another? If so, please link the doc here so it can be updated if
    it's a documentation issue, or so that the fix can be based around
    what's documented.

There is no documents about included_applications like the way that is in exrm
Dependency issues so I'm not sure if distillery is supposed to detect the dependency or I should explicitly mention it

@bitwalker
Copy link
Owner

Distillery won't implicitly add dependencies to applications, because they represent two different things generally, for instance you may have compile-time dependencies which you don't want in the release, but which you need for building (such as distillery itself), and this is potentially a problem since dependencies can define on_load callbacks for modules, which could result in undesired code being executed at runtime, perhaps even preventing the release from booting.

The warning you see in the output is intended to let you know when one is missing. I went back and forth on this, but after a conversation with a number of people on IRC, I realized that there are a couple of situations where doing that is not desired, and having an opt-out mechanism is just as much pain as an opt-in mechanism, except we already have the opt-in mechanism, and one that many people are used to at this point.

@bitwalker bitwalker added the wontfix This is either not a bug, or a feature/request which will not be implemented label Aug 20, 2016
@slashmili
Copy link
Author

slashmili commented Aug 21, 2016

Ok clear,

is there any plan to add more detail about included_applications in the documents?

One more thing, I added the

 def included_applications do
    [:ecto_enum]
  end

to my Myapp.Mixfile module but still get the same warning.

The code is available here https://github.com/slashmili/distillery-sample/tree/ecto-enum

@bitwalker
Copy link
Owner

@slashmili included_applications should be configured like so:

  def application do
    [mod: {MyApp, []},
     applications: [...],
     included_applications: [:ecto_enum]]
  end

But you should only use included_applications if you are manually managing that application's lifecycle, i.e. calling Application.start, etc.

@octosteve
Copy link

@bitwalker I'm running into this with Poison. It's not an app that needs to be started. Is the best way to get this packaged to used included_applications?

@bitwalker
Copy link
Owner

@stevennunez use set applications: [someapp: :load in rel/config.exs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This is either not a bug, or a feature/request which will not be implemented
Projects
None yet
Development

No branches or pull requests

3 participants