Skip to content

Custom MIX_DEPS_PATH issues in umbrella #14515

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

Closed
mnussbaumer opened this issue May 22, 2025 · 4 comments
Closed

Custom MIX_DEPS_PATH issues in umbrella #14515

mnussbaumer opened this issue May 22, 2025 · 4 comments

Comments

@mnussbaumer
Copy link

Elixir and Erlang/OTP versions

erlang:27-alpine
elixir 1.18.1

Operating system

Inside docker containers running erlang alpine, through docker compose, overlaying the umbrella folder in a linux ubuntu 24.04 server vm

Current behavior

You can find a full reproducible repository here, with instructions and some more info:
https://github.com/mnussbaumer/mix-comp-bug

The issue is basically, when using MIX_DEPS_PATH in an umbrella project, some deps are correctly compiled to the umbrella root, while others end up each of the apps folders which then creates a new series of problems (missing modules in some cases, missing templates/js files as is this particular example, phoenix and phoenix_live_view js files)

Reason why I need this working:
in order to be able to use several "apps" that are independent of each other but part of the same umbrella, when developing locally, where at least two of those apps are started and running at the same time, from the same folder (in this case through docker compose overlays, that map to the same umbrella folder as the context, but it would probably happen without docker compose anyway, if you ran two shells from two terminals in the same umbrella root), I came to the point where the only solution I found was to make each "service" map its deps and build folders to independent folders, instead of using a single one as is usual.

This is because when not doing that, plenty of concurrent issues (due to apps being compiled to the same destination, and folders/files being churned through) arise, ending with mostly applications crashes (I'm talking 95%++ runs), and this solved that beautifully.

But now I'm facing this issue where somewhere, something is compiling the deps into the individual umbrella apps folder, instead of the root folder, and more mysteriously, some of the deps are not present either in the root nor the apps deps folder. I'm not entirely sure what else I can try - the repository I linked has all the instructions to set this up locally with docker and further info and context.

It seems that somewhere in the compile chain it's not asking if it's inside an umbrella or not and defaulting to the mix project of the individual app, instead of the umbrella.

Expected behavior

Using MIX_DEPS_PATH in an umbrella compiles deps to the right folder (in the root) always and all deps are properly compiled and protocols properly consolidated.

@josevalim
Copy link
Member

Can you please make sure MIX_DEPS_PATH is an absolute path? I am worried that the issue arises from the fact it is a relative path and therefore it is resolved in different places. In this case, we should update our docs.

In case the issue still exists, can you please provide something that shows the issue without Docker? I understand that Docker is what accentuates the problem but you should be able to reproduce the additional directories being created without Docker.

Thank you,

@mnussbaumer
Copy link
Author

@josevalim I'm going to try that in a minute, thanks
Regarding the docker lets see if it solves it before...

@mnussbaumer
Copy link
Author

@josevalim so this solves the issue with the deps folders, indeed. I agree the naming or docks need to change, specially because of the MIX_BUILD_PATH and MIX_BUILD_ROOT, where the path version is explicitly for a path... I can probably push a PR with it if you think something like this is enough: "if you're in an umbrella project you should use an absolute path to prevent issues when compiling deps")

(my pedantic self still thinks it kinda looks like a bug though, as in, somewhere in the compiler it's ignoring it's in an umbrella, but maybe not worth fixing, and in the docks for deps_path

@spec deps_path([keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [Path.t](https://hexdocs.pm/elixir/Path.html#t:t/0)()
Returns the path where dependencies are stored for the given project.

If no configuration is given, the one for the current project is used.

The returned path will be expanded.

Examples
Mix.Project.deps_path()
#=> "/path/to/project/deps"

Anyway, I'm very happy if this is the final issue I have because the end product is quite amazing! I'll re-open if something else pops up on the real project...

@mnussbaumer
Copy link
Author

And thank you for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants