mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-06-10 20:16:39 +02:00
Updated Using Netbox Plugins (markdown)
parent
7adfa13f7d
commit
b5f16cc0d3
@ -1,4 +1,4 @@
|
|||||||
To utilise plugins that have been created by users within the [NetBox Community](https://github.com/netbox-community/netbox/wiki/Plugins) a custom image must be used.
|
To utilize plugins that have been created by users within the [NetBox Community](https://github.com/netbox-community/netbox/wiki/Plugins) a custom image must be used.
|
||||||
|
|
||||||
Lets start with a fresh install of netbox-docker.
|
Lets start with a fresh install of netbox-docker.
|
||||||
|
|
||||||
@ -7,20 +7,23 @@ Lets start with a fresh install of netbox-docker.
|
|||||||
* Create a few files these are (`plugin_requirements.txt`, `Dockerfile-Plugins`, `docker-compose.override.yml`)
|
* Create a few files these are (`plugin_requirements.txt`, `Dockerfile-Plugins`, `docker-compose.override.yml`)
|
||||||
|
|
||||||
## Python Requirements
|
## Python Requirements
|
||||||
The `plugin_requirements.txt` file needs to contain all the plugins that are required.
|
The `plugin_requirements.txt` file needs to contain all the plugins that are required.
|
||||||
|
|
||||||
```
|
```
|
||||||
ntc-netbox-plugin-onboarding
|
netbox-secretstore
|
||||||
```
|
```
|
||||||
|
|
||||||
> NOTE: These must be on PyPi to work.
|
> NOTE: These must be on PyPi to work.
|
||||||
|
|
||||||
## NetBox Configuration
|
## NetBox Configuration
|
||||||
|
|
||||||
To get plugins to work within NetBox you need to add some configuration to `configuration.py`.
|
To get plugins to work within NetBox you need to add some configuration to `configuration.py`.
|
||||||
```
|
|
||||||
PLUGINS = ["netbox_onboarding"]
|
```python
|
||||||
|
PLUGINS = ["netbox_secretstore"]
|
||||||
|
|
||||||
# PLUGINS_CONFIG = {
|
# PLUGINS_CONFIG = {
|
||||||
# "netbox_onboarding": {
|
# "netbox_secretstore": {
|
||||||
# ADD YOUR SETTINGS HERE
|
# ADD YOUR SETTINGS HERE
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
@ -29,8 +32,9 @@ PLUGINS = ["netbox_onboarding"]
|
|||||||
|
|
||||||
## Custom Docker File
|
## Custom Docker File
|
||||||
|
|
||||||
The new `Dockerfile-Plugins` will enable us to build a new image with the required plugins installed.
|
The new `Dockerfile-Plugins` will enable us to build a new image with the required plugins installed.
|
||||||
```
|
|
||||||
|
```Dockerfile
|
||||||
FROM netboxcommunity/netbox:latest
|
FROM netboxcommunity/netbox:latest
|
||||||
|
|
||||||
COPY ./plugin_requirements.txt /
|
COPY ./plugin_requirements.txt /
|
||||||
@ -39,13 +43,16 @@ RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /plugin_requi
|
|||||||
# These lines are only required if your plugin has its own static files.
|
# These lines are only required if your plugin has its own static files.
|
||||||
COPY configuration/configuration.py /etc/netbox/config/configuration.py
|
COPY configuration/configuration.py /etc/netbox/config/configuration.py
|
||||||
RUN SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
RUN SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> NOTE: You can swap the image out to use any of the images that the Netbox-Docker community publishes to [Docker Hub](https://hub.docker.com/r/netboxcommunity/netbox/tags). For example if LDAP is required, swap out `netboxcommunity/netbox:latest` for `netboxcommunity/netbox:latest-ldap`.
|
> NOTE: You can swap the image out to use any of the images that the Netbox-Docker community publishes to [Docker Hub](https://hub.docker.com/r/netboxcommunity/netbox/tags). For example if LDAP is required, swap out `netboxcommunity/netbox:latest` for `netboxcommunity/netbox:latest-ldap`.
|
||||||
|
|
||||||
## Docker Compose Override
|
## Docker Compose Override
|
||||||
|
|
||||||
`docker-compose.override.yml`, as its name implies, can contain configuration overrides for existing services or entirely new services.
|
`docker-compose.override.yml`, as its name implies, can contain configuration overrides for existing services or entirely new services.
|
||||||
```
|
|
||||||
|
```yaml
|
||||||
version: '3.4'
|
version: '3.4'
|
||||||
services:
|
services:
|
||||||
netbox:
|
netbox:
|
||||||
@ -57,14 +64,23 @@ services:
|
|||||||
image: netbox:latest-plugins
|
image: netbox:latest-plugins
|
||||||
netbox-worker:
|
netbox-worker:
|
||||||
image: netbox:latest-plugins
|
image: netbox:latest-plugins
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-Plugins
|
||||||
netbox-housekeeping:
|
netbox-housekeeping:
|
||||||
image: netbox:latest-plugin
|
image: netbox:latest-plugins
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile-Plugins
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This configuration will change the ports `netbox` will use. It will also select the build file created in previous steps and tell the `netbox-worker` service to now use the new image (`netbox:latest-plugins`) that has been created.
|
This configuration will change the ports `netbox` will use. It will also select the build file created in previous steps and tell the `netbox-worker` service to now use the new image (`netbox:latest-plugins`) that has been created.
|
||||||
|
|
||||||
## Build and Deploy
|
## Build and Deploy
|
||||||
To build and deploy this in docker two commands are required.
|
To build and deploy this in docker two commands are required.
|
||||||
```
|
|
||||||
|
```bash
|
||||||
docker-compose build --no-cache
|
docker-compose build --no-cache
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user