NetBox est un logiciel gratuit utilisé pour la gestion des réseaux informatiques. Aujourd’hui, je montre comment installer un service Netbox sur le disque dur Synology.
Étape 1 : Préparer Synology
La première chose à faire est d’activer le login SSH sur le Diskstation. Pour cela, il faut aller dans le “Panneau de configuration” > “Terminal”.
Ensuite, on peut se connecter via “SSH”, le port indiqué et le mot de passe de l’administrateur (les utilisateurs de Windows utilisent Putty ou WinSCP).
Je me connecte via Terminal, winSCP ou Putty et je laisse cette console ouverte pour plus tard.
Étape 2 : Créer un dossier NETBOX
Je crée un nouveau répertoire appelé “netbox” dans le répertoire Docker.
Il faut maintenant télécharger le fichier suivant et le décompresser dans le répertoire : https://github.com/netbox-community/netbox-docker/archive/refs/heads/release.zip. Pour cela, j’utilise la console :
$ cd /volume1/docker/netbox/
$ sudo wget https://github.com/netbox-community/netbox-docker/archive/refs/heads/release.zip
$ sudo /bin/7z x release.zip
$ cd netbox-docker-release
$ sudo mkdir netbox-media-files
$ sudo mkdir netbox-redis-data
$ sudo mkdir netbox-postgres-data
version: '3.4'
services:
netbox:
image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
depends_on:
- postgres
- redis
- redis-cache
- netbox-worker
env_file: env/netbox.env
user: 'unit:root'
volumes:
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
- ./initializers:/opt/netbox/initializers:z,ro
- ./configuration:/etc/netbox/config:z,ro
- ./reports:/etc/netbox/reports:z,ro
- ./scripts:/etc/netbox/scripts:z,ro
- ./netbox-media-files:/opt/netbox/netbox/media:z
ports:
- "8097:8080"
netbox-worker:
image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
env_file: env/netbox.env
user: 'unit:root'
depends_on:
- redis
- postgres
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
- rqworker
netbox-housekeeping:
image: netboxcommunity/netbox:${VERSION-v3.1-1.6.0}
env_file: env/netbox.env
user: 'unit:root'
depends_on:
- redis
- postgres
command:
- /opt/netbox/housekeeping.sh
# postgres
postgres:
image: postgres:14-alpine
env_file: env/postgres.env
volumes:
- ./netbox-postgres-data:/var/lib/postgresql/data
# redis
redis:
image: redis:6-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis.env
volumes:
- ./netbox-redis-data:/data
redis-cache:
image: redis:6-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis-cache.env
Il est très important que l’héritage “« : *netbox” et de saisir un port pour “netbox” :
$ sudo docker-compose up
J’appelle le serveur netbox avec l’adresse IP de Synology et mon port de conteneur.