mirror of
https://github.com/librenms/docker.git
synced 2026-01-23 10:15:22 +00:00
Merge df892f8e20 into 937a473821
This commit is contained in:
commit
840c4ac57e
3 changed files with 84 additions and 0 deletions
|
|
@ -186,6 +186,13 @@ linux/s390x
|
|||
* `DB_PASSWORD`: MySQL password (default `librenms`)
|
||||
* `DB_TIMEOUT`: Time in seconds after which we stop trying to reach the MySQL server (useful for clusters, default `60`)
|
||||
|
||||
### Plugins
|
||||
* `INSTALL_PLUGINS`: Space-separated list of plugins to install
|
||||
|
||||
> This environment variable allows you to specify which plugins should be installed
|
||||
> in your LibreNMS container. It's particularly useful for enabling SAML authentication.
|
||||
> The value should be a space-separated list of plugin names.
|
||||
|
||||
### Misc
|
||||
|
||||
* `LIBRENMS_BASE_URL`: URL of your LibreNMS instance (default `/`)
|
||||
|
|
|
|||
34
rootfs/etc/cont-init.d/09-install-plugins.sh
Normal file
34
rootfs/etc/cont-init.d/09-install-plugins.sh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
# shellcheck shell=sh
|
||||
set -e
|
||||
|
||||
INSTALL_PLUGINS=${INSTALL_PLUGINS:-0}
|
||||
SIDECAR_DISPATCHER=${SIDECAR_DISPATCHER:-0}
|
||||
SIDECAR_SYSLOGNG=${SIDECAR_SYSLOGNG:-0}
|
||||
SIDECAR_SNMPTRAPD=${SIDECAR_SNMPTRAPD:-0}
|
||||
|
||||
# Exit if any sidecar is enabled
|
||||
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ] || [ "$SIDECAR_SNMPTRAPD" = "1" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Exit if plugins are not needed
|
||||
if [ "$INSTALL_PLUGINS" = "0" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ">> Plugin configuration detected"
|
||||
|
||||
echo "Fixing permissions..."
|
||||
chown librenms:librenms \
|
||||
"${LIBRENMS_PATH}"/composer.* \
|
||||
"${LIBRENMS_PATH}/logs/librenms.log" \
|
||||
"${LIBRENMS_PATH}/scripts/composer_wrapper.php"
|
||||
|
||||
chown -R librenms:librenms \
|
||||
"${LIBRENMS_PATH}/scripts" \
|
||||
"${LIBRENMS_PATH}/vendor" \
|
||||
"${LIBRENMS_PATH}/bootstrap"
|
||||
|
||||
# Install plugins
|
||||
lnms plugin:add "$INSTALL_PLUGINS"
|
||||
43
rootfs/etc/cont-init.d/09-plugin-add.sh
Normal file
43
rootfs/etc/cont-init.d/09-plugin-add.sh
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/with-contenv sh
|
||||
# shellcheck shell=sh
|
||||
set -e
|
||||
|
||||
INSTALL_PLUGINS=${INSTALL_PLUGINS:-0}
|
||||
|
||||
# Continue only if plugins are needed
|
||||
if [ "$INSTALL_PLUGINS" = "0" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ">>"
|
||||
echo ">> Plugin configuration detected"
|
||||
echo ">>"
|
||||
|
||||
# Fix perms
|
||||
echo "Fixing perms..."
|
||||
chown librenms:librenms \
|
||||
${LIBRENMS_PATH}/composer.* \
|
||||
${LIBRENMS_PATH}/logs/librenms.log \
|
||||
${LIBRENMS_PATH}/scripts/composer_wrapper.php
|
||||
chown -R librenms:librenms \
|
||||
${LIBRENMS_PATH}/scripts \
|
||||
${LIBRENMS_PATH}/vendor \
|
||||
${LIBRENMS_PATH}/bootstrap
|
||||
|
||||
# Create service
|
||||
IFS=, read -ra PLUGINS <<< "$INSTALL_PLUGINS"
|
||||
|
||||
for plugin in "${PLUGINS[@]}"; do
|
||||
echo "Installing plugin: $plugin"
|
||||
|
||||
if ! lnms plugin:installed "$plugin"; then
|
||||
if ! lnms plugin:add "$plugin"; then
|
||||
echo "Error installing $plugin" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Installed $plugin"
|
||||
else
|
||||
echo "$plugin already installed"
|
||||
fi
|
||||
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue