{"id":22170225,"url":"https://github.com/saashup/netbox-docker-plugin","last_synced_at":"2025-04-05T09:04:57.403Z","repository":{"id":218731121,"uuid":"700582090","full_name":"SaaShup/netbox-docker-plugin","owner":"SaaShup","description":"Netbox Docker Plugin","archived":false,"fork":false,"pushed_at":"2024-12-17T15:23:27.000Z","size":587,"stargazers_count":64,"open_issues_count":22,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-04T06:09:34.005Z","etag":null,"topics":["docker","netbox","netbox-plugin","plugin"],"latest_commit_sha":null,"homepage":"https://saashup.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SaaShup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-04T21:43:28.000Z","updated_at":"2025-03-17T09:13:12.000Z","dependencies_parsed_at":"2024-03-14T10:25:31.736Z","dependency_job_id":"fdba4a0b-a2a7-4139-bb39-9292356ec9ae","html_url":"https://github.com/SaaShup/netbox-docker-plugin","commit_stats":null,"previous_names":["saashup/netbox-docker-plugin"],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaaShup%2Fnetbox-docker-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaaShup%2Fnetbox-docker-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaaShup%2Fnetbox-docker-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaaShup%2Fnetbox-docker-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SaaShup","download_url":"https://codeload.github.com/SaaShup/netbox-docker-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","netbox","netbox-plugin","plugin"],"created_at":"2024-12-02T06:39:40.065Z","updated_at":"2025-04-05T09:04:57.320Z","avatar_url":"https://github.com/SaaShup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Netbox Docker Plugin\n\n[![Testing Report](https://github.com/SaaShup/netbox-docker-plugin/actions/workflows/main_ci.yml/badge.svg)](https://github.com/SaaShup/netbox-docker-plugin/actions/workflows/main_ci.yml)\n\nManage Docker with Netbox \u0026 style. Made to work with [netbox-docker-agent](https://github.com/SaaShup/netbox-docker-agent).\n\n![UI Container view with dependencies](/docs/assets/screenshot.png)\n\n## How does it work?\n\n```mermaid\nsequenceDiagram\n    Netbox-\u003e\u003eAgent: Change (Webhook)\n    Agent-\u003e\u003eDocker API: Request (HTTP)\n    Docker API-\u003e\u003eAgent: Response (HTTP)\n    Agent-\u003e\u003eNetbox: Feedback (Callback)\n```\n\nOnce the plugin and webhooks are installed, you can:\n\n1. Create hosts that point to\n   [agents](https://github.com/SaaShup/netbox-docker-agent) you had installed *\n2. Retrieve informations from Docker API with the help of the agent\n3. Create containers on host with an image, expose ports, add env variables and\n   labels, mount volumes, set networks.\n4. Manage the container status, start, stop, restart.\n\n* adding a host with curl needs a specific **Origin** header to make it working. Example : \n```\ncurl -X POST -H \"Authorization: Token xxxxx\" -H \"Content-Type: application/json\" -H \"Origin: https://myhost\" https://myhost/api/plugins/docker/hosts/ -d '{\"name\": \"test-add\", \"endpoint\": \"[https://xxxx:xxxx@test.com:1990\"}](https://xxxx:xxxx@test.com:1990%22%7D)'\n```\n\n## Installation\n\nBelow the compatibility list of the Netbox Docker PLugin and Netbox. Please chose the right version of the plugin depending of the Netbox version you use:\n\n| Netbox Version | Netbox Docker Plugin Version |\n| -------------- | ---------------------------- |\n| 3.\\*           | 1.\\*                         |\n| 4.0.\\*         | 2.\\*                         |\n| 4.1.\\*         | 3.\\*                         |\n\nYou can follow [the official plugins installation\ninstructions](https://docs.netbox.dev/en/stable/plugins/#installing-plugins).\n\nIf needed, source your Netbox's virtual environment and install the plugin like\na package. We assume [you have already installed\nNetbox](https://docs.netbox.dev/en/stable/installation/) and its source code are\nin `/opt/netbox`:\n\n```bash\ncd /opt/netbox\npython3 -m venv venv # if virtual env was not created before\nsource /opt/netbox/venv/bin/activate\npip install netbox-docker-plugin\n```\n\nEnable the plugin in the `/opt/netbox/netbox/netbox/configuration.py` file:\n\n```python\nPLUGINS = [\n    'netbox_docker_plugin',\n]\n```\n\nThen, run migrations:\n\n```bash\ncd /opt/netbox\npython3 netbox/manage.py migrate\n```\n\n\u003e [!IMPORTANT]\n\u003e In order to the communication between your Netbox instance and [the Agent](https://github.com/SaaShup/netbox-docker-agent)\n\u003e works, the plugin will check if webhooks to agents are\n\u003e presents on each migration phase.\n\u003e If not, then the plugin will automatically install webhooks configuration in\n\u003e your Netbox instance.\n\n### Alternative\n\nAnother way to install Netbox is to use the [Official netbox-docker\nproject](https://github.com/netbox-community/netbox-docker).\n\nWith this alternate way, you can [customize your Netbox image](https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins) and migrations will be\nautomatically execute each time you restart the container.\n\n## Contribute\n\n### Install our development environment\n\nRequirements:\n* Python 3.11\n* PostgreSQL 15 [Official Netbox doc](https://github.com/netbox-community/netbox/blob/master/docs/installation/1-postgresql.md)\n  - user: netbox (with database creation right)\n  - password: secret\n  - database: netbox\n  - port: 5432\n* Redis 7.2\n  - port: 6379\n\nSet a PROJECT variable :\n\n```\nPROJECT=\"/project/netbox\"\n```\n\nCreate a project directory `$PROJECT`:\n\n```bash\nmkdir $PROJECT\n```\n\nGo inside your project directory, clone this repository and the Netbox repository:\n\n```bash\ncd $PROJECT\ngit clone git@github.com:SaaShup/netbox-docker-plugin.git\ngit clone git@github.com:netbox-community/netbox.git\n```\n\nCreate your venv and activate it:\n\n```bash\npython -m venv venv\nsource venv/bin/activate\n```\n\nInstall netbox-docker-plugin dependencies:\n\n```bash\ncd $PROJECT/netbox-docker-plugin\npip install -e .\n```\n\nConfigure Netbox and install Netbox dependencies:\n\n```bash\ncd $PROJECT/netbox\ncp $PROJECT/netbox-docker-plugin/netbox_configuration/configuration_dev.py $PROJECT/netbox/netbox/netbox/configuration.py\npip install -r requirements.txt\n```\n\nRun database migrations:\n\n```bash\ncd $PROJECT/netbox\npython3 netbox/manage.py migrate\n```\n\nCreate a Netbox super user:\n\n```bash\ncd $PROJECT/netbox\npython3 netbox/manage.py createsuperuser\n```\n\nStart Netbox instance:\n\n```bash\ncd $PROJECT/netbox\npython3 netbox/manage.py runserver 0.0.0.0:8000 --insecure\n```\n\nVisit http://localhost:8000/\n\n### Run tests\n\nAfter installing your development environment, you can run the tests plugin\n(you don't need to start the Netbox instance):\n\n```bash\ncd $PROJECT/netbox\npython3 -m pip install requests_mock\npython3 netbox/manage.py test netbox_docker_plugin.tests --keepdb -v 2\n```\n\nWith code coverage, install [coverage.py](https://coverage.readthedocs.io/en/7.3.2/) and use it:\n\n```bash\ncd $PROJECT/netbox\npython3 -m pip install coverage\n```\n\nThen run the test with coverage.py and print the report:\n\n```bash\ncd $PROJECT/netbox\ncoverage run --include='*/netbox_docker_plugin/*' netbox/manage.py test netbox_docker_plugin.tests --keepdb -v 2\ncoverage report -m\n```\n\n# Hosting\n\nCheck https://saashup.com for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaashup%2Fnetbox-docker-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaashup%2Fnetbox-docker-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaashup%2Fnetbox-docker-plugin/lists"}