Compare commits

..

13 Commits

Author SHA1 Message Date
1fb4a3ea3f Merge pull request 'feat(netbox): Add NetBox Docker image with plugins support' (#1) from feature/netbox-plugins into main
Some checks failed
Build and Push Docker Images / build (push) Failing after 19s
Reviewed-on: #1
2026-01-07 13:34:31 +00:00
167a3f1d0e Update images/netbox/README.md 2026-01-07 13:33:57 +00:00
14b4da71d1 Update images/netbox/NETBOX_VERSION 2026-01-07 13:31:48 +00:00
ee9b74ebe4 docs(netbox): document NETBOX_VERSION file and version tagging 2026-01-07 13:28:50 +00:00
75c68f57ef feat(ci): support version files for image tagging and build-args 2026-01-07 13:28:19 +00:00
526a488aba feat(netbox): add NETBOX_VERSION file for version tracking 2026-01-07 13:27:47 +00:00
6809982d3d docs(netbox): update README with branching and bgp plugins 2026-01-07 13:26:12 +00:00
c591816148 feat(netbox): configure netbox-branching and netbox-bgp 2026-01-07 13:25:45 +00:00
b05aada942 feat(netbox): add netbox-branching and netbox-bgp plugins 2026-01-07 13:25:33 +00:00
8ab22a1e66 docs(netbox): add README with usage instructions 2026-01-07 12:39:51 +00:00
3d048c0d99 feat(netbox): add plugins configuration file 2026-01-07 12:39:31 +00:00
b31055f944 feat(netbox): add plugin requirements file 2026-01-07 12:39:18 +00:00
b05905590a feat(netbox): add Dockerfile for NetBox with plugins 2026-01-07 12:39:09 +00:00
6 changed files with 279 additions and 3 deletions

View File

@@ -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: <NAME>_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

26
images/netbox/Dockerfile Normal file
View File

@@ -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

View File

@@ -0,0 +1 @@
v4.4

129
images/netbox/README.md Normal file
View File

@@ -0,0 +1,129 @@
# 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-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 | ✅ |
## Utilisation
### 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
Créer un `docker-compose.override.yml` pour utiliser l'image personnalisée :
```yaml
services:
netbox:
image: gitea.arnodo.fr/damien/netbox:v4.2
pull_policy: always
netbox-worker:
image: gitea.arnodo.fr/damien/netbox:v4.2
pull_policy: always
netbox-housekeeping:
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
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_branching",
"netbox_bgp",
"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",
}
],
},
}
```
## 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
```
## Plugins - Liens et documentation
- **netbox-branching** : https://github.com/netboxlabs/netbox-branching
- **netbox-bgp** : https://github.com/netbox-community/netbox-bgp
- **netbox-secrets** : https://github.com/Onemind-Services-LLC/netbox-secrets
- **netbox-branching** : https://github.com/netboxlabs/netbox-branching
## 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 >= 4.0 (netbox-branching requiert NetBox 4.0+)
- Le fichier `NETBOX_VERSION` contrôle la version de base et le tag de l'image

View File

@@ -0,0 +1,30 @@
# =============================================================================
# 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:
# - 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-documents: Gestion de documents
# - netbox-acls: Gestion des ACLs
# - netbox-qrcode: Génération de QR codes
# - netbox-proxbox: Intégration Proxmox
# =============================================================================
# Plugins actifs
netbox-branching
netbox-bgp
netbox-secrets
netbox-topology-views
# Plugins disponibles - décommente ceux dont tu as besoin
# netbox-documents
# netbox-acls
# netbox-qrcode
# netbox-proxbox

54
images/netbox/plugins.py Normal file
View File

@@ -0,0 +1,54 @@
# =============================================================================
# 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_branching",
"netbox_bgp",
"netbox_secrets",
"netbox_topology_views",
# "netbox_documents",
# "netbox_acls",
# "netbox_qrcode",
# "netbox_proxbox",
]
# 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
# "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_proxbox": {
# "proxmox": [
# {
# "domain": "proxmox.example.com",
# "http_port": 8006,
# "user": "root@pam",
# "password": "your-password",
# "ssl": True,
# "node": "pve",
# }
# ],
# },
}