Plugin Installer with modules that have binary bits

10 views
Skip to first unread message

Stephen Paul Weber

unread,
Nov 5, 2024, 4:09:22 PM11/5/24
to prosody-dev
If I make a rock that has a prosody module and some binary bits (in rust in my case, but I imagine this situation would be identical for C) then I can get prosodyctl install to install it just fine, and it can see my module and try to load it, but when my module tries to require("...") the binary module it cannot find it, it seems because the custom_plugins directory is not part of the ?.so search path only the ?.lua search path.

Would it be sensible for prosody to add eg /var/lib/prosody/custom_plugins/lib/lua/5.4 to the ?.so search path for require, or is there a different approach I should be considering here?

Thanks.

Kim Alvefur

unread,
Nov 7, 2024, 9:49:31 AM11/7/24
to proso...@googlegroups.com
I actually thought this was unintentionally possible already, but the
search paths are indeed not added to the regular Lua ones so require()
can't find them, only module:require() which can't load binary modules.

One thing I might consider a blocker is that the plugin management code
can't _unload_ binary modules currently, so upgrading and reloading
modules is not enough.

If you're okay with needing extra steps to upgrade and replace code,
there are some things that can be done without code changes:

You could install the binary bits with luarocks into the Prosody home
directory:

sudo -u prosody luarocks install mybinarybits

Another trick would be to set the plugin installer path to
`~prosody/.luarocks`, i.e. the same path the above luarocks command
would use. Maybe this should have been the default, I'm not sure.
Then `prosodyctl install` and `luarocks install` (as the prosody user)
would be essentially the same.

installer_plugin_path = "/var/lib/prosody/.luarocks"

--
Zash
Reply all
Reply to author
Forward
0 new messages