From 3b3a6d63d43b142f717af6cc170f9da376396c0f Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:32:08 +0200 Subject: [PATCH 1/6] Update and rename README.rst to README.md --- README.rst => README.md | 103 +++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 48 deletions(-) rename README.rst => README.md (74%) diff --git a/README.rst b/README.md similarity index 74% rename from README.rst rename to README.md index e2dd5d7..e5b32e4 100644 --- a/README.rst +++ b/README.md @@ -1,26 +1,29 @@ -Software Lifecycle Management ------------------------------ +

NetBox SLM

-*Netbox Plugin for lifecycle management of software components, including versions and installations* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +

Netbox SLM is a plugin for lifecycle management of software components, including versions and installations.

--------------- +
+PyPi +Stars Badge +Forks Badge +Pull Requests Badge +Issues Badge +GitHub contributors +License Badge +
+ + +## Known Issues -Known Issues -~~~~~~~~~~~~~~~~~~ - WARNING: This plugin is only tested with Netbox 3.2 at this time. - CSV/Bulk imports for SoftwareProduct, Version and Installation are currently broken (WIP) -Installation Guide -~~~~~~~~~~~~~~~~~~ +## Installation Guide -When using the Docker version of Netbox, first follow the `netbox-docker -quickstart `__ -instructions to clone the netbox-docker repo and set up the -``docker-compose.override.yml``. +When using the Docker version of Netbox, first follow the netbox-docker [quickstart](https://github.com/netbox-community/netbox-docker#quickstart) instructions to clone the netbox-docker repo and set up the ``docker-compose.override.yml``. -Next, follow these instructions (based on the `Netbox docker variant -instructions `__) +Next, follow these instructions (based on the Netbox docker variant +[instructions](https://github.com/netbox-community/netbox-docker/wiki/Configuration#custom-configuration-files)) to install the Netbox SLM plugin: 1. Add ``netbox_slm`` to the ``PLUGINS`` list in @@ -29,17 +32,16 @@ to install the Netbox SLM plugin: contents. 3. Create a ``Dockerfile-SLM`` with contents: -.. code:: dockerfile - + ``` FROM netboxcommunity/netbox:v3.2.X COPY ./plugin_requirements.txt / RUN /opt/netbox/venv/bin/pip install --no-warn-script-location -r /plugin_requirements.txt + ``` 4. Create a ``docker-compose.override.yml`` with contents: -.. code:: yaml - + ``` version: '3.4' services: netbox: @@ -53,24 +55,24 @@ to install the Netbox SLM plugin: image: netbox:slm netbox-housekeeping: image: netbox:slm + ``` Now, build the image: ``docker compose build --no-cache`` And finally, run Netbox with the SLM plugin: ``docker compose up`` -Releasing Guide -~~~~~~~~~~~~~~~ +## Releasing Guide To draft a release; update the setup.py file to reflect the new version, then from the *src* directory run -:: - + ``` # make sure to update the version in netbox_slm/__init__.py $ python setup.py sdist $ twine upload dist/* + ``` On Github.com create a similar tag and version. These steps could be automated with a github workflow. @@ -78,77 +80,82 @@ automated with a github workflow. n.b. Currently the plugin is configured to use a personal pypi account, this should be changed. -Developer Guide (local installation) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +## Developer Guide (local installation) *Follow the steps below on your local system to run netbox and the netbox_slm plugin in developer mode* -Setup -~~~~~ +### Setup The goal below is to run all Netbox components in Docker and run a local Netbox Django copy with auto-reload to develop the plugin pointing to the Dockerized postgres and redis instances, basically ignoring the netbox docker runtime server. -Steps -~~~~~ - -:: +### Steps from your projects directory clone the netbox repository + ``` $ git clone https://github.com/netbox-community/netbox $ cd netbox - + ``` + install the virtual environment - + + ``` $ pipenv shell $ pipenv install + ``` create and edit netbox/configuration.py (based on the template file) add these lines at the end of the file; - + + ``` DEBUG = True SECRET_KEY = 'dummy' DEVELOPER = True PLUGINS = [ 'netbox_slm', ] + ``` The Netbox installation above will be used to run Django management commands like runserver, makemigrations and migrate, which will be explained in the next steps below; -:: - from your projects directory clone the netbox-slm repository + ``` $ git clone https://github.com/ICTU/netbox_slm $ cd netbox_slm $ ./start-netbox.sh - + ``` + This will start Netbox locally (requires Docker) and forward the redis and postgres ports to the localhost (make sure there’s no processes using these ports or change the dockerfiles accordingly) Note, you can also start and stop netbox by hand: -:: - + ``` $ cd netbox-docker $ docker-compose up -d - + ``` + or stop the stack with + ``` $ docker-compose down - + ``` + # to start fresh: + ``` $ docker-compose down $ docker volume rm netbox-docker_netbox-postgres-data # et cetera $ docker-compose up -d --force-recreate - + ``` + this will require you to re-run the migrate commando's for netbox-slm, see further down below Go back to the netbox configuration.py file and update the postgres and @@ -156,8 +163,7 @@ redis connection strings (username, password) to the ones the netbox docker backend is using, for example (using default user and passwords from the netbox docker example): -:: - + ``` <> # PostgreSQL database configuration. See the Django documentation for a complete list of available parameters: @@ -204,15 +210,16 @@ from the netbox docker example): } <> - + ``` + Now you can run commands from the netbox repository like this; -:: - + ``` $ cd netbox/netbox $ export PYTHONPATH=../../netbox_slm/netbox_slm/ # or with the pipenv activated run `python3 setup.py develop` from the netbox_slm directory $ python3 manage.py migrate netbox_slm $ python3 manage.py runserver 8001 - + ``` + Visit http://127.0.0.1:8001 in the browser to see the auto reloading version of the netbox UI. Port 8000 is taken by the docker ran variant. From 4f8053c0f678c16131ea5e83a2f671d81190dcb2 Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:32:20 +0200 Subject: [PATCH 2/6] Rename LICENSE to LICENSE.md --- LICENSE => LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename LICENSE => LICENSE.md (94%) diff --git a/LICENSE b/LICENSE.md similarity index 94% rename from LICENSE rename to LICENSE.md index 0cb5a76..d7865bc 100644 --- a/LICENSE +++ b/LICENSE.md @@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. From a1f6e3dc92fd0b87b5527da9b6835c959921d1bf Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:37:11 +0200 Subject: [PATCH 3/6] Create LICENSE --- LICENSE | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7a3c89b --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2022 ICTU + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. From a8c9fc5fbea036dce5e0edc9daa180a06cd237d9 Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:37:18 +0200 Subject: [PATCH 4/6] Delete LICENSE.md --- LICENSE.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index d7865bc..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2022 ICTU - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. From c9a7b2315e5fa78fda5c97ec02d77dbad62cb8b2 Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:37:36 +0200 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5b32e4..362b691 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Pull Requests Badge Issues Badge GitHub contributors -License Badge +License Badge From f914e78812ffc3461420ef228503d5a30f3351c1 Mon Sep 17 00:00:00 2001 From: Hedde van der Heide Date: Mon, 2 May 2022 12:39:47 +0200 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 362b691..bb5f694 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,6 @@ Now you can run commands from the netbox repository like this; $ python3 manage.py migrate netbox_slm $ python3 manage.py runserver 8001 ``` - + Visit http://127.0.0.1:8001 in the browser to see the auto reloading version of the netbox UI. Port 8000 is taken by the docker ran variant.