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

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New
nseaSeb
I’ve just put together a small POC exploring PDF inspection from Elixir/Phoenix: The idea is pretty simple: drag & drop a PDF in a...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews