mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2025-06-10 03:56:38 +02:00
Created Creating your own image | Using Netbox Plugins. (markdown)
parent
210e08d588
commit
b3c9cd03ab
65
Creating-your-own-image-|-Using-Netbox-Plugins..md
Normal file
65
Creating-your-own-image-|-Using-Netbox-Plugins..md
Normal file
@ -0,0 +1,65 @@
|
||||
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.
|
||||
|
||||
Lets start with a fresh install of netbox-docker.
|
||||
|
||||
* `git clone -b release https://github.com/netbox-community/netbox-docker.git`
|
||||
* Change `/env/netbox.env` to your required settings.
|
||||
* Create a few files these are (`plugin_requirements.txt`, `Dockerfile-Plugins`, `docker-compose.override.yml`)
|
||||
|
||||
## Python Requirements
|
||||
The `plugin_requirements.txt` file needs to contain all the plugins that are required.
|
||||
```
|
||||
ntc-netbox-plugin-onboarding
|
||||
```
|
||||
> NOTE: These must be on PyPi to work.
|
||||
|
||||
## Netbox Configuration
|
||||
|
||||
To get plugins to work within Netbox you need to add some configuration to `configuration.py`.
|
||||
```
|
||||
PLUGINS = ["netbox_onboarding"]
|
||||
|
||||
# PLUGINS_CONFIG = {
|
||||
# "netbox_onboarding": {
|
||||
# ADD YOUR SETTINGS HERE
|
||||
# }
|
||||
# }
|
||||
```
|
||||
> NOTE: This can differ for every plugin. To learn more about this see the [Netbox documentation](https://netbox.readthedocs.io/en/stable/plugins/#enable-the-plugin).
|
||||
|
||||
## Custom Docker File
|
||||
|
||||
The new `Dockerfile-Plugins` will enable us to build a new image with the required plugins installed.
|
||||
```
|
||||
FROM netboxcommunity/netbox:latest
|
||||
|
||||
copy ./plugin_requirements.txt /
|
||||
RUN pip install --no-warn-script-location -r /plugin_requirements.txt
|
||||
```
|
||||
> 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.yml`, as its name implies, can contain configuration overrides for existing services or entirely new services.
|
||||
```
|
||||
version: '3.4'
|
||||
services:
|
||||
nginx:
|
||||
ports:
|
||||
- 8000:8080
|
||||
netbox:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-Plugins
|
||||
image: netbox:latest-plugins
|
||||
netbox-worker:
|
||||
image: netbox:latest-plugins
|
||||
```
|
||||
This configuration will change the ports `NGINX` 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
|
||||
To build and deploy this in docker two commands are required.
|
||||
```
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user