Repository navigation
Conversation
Keep the packages added with lnms plugin:add in /data/composer/composer.plugins.json (LIBRENMS_COMPOSER_PLUGINS) and install them with lnms plugin:sync next to a copy of the image's dependencies in /data/composer/build. Containers use that build at startup, or the image's vendor when nothing was added. It is recreated when the list or the image's dependencies change, and startup falls back to the image's packages if that fails. The image's composer.json, composer.lock and vendor are root owned and never modified, so no ownership changes are needed in /opt/librenms.
murrant
marked this pull request as ready for review
November 16, 2026 16:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Persist Composer packages added with
lnms plugin:addacross container replacement and image upgrades, without modifying the image or changing ownership in/opt/librenms.Follows the suggestion in #607 (comment): only the list of added packages is persisted, and they are installed again against the image's dependencies.
How it works
LIBRENMS_COMPOSER_PLUGINSpoints LibreNMS at/data/composer/composer.plugins.json, the only persisted state.lnms plugin:add/plugin:removerun against/data/composer/build, a copy of the image's packages plus the added ones.vendorto that build, or to the image'svendor-imagewhen nothing was added.lnms plugin:syncwhen the list, the image'scomposer.json/composer.lock, or the PHP version change. If that fails, LibreNMS starts with the image's packages and logs an error.composer.json,composer.lockandvendor-imageare root owned.composer.pharlinks to the image's composer so the LibreNMS composer wrapper doesn't try to download it.Requires
lnms plugin:syncandLIBRENMS_COMPOSER_PLUGINSfrom librenms/librenms#21286, which is not in a release yet. Draft until the next LibreNMS release, the new CI step only passes on themastermatrix entry until then.Testing
Built with
LIBRENMS_VERSION=masterand ran the new CI step locally: add, rejecting an unavailable version, recreating all containers without reinstalling, reinstalling after an image change, and removal.test/services.shpasses on all four containers.Composer prints "Ambiguous class resolution" warnings for
dapphp/radiusduring installs, because the LibreNMS classmap namesvendor/dapphp/radiusdirectly. Both copies are the same locked version.