From b05905590a79b3869e93dd72adb9a5caa4d5322c Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 12:39:09 +0000 Subject: [PATCH 01/12] feat(netbox): add Dockerfile for NetBox with plugins --- images/netbox/Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 images/netbox/Dockerfile diff --git a/images/netbox/Dockerfile b/images/netbox/Dockerfile new file mode 100644 index 0000000..c1edc78 --- /dev/null +++ b/images/netbox/Dockerfile @@ -0,0 +1,26 @@ +# ============================================================================= +# NetBox Docker Image with Plugins +# +# Image NetBox personnalisée avec plugins pré-installés +# Basée sur l'image officielle netboxcommunity/netbox +# ============================================================================= + +ARG NETBOX_VERSION=latest +FROM netboxcommunity/netbox:${NETBOX_VERSION} + +LABEL maintainer="Damien Arnodo" +LABEL description="NetBox with pre-installed plugins for homelab use" + +# Copie du fichier de requirements des plugins +COPY plugin_requirements.txt /opt/netbox/ + +# Installation des plugins via uv pip (méthode officielle NetBox Docker) +RUN /usr/local/bin/uv pip install --no-cache -r /opt/netbox/plugin_requirements.txt + +# Copie de la configuration des plugins +COPY plugins.py /etc/netbox/config/plugins.py + +# Collecte des assets statiques des plugins +# Nécessite une SECRET_KEY dummy pour le build +RUN SECRET_KEY="build-time-dummy-key-not-used-in-production" \ + /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input -- 2.52.0 From b31055f9441fa10385adb25b8f9a4eca409e6238 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 12:39:18 +0000 Subject: [PATCH 02/12] feat(netbox): add plugin requirements file --- images/netbox/plugin_requirements.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 images/netbox/plugin_requirements.txt diff --git a/images/netbox/plugin_requirements.txt b/images/netbox/plugin_requirements.txt new file mode 100644 index 0000000..8aa58c8 --- /dev/null +++ b/images/netbox/plugin_requirements.txt @@ -0,0 +1,24 @@ +# ============================================================================= +# NetBox Plugins Requirements +# ============================================================================= +# Liste des plugins à installer dans l'image NetBox +# Format: nom-du-package==version (ou sans version pour la dernière) +# +# Documentation des plugins populaires: +# - netbox-secrets: Gestion des secrets (remplace netbox-secretstore pour NetBox >= 3.5) +# - netbox-topology-views: Visualisation de topologie réseau +# - netbox-bgp: Gestion des sessions BGP +# - netbox-documents: Gestion de documents +# - netbox-acls: Gestion des ACLs +# - netbox-qrcode: Génération de QR codes +# - netbox-proxbox: Intégration Proxmox (utile pour ton homelab!) +# ============================================================================= + +# Plugins actifs - décommente ceux dont tu as besoin +netbox-secrets +netbox-topology-views +# netbox-bgp +# netbox-documents +# netbox-acls +# netbox-qrcode +# netbox-proxbox -- 2.52.0 From 3d048c0d99169c46c2c02939c765476d638141d5 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 12:39:31 +0000 Subject: [PATCH 03/12] feat(netbox): add plugins configuration file --- images/netbox/plugins.py | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 images/netbox/plugins.py diff --git a/images/netbox/plugins.py b/images/netbox/plugins.py new file mode 100644 index 0000000..2be1b4d --- /dev/null +++ b/images/netbox/plugins.py @@ -0,0 +1,47 @@ +# ============================================================================= +# NetBox Plugins Configuration +# ============================================================================= +# Ce fichier est copié dans /etc/netbox/config/plugins.py +# Il active et configure les plugins installés +# ============================================================================= + +# Liste des plugins activés +# Doit correspondre aux packages installés dans plugin_requirements.txt +PLUGINS = [ + "netbox_secrets", + "netbox_topology_views", + # "netbox_bgp", + # "netbox_documents", + # "netbox_acls", + # "netbox_qrcode", + # "netbox_proxbox", +] + +# Configuration des plugins +PLUGINS_CONFIG = { + "netbox_secrets": { + # Configuration par défaut, personnalise si nécessaire + # "public_key_size": 4096, + }, + "netbox_topology_views": { + # Configuration par défaut + # "static_image_directory": "netbox_topology_views/img", + # "allow_coordinates_saving": True, + # "always_save_coordinates": False, + }, + # "netbox_bgp": { + # # Ajoute ta configuration ici + # }, + # "netbox_proxbox": { + # "proxmox": [ + # { + # "domain": "proxmox.example.com", + # "http_port": 8006, + # "user": "root@pam", + # "password": "your-password", + # "ssl": True, + # "node": "pve", + # } + # ], + # }, +} -- 2.52.0 From 8ab22a1e662571e53edc49ca338bf4b548eb636b Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 12:39:51 +0000 Subject: [PATCH 04/12] docs(netbox): add README with usage instructions --- images/netbox/README.md | 109 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 images/netbox/README.md diff --git a/images/netbox/README.md b/images/netbox/README.md new file mode 100644 index 0000000..2fb006a --- /dev/null +++ b/images/netbox/README.md @@ -0,0 +1,109 @@ +# NetBox Docker Image avec Plugins + +Image Docker NetBox personnalisée avec plugins pré-installés, construite automatiquement via Gitea Actions. + +## Plugins inclus + +Par défaut, les plugins suivants sont installés : + +| Plugin | Description | Activé | +|--------|-------------|--------| +| `netbox-secrets` | Gestion sécurisée des secrets et mots de passe | ✅ | +| `netbox-topology-views` | Visualisation de topologie réseau | ✅ | +| `netbox-bgp` | Gestion des sessions BGP | ❌ | +| `netbox-documents` | Gestion de documents attachés | ❌ | +| `netbox-acls` | Gestion des Access Control Lists | ❌ | +| `netbox-qrcode` | Génération de QR codes pour les équipements | ❌ | +| `netbox-proxbox` | Intégration avec Proxmox VE | ❌ | + +## Utilisation + +### Pull depuis le registry + +```bash +docker pull gitea.arnodo.fr/damien/netbox:latest +``` + +### Avec Docker Compose + +Créer un `docker-compose.override.yml` pour utiliser l'image personnalisée : + +```yaml +services: + netbox: + image: gitea.arnodo.fr/damien/netbox:latest + pull_policy: always + netbox-worker: + image: gitea.arnodo.fr/damien/netbox:latest + pull_policy: always + netbox-housekeeping: + image: gitea.arnodo.fr/damien/netbox:latest + pull_policy: always +``` + +## Personnalisation des plugins + +### Ajouter un plugin + +1. Éditer `plugin_requirements.txt` et ajouter le package PyPI +2. Éditer `plugins.py` et ajouter le plugin à la liste `PLUGINS` +3. Configurer le plugin dans `PLUGINS_CONFIG` si nécessaire +4. Commit et push - l'image sera rebuild automatiquement + +### Exemple : Activer netbox-proxbox + +```python +# plugin_requirements.txt +netbox-proxbox + +# plugins.py +PLUGINS = [ + "netbox_secrets", + "netbox_topology_views", + "netbox_proxbox", # Ajouter ici +] + +PLUGINS_CONFIG = { + # ... + "netbox_proxbox": { + "proxmox": [ + { + "domain": "proxmox.home.arpa", + "http_port": 8006, + "user": "netbox@pve", + "password": "your-api-token", + "ssl": True, + "node": "pve", + } + ], + }, +} +``` + +## Build arguments + +| Argument | Description | Défaut | +|----------|-------------|--------| +| `NETBOX_VERSION` | Version de l'image NetBox de base | `latest` | + +### Builder une version spécifique + +```bash +docker build --build-arg NETBOX_VERSION=v4.1.0 -t netbox:v4.1.0-plugins . +``` + +## Structure des fichiers + +``` +images/netbox/ +├── Dockerfile # Image principale +├── plugin_requirements.txt # Liste des plugins PyPI +├── plugins.py # Configuration des plugins +└── README.md # Cette documentation +``` + +## Notes + +- L'image utilise `uv pip` pour l'installation des plugins (méthode officielle NetBox Docker) +- Les assets statiques sont collectés au build pour les plugins qui en ont +- Compatible avec NetBox >= 3.5 -- 2.52.0 From b05aada9420925ee3f4e10fa5cf2ff707bfd2c31 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:25:33 +0000 Subject: [PATCH 05/12] feat(netbox): add netbox-branching and netbox-bgp plugins --- images/netbox/plugin_requirements.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/images/netbox/plugin_requirements.txt b/images/netbox/plugin_requirements.txt index 8aa58c8..d45aeda 100644 --- a/images/netbox/plugin_requirements.txt +++ b/images/netbox/plugin_requirements.txt @@ -4,20 +4,26 @@ # Liste des plugins à installer dans l'image NetBox # Format: nom-du-package==version (ou sans version pour la dernière) # -# Documentation des plugins populaires: +# Documentation des plugins: +# - netbox-branching: Branching et change management (NetBox Labs) +# https://github.com/netboxlabs/netbox-branching +# - netbox-bgp: Gestion des sessions BGP, peers, communities +# https://github.com/netbox-community/netbox-bgp # - netbox-secrets: Gestion des secrets (remplace netbox-secretstore pour NetBox >= 3.5) # - netbox-topology-views: Visualisation de topologie réseau -# - netbox-bgp: Gestion des sessions BGP # - netbox-documents: Gestion de documents # - netbox-acls: Gestion des ACLs # - netbox-qrcode: Génération de QR codes -# - netbox-proxbox: Intégration Proxmox (utile pour ton homelab!) +# - netbox-proxbox: Intégration Proxmox # ============================================================================= -# Plugins actifs - décommente ceux dont tu as besoin +# Plugins actifs +netbox-branching +netbox-bgp netbox-secrets netbox-topology-views -# netbox-bgp + +# Plugins disponibles - décommente ceux dont tu as besoin # netbox-documents # netbox-acls # netbox-qrcode -- 2.52.0 From c5918161485de9e33bb2750aeba3fc9dd29b1304 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:25:45 +0000 Subject: [PATCH 06/12] feat(netbox): configure netbox-branching and netbox-bgp --- images/netbox/plugins.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/images/netbox/plugins.py b/images/netbox/plugins.py index 2be1b4d..5a681b7 100644 --- a/images/netbox/plugins.py +++ b/images/netbox/plugins.py @@ -8,9 +8,10 @@ # Liste des plugins activés # Doit correspondre aux packages installés dans plugin_requirements.txt PLUGINS = [ + "netbox_branching", + "netbox_bgp", "netbox_secrets", "netbox_topology_views", - # "netbox_bgp", # "netbox_documents", # "netbox_acls", # "netbox_qrcode", @@ -19,8 +20,17 @@ PLUGINS = [ # Configuration des plugins PLUGINS_CONFIG = { + "netbox_branching": { + # Configuration par défaut + # Voir: https://github.com/netboxlabs/netbox-branching#configuration + }, + "netbox_bgp": { + # Configuration par défaut + # "top_level_menu": True, # Ajoute un menu BGP au niveau supérieur + # "asdot": False, # Utilise la notation ASPLAIN par défaut + }, "netbox_secrets": { - # Configuration par défaut, personnalise si nécessaire + # Configuration par défaut # "public_key_size": 4096, }, "netbox_topology_views": { @@ -29,9 +39,6 @@ PLUGINS_CONFIG = { # "allow_coordinates_saving": True, # "always_save_coordinates": False, }, - # "netbox_bgp": { - # # Ajoute ta configuration ici - # }, # "netbox_proxbox": { # "proxmox": [ # { -- 2.52.0 From 6809982d3d11d6902488dd5ec8a0727a2824ac29 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:26:12 +0000 Subject: [PATCH 07/12] docs(netbox): update README with branching and bgp plugins --- images/netbox/README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/images/netbox/README.md b/images/netbox/README.md index 2fb006a..871d459 100644 --- a/images/netbox/README.md +++ b/images/netbox/README.md @@ -8,9 +8,10 @@ Par défaut, les plugins suivants sont installés : | Plugin | Description | Activé | |--------|-------------|--------| +| `netbox-branching` | Branching et change management (NetBox Labs) | ✅ | +| `netbox-bgp` | Gestion des sessions BGP, peers, communities | ✅ | | `netbox-secrets` | Gestion sécurisée des secrets et mots de passe | ✅ | | `netbox-topology-views` | Visualisation de topologie réseau | ✅ | -| `netbox-bgp` | Gestion des sessions BGP | ❌ | | `netbox-documents` | Gestion de documents attachés | ❌ | | `netbox-acls` | Gestion des Access Control Lists | ❌ | | `netbox-qrcode` | Génération de QR codes pour les équipements | ❌ | @@ -58,6 +59,8 @@ netbox-proxbox # plugins.py PLUGINS = [ + "netbox_branching", + "netbox_bgp", "netbox_secrets", "netbox_topology_views", "netbox_proxbox", # Ajouter ici @@ -102,8 +105,18 @@ images/netbox/ └── README.md # Cette documentation ``` +## Plugins - Liens et documentation + +- **netbox-branching** : https://github.com/netboxlabs/netbox-branching + - Permet de créer des branches pour tester des changements avant de les appliquer + - Idéal pour le change management et les workflows de validation + +- **netbox-bgp** : https://github.com/netbox-community/netbox-bgp + - Gestion complète BGP : sessions, peers, communities, prefix-lists + - Parfait pour documenter ton infrastructure réseau Arista + ## Notes - L'image utilise `uv pip` pour l'installation des plugins (méthode officielle NetBox Docker) - Les assets statiques sont collectés au build pour les plugins qui en ont -- Compatible avec NetBox >= 3.5 +- Compatible avec NetBox >= 4.0 (netbox-branching requiert NetBox 4.0+) -- 2.52.0 From 526a488abae653e0be24172a1e446cb36c186507 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:27:47 +0000 Subject: [PATCH 08/12] feat(netbox): add NETBOX_VERSION file for version tracking --- images/netbox/NETBOX_VERSION | 1 + 1 file changed, 1 insertion(+) create mode 100644 images/netbox/NETBOX_VERSION diff --git a/images/netbox/NETBOX_VERSION b/images/netbox/NETBOX_VERSION new file mode 100644 index 0000000..2fa2c57 --- /dev/null +++ b/images/netbox/NETBOX_VERSION @@ -0,0 +1 @@ +v4.2 -- 2.52.0 From 75c68f57ef922bc73911cb5faa94577440b25e34 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:28:19 +0000 Subject: [PATCH 09/12] feat(ci): support version files for image tagging and build-args --- .gitea/workflows/build-images.yml | 42 ++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build-images.yml b/.gitea/workflows/build-images.yml index c76d7c6..5be09f4 100644 --- a/.gitea/workflows/build-images.yml +++ b/.gitea/workflows/build-images.yml @@ -89,11 +89,47 @@ jobs: fi echo "========================================" - echo "Building ${IMAGE_NAME}:latest" + echo "Building ${IMAGE_NAME}" echo "========================================" - docker build -t "${IMAGE_NAME}:latest" "${IMAGE_PATH}" - docker push "${IMAGE_NAME}:latest" + # Check for version file (format: _VERSION or VERSION) + VERSION="" + BUILD_ARGS="" + # Look for specific version file (e.g., NETBOX_VERSION, TERRAFORM_VERSION) + for version_file in "$IMAGE_PATH"/*_VERSION "$IMAGE_PATH"/VERSION; do + if [ -f "$version_file" ]; then + VERSION=$(cat "$version_file" | tr -d '[:space:]') + VERSION_NAME=$(basename "$version_file" | sed 's/_VERSION$//') + + if [ "$VERSION_NAME" = "VERSION" ]; then + # Generic VERSION file + echo "📌 Found VERSION file: $VERSION" + else + # Specific version file (e.g., NETBOX_VERSION) + echo "📌 Found ${VERSION_NAME}_VERSION file: $VERSION" + BUILD_ARGS="--build-arg ${VERSION_NAME}_VERSION=${VERSION}" + fi + break + fi + done + + # Build the image + if [ -n "$BUILD_ARGS" ]; then + echo "🔧 Building with args: $BUILD_ARGS" + docker build $BUILD_ARGS -t "${IMAGE_NAME}:latest" "$IMAGE_PATH" + else + docker build -t "${IMAGE_NAME}:latest" "$IMAGE_PATH" + fi + + # Push latest tag + docker push "${IMAGE_NAME}:latest" echo "✅ Pushed ${IMAGE_NAME}:latest" + + # Also tag and push with version if available + if [ -n "$VERSION" ]; then + docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:${VERSION}" + docker push "${IMAGE_NAME}:${VERSION}" + echo "✅ Pushed ${IMAGE_NAME}:${VERSION}" + fi done -- 2.52.0 From ee9b74ebe4be637398bef171fae1bc62f23fe05a Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:28:50 +0000 Subject: [PATCH 10/12] docs(netbox): document NETBOX_VERSION file and version tagging --- images/netbox/README.md | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/images/netbox/README.md b/images/netbox/README.md index 871d459..63f726c 100644 --- a/images/netbox/README.md +++ b/images/netbox/README.md @@ -22,7 +22,11 @@ Par défaut, les plugins suivants sont installés : ### Pull depuis le registry ```bash +# Dernière version docker pull gitea.arnodo.fr/damien/netbox:latest + +# Version spécifique +docker pull gitea.arnodo.fr/damien/netbox:v4.2 ``` ### Avec Docker Compose @@ -32,16 +36,33 @@ Créer un `docker-compose.override.yml` pour utiliser l'image personnalisée : ```yaml services: netbox: - image: gitea.arnodo.fr/damien/netbox:latest + image: gitea.arnodo.fr/damien/netbox:v4.2 pull_policy: always netbox-worker: - image: gitea.arnodo.fr/damien/netbox:latest + image: gitea.arnodo.fr/damien/netbox:v4.2 pull_policy: always netbox-housekeeping: - image: gitea.arnodo.fr/damien/netbox:latest + image: gitea.arnodo.fr/damien/netbox:v4.2 pull_policy: always ``` +## Gestion des versions + +La version de NetBox est définie dans le fichier `NETBOX_VERSION`. Pour changer de version : + +1. Modifier le fichier `NETBOX_VERSION` avec la version souhaitée (ex: `v4.2`) +2. Commit et push +3. Le CI va automatiquement : + - Builder l'image avec cette version de NetBox + - Tagger l'image avec `latest` ET avec la version (ex: `v4.2`) + +### Tags disponibles + +| Tag | Description | +|-----|-------------| +| `latest` | Dernière version buildée | +| `v4.2` | Version spécifique de NetBox | + ## Personnalisation des plugins ### Ajouter un plugin @@ -83,23 +104,12 @@ PLUGINS_CONFIG = { } ``` -## Build arguments - -| Argument | Description | Défaut | -|----------|-------------|--------| -| `NETBOX_VERSION` | Version de l'image NetBox de base | `latest` | - -### Builder une version spécifique - -```bash -docker build --build-arg NETBOX_VERSION=v4.1.0 -t netbox:v4.1.0-plugins . -``` - ## Structure des fichiers ``` images/netbox/ ├── Dockerfile # Image principale +├── NETBOX_VERSION # Version de NetBox à utiliser ├── plugin_requirements.txt # Liste des plugins PyPI ├── plugins.py # Configuration des plugins └── README.md # Cette documentation @@ -120,3 +130,4 @@ images/netbox/ - L'image utilise `uv pip` pour l'installation des plugins (méthode officielle NetBox Docker) - Les assets statiques sont collectés au build pour les plugins qui en ont - Compatible avec NetBox >= 4.0 (netbox-branching requiert NetBox 4.0+) +- Le fichier `NETBOX_VERSION` contrôle la version de base et le tag de l'image -- 2.52.0 From 14b4da71d1125c0ea515a454a6781bc1a9adbe34 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:31:48 +0000 Subject: [PATCH 11/12] Update images/netbox/NETBOX_VERSION --- images/netbox/NETBOX_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/netbox/NETBOX_VERSION b/images/netbox/NETBOX_VERSION index 2fa2c57..a7021c5 100644 --- a/images/netbox/NETBOX_VERSION +++ b/images/netbox/NETBOX_VERSION @@ -1 +1 @@ -v4.2 +v4.4 -- 2.52.0 From 167a3f1d0ea564ec682575d515379d20a889b01d Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Wed, 7 Jan 2026 13:33:57 +0000 Subject: [PATCH 12/12] Update images/netbox/README.md --- images/netbox/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/images/netbox/README.md b/images/netbox/README.md index 63f726c..0e9d106 100644 --- a/images/netbox/README.md +++ b/images/netbox/README.md @@ -12,10 +12,6 @@ Par défaut, les plugins suivants sont installés : | `netbox-bgp` | Gestion des sessions BGP, peers, communities | ✅ | | `netbox-secrets` | Gestion sécurisée des secrets et mots de passe | ✅ | | `netbox-topology-views` | Visualisation de topologie réseau | ✅ | -| `netbox-documents` | Gestion de documents attachés | ❌ | -| `netbox-acls` | Gestion des Access Control Lists | ❌ | -| `netbox-qrcode` | Génération de QR codes pour les équipements | ❌ | -| `netbox-proxbox` | Intégration avec Proxmox VE | ❌ | ## Utilisation @@ -118,12 +114,12 @@ images/netbox/ ## Plugins - Liens et documentation - **netbox-branching** : https://github.com/netboxlabs/netbox-branching - - Permet de créer des branches pour tester des changements avant de les appliquer - - Idéal pour le change management et les workflows de validation - **netbox-bgp** : https://github.com/netbox-community/netbox-bgp - - Gestion complète BGP : sessions, peers, communities, prefix-lists - - Parfait pour documenter ton infrastructure réseau Arista + +- **netbox-secrets** : https://github.com/Onemind-Services-LLC/netbox-secrets + +- **netbox-branching** : https://github.com/netboxlabs/netbox-branching ## Notes -- 2.52.0