lawik

lawik

Nerves Core Team

I’ve been thinking about making an open source application in Elixir that would benefit from having extensibility from third parties. So the user of this application would download a compiled release, run it and decide “I want the last.fm scrobbler extension” and I want them to be able to bring in a bunch of modules by providing the files as a zip or whatever archive makes sense to the application.

This isn’t PHP, we can’t just drop them in a folder. But my first thinking is simply that the application compiles the new code and saves some config info to make sure it will be loaded on subsequent starts. It will not be part of the release but it will be part of the “installation”.

Does this make sense? Should I consider some alternate approaches?

I’d rather not make users compile the application source + their extensions beforehand as it would defeat many of the benefits of distributing ready-to-run binary releases.

Thoughts?

Showing Posts 1 to 5

OvermindDL1

OvermindDL1

You can load extensions in real-time without issue. What I’ve always done is just add the compiled applications to the same library release (so they get loaded, or you can explicitly load from a path too, I’ve done that before as well), then just set the module entrypoint for it in a configuration (application environment), or if it’s a running system then just tell it to load it straight and it can register itself in and is immediately loaded and doing its work. :slight_smile:

As long as it’s in the load module path (which you can alter) and ‘something’ loads the entry module for the plugin (configuration files are great! or a database or whatever to get the names) then it all just works. You could even scan all beam files in the module paths for what implements a certain behaviour and load those as well (dynamic loading! I’ve done that before as well, though I like configs a bit more in ‘most’ cases, more control).

Just have to make sure the plugin is compiled with the same version as everything else, a simple build API fixes that up.

Or you can even load plugins as their own nodes that connect to the main system and register themselves in too, that’s fully under the plugin control then, no dynamic system needed. :slight_smile:

lawik

lawik OP

Nerves Core Team

Lots of good notes here. But am I following you in that you are talking about compiling the plugins before hand? I was thinking about the core application being distributed as a binary release while plugins might be source-based. Then again, that causes potential trouble with plugin dependencies I guess. Just a bit more work to either offer compilation for plugin creators or making them build for multiple architectures. In that sense source and compiling at run time felt promising. Assuming those facilities are there in a release.

lawik

lawik OP

Nerves Core Team

So, some further reading makes me think a compiled Beam file would be platform independent, but as you were saying I would need to make sure to match up the versions that things are built with, not per platform, just Elixir, Erlang + OTP if I got things right.

OvermindDL1

OvermindDL1

You can of course compile on demand, but you need to be sure to include the compiler libraries, and you wn’t have mix available unless you include that as well, which will generate how code can be generated as it won’t think it’s a full release then.

But yeah, compiled beam file’s are platform independent, but they are dependent on the OTP version (and to a lesser extent the Elixir version) that they are compiled with.

lawik

lawik OP

Nerves Core Team

Sounds like plenty of options at least :slight_smile:

— All posts loaded —

Where Next? Top

Trending in Discussions Top

wmnnd
Hey folks, I wanted to share with you a project I’ve been working on for a while: It’s an Open Source (AGPLv3) newsletter tool. Think Ma...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
sntran
In my third year of college, around 2010, I found Erlang. A few years later, I found Elixir. I liked the ideas at once: many small proces...
New
Ganna
Hi everyone, I have 8 years of production experience with Erlang/OTP and I’m just starting to get to know Elixir. What would you learn f...
New
johnkirkham
A note on form. Joe Armstrong, co-creator of the Erlang programming language, died in April 2019. What follows is a work of narrative non...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews