Package: netbox-docker-plugin
Netbox Docker PluginManage Docker with Netbox & style. Made to work withnetbox-docker-agent.How does it work?sequenceDiagram
    Netbox->>Agent: Change (Webhook)
    Agent->>Docker API: Request (HTTP)
    Docker API->>Agent: Response (HTTP)
    Agent->>Netbox: Feedback (Callback)Once the plugin and webhooks are installed, you can:Create hosts that point toagentsyou had installedRetrieve informations from Docker API with the help of the agentCreate containers on host with an image, expose ports, add env variables and
labels, mount volumes, set networks.Manage the container status, start, stop, restart.InstallationYou can followthe official plugins installation
instructions.If needed, source your Netbox's virtual environment and install the plugin like
a package. We assumeyou have already installed
Netboxand its source code are
in/opt/netbox:cd/opt/netbox
python3-mvenvvenv# if virtual env was not created beforesource/opt/netbox/venv/bin/activate
pipinstallnetbox-docker-pluginEnable the plugin in the/opt/netbox/netbox/netbox/configuration.pyfile:PLUGINS=['netbox_docker_plugin',]Then, run migrations:cd/opt/netbox
python3netbox/manage.pymigrate[!IMPORTANT]
In order to the communication between your Netbox instance andthe Agentworks, the plugin will check if webhooks to agents are
presents on each migration phase.
If not, then the plugin will automatically install webhooks configuration in
your Netbox instance.AlternativeAnother way to install Netbox is to use theOfficial netbox-docker
project.With this alternate way, you cancustomize your Netbox imageand migrations will be
automatically execute each time you restart the container.ContributeInstall our development environmentRequirements:Python 3.11PostgreSQL 15Official Netbox docuser: netbox (with database creation right)password: secretdatabase: netboxport: 5432Redis 7.2port: 6379Set a PROJECT variable :PROJECT="/project/netbox"Create a project directory$PROJECT:mkdir$PROJECTGo inside your project directory, clone this repository and the Netbox repository:cd$PROJECTgitclonegit@github.com:SaaShup/netbox-docker-plugin.git
gitclonegit@github.com:netbox-community/netbox.gitCreate your venv and activate it:python-mvenvvenvsourcevenv/bin/activateInstall netbox-docker-plugin dependencies:cd$PROJECT/netbox-docker-plugin
pipinstall-e.Configure Netbox and install Netbox dependencies:cd$PROJECT/netbox
cp$PROJECT/netbox-docker-plugin/netbox_configuration/configuration_dev.py$PROJECT/netbox/netbox/netbox/configuration.py
pipinstall-rrequirements.txtRun database migrations:cd$PROJECT/netbox
python3netbox/manage.pymigrateCreate a Netbox super user:cd$PROJECT/netbox
python3netbox/manage.pycreatesuperuserStart Netbox instance:cd$PROJECT/netbox
python3netbox/manage.pyrunserver0.0.0.0:8000--insecureVisithttp://localhost:8000/Run testsAfter installing you development environment, you can run the tests plugin (you don't need to start the Netbox instance):cd$PROJECT/netbox
python3netbox/manage.pytestnetbox_docker_plugin.tests--keepdb-v2With code coverage, installcoverage.pyand use it:cd$PROJECT/netbox
python3-mpipinstallcoverageThe run the test with coverage.py and print the report:cd$PROJECT/netbox
coveragerun--include='*/netbox_docker_plugin/*'netbox/manage.pytestnetbox_docker_plugin.tests--keepdb-v2coveragereport-mHostingCheckhttps://saashup.comfor more information.