Simplify plugin installation
Netbox plugins can now be mounted into the container and will be loaded automatically from the mounted path. A configuration file to enabled the plugin in has to be mounted additionally. To install a plugin from outside the container you need to use the same Python version as is used in the container. At the moment that is Python 3.11. Assuming you are in the netbox-docker directory and using the default configuration, just run this command, to install the netbox-initializers plugin: pip install --target=plugins netbox-initializers
This commit is contained in:
parent
caba1b335d
commit
5741d2e59c
@ -97,9 +97,11 @@ WORKDIR /opt/netbox/netbox
|
||||
|
||||
# Must set permissions for '/opt/netbox/netbox/media' directory
|
||||
# to g+w so that pictures can be uploaded to netbox.
|
||||
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
|
||||
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ /opt/netbox/plugins \
|
||||
&& chown -R unit:root /opt/unit/ media reports scripts \
|
||||
&& chmod -R g+w /opt/unit/ media reports scripts \
|
||||
# Add additional path to sys.path, to enable plugin installation without having to build a new Docker image
|
||||
&& echo "/opt/netbox/plugins" > /opt/netbox/venv/lib/python3.11/site-packages/plugins.pth \
|
||||
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
|
||||
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
|
||||
&& SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
||||
|
@ -15,6 +15,7 @@ services:
|
||||
test: "curl -f http://localhost:8080/api/ || exit 1"
|
||||
volumes:
|
||||
- ./configuration:/etc/netbox/config:z,ro
|
||||
- ./plugins:/opt/netbox/plugins:z,ro
|
||||
- netbox-media-files:/opt/netbox/netbox/media:rw
|
||||
- netbox-reports-files:/opt/netbox/netbox/reports:rw
|
||||
- netbox-scripts-files:/opt/netbox/netbox/scripts:rw
|
||||
|
1
plugins/.gitignore
vendored
Normal file
1
plugins/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*
|
0
plugins/.gitkeep
Normal file
0
plugins/.gitkeep
Normal file
Reference in New Issue
Block a user