From 8642d1919ab536a05fe155dbfe4acc2e4e4185aa Mon Sep 17 00:00:00 2001 From: Per von Zweigbergk Date: Wed, 16 Aug 2023 08:00:35 +0200 Subject: [PATCH] Add plugin examples to the repo, and adjust .gitignore to avoid checking in local configuration --- .gitignore | 3 ++- Dockerfile-Plugins | 11 +++++++++++ configuration/plugins.py | 13 ------------- configuration/plugins.py.example | 8 ++++++++ docker-compose.override.yml.plugin-example | 20 ++++++++++++++++++++ plugin_requirements.txt.example | 2 ++ 6 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 Dockerfile-Plugins delete mode 100644 configuration/plugins.py create mode 100644 configuration/plugins.py.example create mode 100644 docker-compose.override.yml.plugin-example create mode 100644 plugin_requirements.txt.example diff --git a/.gitignore b/.gitignore index 9a5e13a..28e70bb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ configuration/ldap/* !configuration/ldap/extra.py !configuration/ldap/ldap_config.py !configuration/logging.py -!configuration/plugins.py +!configuration/plugins.py.example prometheus.yml super-linter.log +plugin_requirements.txt \ No newline at end of file diff --git a/Dockerfile-Plugins b/Dockerfile-Plugins new file mode 100644 index 0000000..7250d7a --- /dev/null +++ b/Dockerfile-Plugins @@ -0,0 +1,11 @@ +# See: https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins +FROM netboxcommunity/netbox:latest + +COPY ./plugin_requirements.txt /opt/netbox/ +RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /opt/netbox/plugin_requirements.txt + +# These lines are only required if your plugin has its own static files. +COPY configuration/configuration.py /etc/netbox/config/configuration.py +COPY configuration/plugins.py /etc/netbox/config/plugins.py +# NOTE: This SECRET_KEY is only used during the installation. There's no need to change it. +RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input \ No newline at end of file diff --git a/configuration/plugins.py b/configuration/plugins.py deleted file mode 100644 index c0b1a1f..0000000 --- a/configuration/plugins.py +++ /dev/null @@ -1,13 +0,0 @@ -# Add your plugins and plugin settings here. -# Of course uncomment this file out. - -# To learn how to build images with your required plugins -# See https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins - -# PLUGINS = ["netbox_bgp"] - -# PLUGINS_CONFIG = { -# "netbox_bgp": { -# ADD YOUR SETTINGS HERE -# } -# } diff --git a/configuration/plugins.py.example b/configuration/plugins.py.example new file mode 100644 index 0000000..68ac8b3 --- /dev/null +++ b/configuration/plugins.py.example @@ -0,0 +1,8 @@ +# See: https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins +PLUGINS = ["netbox_secrets"] + +# PLUGINS_CONFIG = { +# "netbox_secretstore": { +# ADD YOUR SETTINGS HERE +# } +# } \ No newline at end of file diff --git a/docker-compose.override.yml.plugin-example b/docker-compose.override.yml.plugin-example new file mode 100644 index 0000000..b5ec60c --- /dev/null +++ b/docker-compose.override.yml.plugin-example @@ -0,0 +1,20 @@ +# See: https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins +version: '3.4' # This is NOT the version of NetBox! No need to adjust :) +services: + netbox: + image: netbox:latest-plugins + ports: + - 8000:8080 + build: + context: . + dockerfile: Dockerfile-Plugins + netbox-worker: + image: netbox:latest-plugins + build: + context: . + dockerfile: Dockerfile-Plugins + netbox-housekeeping: + image: netbox:latest-plugins + build: + context: . + dockerfile: Dockerfile-Plugins \ No newline at end of file diff --git a/plugin_requirements.txt.example b/plugin_requirements.txt.example new file mode 100644 index 0000000..5ce112e --- /dev/null +++ b/plugin_requirements.txt.example @@ -0,0 +1,2 @@ +# See: https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins +netbox-secrets \ No newline at end of file