# NetBox SLM
NetBox SLM is a plugin for lifecycle management of software components, including versions and installations.
## Known Issues - WARNING: This plugin is only tested with a single NetBox version at this time. - CSV/Bulk imports for SoftwareProduct, Version and Installation are currently broken (WIP) ## Installation Guide 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` repository and set up the ``docker-compose.override.yml``. 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 ``configuration/plugins.py``. 2. Create a ``plugin_requirements.txt`` with ``netbox-slm`` as contents. 3. Create a ``Dockerfile-SLM`` with contents: ``` FROM netboxcommunity/netbox:vX.Y.Z 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: ``` version: '3.7' services: netbox: ports: - 8000:8080 build: context: . dockerfile: Dockerfile-SLM image: netbox:slm netbox-worker: 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 To draft a release; update the `netbox_slm/__init__.py` file to reflect the new version, then from the *src* directory run ``` $ python -m build $ twine upload dist/* ``` On GitHub create a similar tag and version. ## Developer Guide (local installation) *Follow the steps below on your local system to run NetBox and the `netbox_slm` plugin in developer mode* ### 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 PostgreSQL and Redis container instances, basically ignoring the NetBox docker runtime server. ### 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' 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 PostgreSQL ports to the localhost (make sure there’s no processes using these ports or change the Dockerfile(s) 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 PostgreSQL and 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): ``` <