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

Add inet_cidr to included_applications #1

Closed
philipgiuliani opened this issue Dec 14, 2016 · 5 comments
Closed

Add inet_cidr to included_applications #1

philipgiuliani opened this issue Dec 14, 2016 · 5 comments

Comments

@philipgiuliani
Copy link

inet_cidr should be added to included_applications, otherwise it will not be added in the release and the application will crash on startup.

@ajvondrak
Copy link
Owner

Thanks! Hadn't crossed the bridge of working with Elixir releases yet, so I'll take your word on this & push out the fix. :)

@ajvondrak
Copy link
Owner

By the way, do you know of an easy way to tell what will or won't break a release? There are two other declared deps that don't have corresponding applications:combine and plug.

I suppose plug will probably be included as an application in whatever project you're using remote_ip with already. Do you know if combine will similarly break releases?

@philipgiuliani
Copy link
Author

Oh I completely forgot to answer... Actually you have to add every dependency you are using in production. Elixir 1.4 will automate this and you don't have to define them anymore.

In applications you add all dependencies that are running as application, and in included_application you add libraries.

Plug is already included in phoenix. Actually you probably also have to add combine in included_applications.

You can read about it here http://blog.plataformatec.com.br/2016/07/understanding-deps-and-applications-in-your-mixfile/

@ajvondrak
Copy link
Owner

@philipgiuliani Thanks for the follow-up! I've only now just gotten around to addressing this, myself. :)

Application inference sounds super useful. I see Elixir 1.4 was just released recently, I'll definitely have to play around with it.

In the meantime, I verified that (indeed) the lack of :combine breaks when trying to use RemoteIp.Headers.Forwarded from a Distillery release. (First time using Distillery, actually, so it's a learning process for me.) I'll add :combine to the :included_applications - and what the heck, even add :plug to the :applications, just to cover all the bases. 👍 Thanks again.

ajvondrak pushed a commit that referenced this issue Jan 16, 2017
Per further discussion on #1, a deployed Erlang app needs to know of all
the library applications, even if they aren't active.
RemoteIp.Headers.Forwarded was breaking at runtime from such apps
because Combine was not being loaded (even though it doesn't have a
supervisor to start or anything).

I believe this would be fixed by adding everything to `:applications`,
which Elixir 1.4 would do anyway, but for the sake of specificity I've
added all of remote_ip's dependencies (all the other 2 of them...) to
their "proper" places.
@philipgiuliani
Copy link
Author

Yes perfect, so you can also use it without using Phoenix. Great job! With Elixir 1.4 you can just remove all of this :)

ajvondrak pushed a commit that referenced this issue Aug 20, 2019
As noted in #12, #14, #15, #16, #17, and even way back in a comment on
a5fb55b, my prior inclination to try to
use `:included_applications` and `:applications` separately was
ill-fated. Under Elixir 1.9.0, Mix started blowing up properly on `mix
release` with

  ** (Mix) :combine is listed both as a regular application and as an
  included application

So I guess everything should go under `:applications` by design. /shrug

I'm trusting this to be backwards-compatible with Elixir 1.3, per the
discussions on #1 from way back when. 😅
ajvondrak added a commit that referenced this issue Feb 1, 2021
Previously, on "I don't actually know how application/0 works": #1, #17.
And now, the next exciting installment!

We don't need to list all the dependencies under :applications anymore,
since Elixir v1.4 infers all of them. In fact, declaring :applications
like this is clobbering any of the inference work that would otherwise
have happened, thus leaving :logger out of the picture! In practice, I
think this was fine just because :logger would be pulled in via :plug
(and possibly others) transitively.

But we're well past the days of supporting Elixir v1.3, so I think it'll
generally be clearer to lean on :extra_applications and let Elixir take
care of the big picture.

In turn, this change makes :ex_doc's `runtime: false` flag make sense. I
added it blindly to the dependency in 27a108f because that's what their
README said. But now I know its actual purpose is to keep Elixir from
pulling :ex_doc into the inferred :applications list.

Further reading:
* https://elixirforum.com/t/documenting-the-use-of-included-applications/1673
* https://blog.plataformatec.com.br/2016/07/understanding-deps-and-applications-in-your-mixfile/
* https://elixir-lang.org/blog/2017/01/05/elixir-v1-4-0-released/
* https://stackoverflow.com/a/44727742
* https://www.amberbit.com/blog/2017/9/22/elixir-applications-vs-extra_applications-guide/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants