Erlang apps in Elixir umbrella app

Lately I’ve had some reason to consider the interplay between Erlang and Elixir and was curious if there was a guide to the easiest way to have mix handle Erlang applications in Elixir umbrella projects. Doing a rebar3 new app APPNAME doesn’t seem to work well, so I’m curious what the minimal diff to getting an Erlang app recognized as an umbrella component, as well as for its dependencies to be handled correctly.

I can get the application to start by specifying the dep explicitly in my umbrella app’s deps() function, but I’d like to have the erlang apps handled automatically by just having them in my apps folder.

4 Likes

You’ll probably get best mileage by using mix to compile the erlang apps. Mix is perfectly capable of managing erlang applications when you put erlang code to src.

5 Likes

Allright, I created a mix.exs file inside the erlang app and specified the right start modules and everything seems to be discovered as it should. I’ll create a mix task for generating it and everything will be fine. Thanks. :slight_smile:

2 Likes

Hosting Erlang app in an Elixir umbrella project is pretty straightforward, this example project might be helpful: https://github.com/wojtekmach/hello_beam. Remember to set ‘manager: :rebar3’ in mix.exs if you run into any issues when compiling Erlang child app. AFAIR I used simply ‘rebar3 new lib hello_erlang’ in apps folder to create the app.

So depending on your use case, having everything in Erlang in separate app (including tests etc) might be an option too. For simply compiling some Erlang code using mix as @michalmuskala mentioned above might be enough.

4 Likes