arpan

arpan

Compilation issues on umbrella project

Hello everyone,

I am currently working on an Elixir project that utilizes an umbrella app setup. Unfortunately, we are encountering numerous compilation issues that are adversely affecting our development experience. I would greatly appreciate your assistance and guidance regarding these challenges.

To provide some context, our umbrella app consists of the following apps:

  • web: Live view user-facing app
  • admin: Live view internal admin app
  • api: GraphQL API app
  • db: DB schemas, changeset, contexts
  • pool: Background jobs, cron jobs, Broadway, etc.

Here is a visual representation of the dependency graph:

Now, let’s delve into the problems we are currently facing:

  1. Lazy Compilation:
    We have observed that when we make code changes, the code only partially compiles. We expected that running mix compile followed by starting the server would eliminate the need for further compilation. However, we are encountering situations where the code starts compiling again after the server is launched or upon hitting certain code paths, such as specific browser URLs.

  2. Mismatch in Compile-time vs. Runtime Value Configuration:
    During server startup, we often encounter errors indicating a mismatch between the compile-time and runtime values of certain configurations. For example:

    ERROR! the application :db has a different value set for key :default_admin_id during runtime compared to compile time. Since this application environment entry was marked as compile time, this difference can lead to different behaviour than expected:
    
    * Compile time value was set to: nil
    * Runtime value was set to: "xxxx"
    

    The environment variable is correctly sourced in the terminal and available during compilation. This error typically occurs when restarting the server process within the same terminal. The only workaround we have found is to kill the server process and execute mix compile --force.

  3. Nebulex:
    We are utilizing Nebulex for caching purposes, but we frequently encounter the following error:

    (Nebulex.RegistryLookupError) could not lookup Nebulex cache App.API.Cache.UserCache because it was not started or it does not exist
    

    This issue often arises when code changes trigger recompilation while the server is running or when manually recompiling in the iex session. The only solution we have found is to restart the server.

  4. Unfinished Compilation:
    When making code changes, we often encounter errors due to the code attempting to access modules that are still in the process of compilation. For instance, the web app may attempt to access a module in the db app that is still compiling, leading to errors. This becomes more problematic due to live reloading in Phoenix.
    We expect the app to wait until all related modules and umbrella dependencies have finished compiling before attempting to load a page. Additionally, we feel that there are unnecessary compilations of unrelated components even for minor code changes, resulting in slower development cycles.

I would greatly appreciate any help, suggestions, or insights regarding these issues.

Where Next?

Popular in Questions Top

pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New

We're in Beta

About us Mission Statement