Dev Environment Setup

I would like to work on a couple of things in LibreNMS. The ideas I have range from working on different DeviceOS’ to poking around integrating graphviz to drawing some diagrams. (It seems an LLDP Neighbor diagram would be a good place to start)

For years, my development environment has been vi in a bash shell since I was mostly just hacking on scripts. But now I am trying to get with the times and build a properly modern dev environment. I’m learning git and VSCode on Windows 10, and am not sure how I should tie that together with a clone of the librenms repo, and figured I would ask if anyone had any pointers?

The idea in my head at the moment is to build a docker image on my windows machine and figure out how to tie that into VSCode. But I have a doubt in the back of my mind thinking I might be overcomplicating this.

1 Like

How about WSL?

This is probably a REALLY basic concept that is very general and probably open to a million opinions. But I guess you could say that since I am so green, I’m hoping to find some opinions that work really well for libreNMS that I can translate into a default dev environment.

I have stumbled across this video on YouTube that covers this in general, though his video appears to focus on a python environment. But his video does cover installing Docker on windows (which forces WSL2), as well as Ubuntu, and then he ties vscode to is dev-python container. But then he starts making files on the container, while I need to git the project on there first.

I think this a direction I want to try for my libreNMS development efforts, and I currently have a RockyLinux container connected to VSCode, and I am trying to figure out how to tie to code in a git project… So far i have used the container CLI to use the package manager to install git and a few other packages, so it feels like I am on the right path… But I am hoping to find a way to build an image/container automatically that would load dependencies and clone/pull the git repo.

Assuming I am not barking up the wrong tree, I was wondering if anyone had anything from a Dockerfile or a vscode config to advice or a link to a HOWTO that would push me in the right direction, or at least someone warning me off this idea if I am going in the wrong direction. Since I am learning docker at the same time, it feels like there should be a way to say “use this image, add these dependencies then git clone the code to this location” but I may be wising more than knowing what’s possible.

I’ll try to document what I am doing here.

I have decided to try to run librenms in a Rocky Linux Docker environment for my development. I have gotten WSL2 and docker working on my Windows 10 PC and spun up a default Rocky Linux 8.5 container and used the Docker Desktop to connect to a shell and ran these commands:
yum -y install git wget
cd /opt
git clone
Then in VScode, I press F1 and search for Remote-Containers: Attach to Running Container
I select the container I want in the list (e.g. dev-librensm)
Next, it asks for the folder to connect to and I choose /opt/librenms
Then I open a terminal in vscode (Terminal > New Terminal) to get a shell

Next step is to install the dependencies LibreNMS will require and get it running. I’m not sure if I should try to use an external DB or keep it all confined within the container. I will document more when I get it working in Apache.

Not that I’d want to discourage you from experimenting, but it’s worth noting that LibreNMS already has LLDP neighbour diagrams via vis.js: Overview > Maps > Device Groups/Network or on the Neigbours tab of a device.

Understood, but there are a couple of issues with the solution you mention version what I want to explore:

  1. On the Device > neighbors > Map version (which is where I primarily want to have a graphviz option) it simply doesn’t look as good.
  2. The overall map you refer to is jiggly and doesn’t really translate to something that can be shared/printed and drawn on as a network design product, especially on a network wide scale. (e.g. Mapping out the Network core, or the connectivity for a particular site/region) While, they are good to show what links are heavily utilized, which isn’t really data I want to clutter up this version.
  3. The python project I have in mind uses NETCONF to gather LLDP data at that moment, which is a direction that could be explored for libreNMS (and compare that data to what is in the database, highlighting a failed link), I believe LibreNMS has other options to build it’s connection database. (e.g. CDP or MAC addresses) which can offer a view that Ptolemy couldn’t generate on it’s own. But I can’t look at that until I have graphviz working in LibreNMS and making drawings to begin with, and implementing it in PHP would also be a good learning experience.

But this particular post isn’t about network mapping features LibreNMS does or doesn’t do, nor the blue sky ideas I think I want and feel others might also find beneficial.

I was hoping someone already had a config for vscode specifically or docker in general or maybe just a HOWTO on how to easily build a docker image that can start a libreNMS dev environment that can be hacked, broken, thrown away and rebuilt before having a valid commit to push back upstream. This is a method of developing that is completely foreign to me, and I feel like I am asking how to add text in the vi editor, so I thought I would ask the very, very basic questions before I go off in the wrong direction. Maybe my idea of a dockerized dev environment isn’t as popular as I assumed… Which is fine, I was just hoping that to get somewhere new, I didn’t have build the road on the way… But sometimes that is when the lessons stick the most.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.