Most elegant way to deploy an individual flow to active NR instance, from within a flow or otherwise? I have been playing with this idea for a while, and tried various methods.
The method I find the most logical is to analyze the flows file, get the list of flows, and build a new flows file that matches the list of individual flows replacing those that have newer variants.
This idea has three(3) issues that I see:
-
This is off the reservation, if NR development changes the internal flows data structure or format, the solution will (likely) break.
-
Configuration nodes do not consistently support credentials management in a uniform manner, just changing the secret in settings, does not cover all scenarios. Even when you do drop a new/updated flows file into place, it is not just restart NR and good to go situation right now. The mysql configuration node id/password orphaning is just one example.
-
UI elements of the dashboard are a problem in general when you import updated flows, orphaned objects, duplicated objects, etc. How to find and resolve issues is not, from an API perspective straight-forward. For example UI object presentation placement changes inconsistently is one such example, the so called 'spacers' issue.
I actually wrote a flow that audits flows, and reports to a database that a given device has pending individual flow updates, pending NR update, Node update, NPM update, etc. This works. but this only half of the goal. I have also experimented with Ansible, SaltStack other related solutions, but all of this still only address part of the issue.
To those that ask why even consider this... Because I need this feature to exist in some form. I have several ideas that could leverage NR at a very large scale across 100s if not 1000s of devices or more, but for the above issues which disqualify NR. NR has so much potential, but for a few quirks in this regard.
To those that would suggest just create a canned image, and update that image in total. Yes, this works, but this is unacceptable to many/most controlled environments, where the total number of changes is to be limited, validated, etc. An entire new image, in a responsible DEV, UAT, PROD progression is a considerable resource commitment when the change is just a single flow being updated. Running NR in a docker instance does take some of the pain out of this situation of course.
Never mind that changing the SD card is quite intrusive. Although, using PXE has the potential to take some of the pain out of SD card swapping, but PXE option is not available except for Pi 4 devices for example. Moreover, stateless deployment has its own set of issues, which I will not address here.
None of this is a knock on NR. NR is a wonderful solution. The admin API or more explicitly the deployment API needs some TLC to get to a painless update of individual flows.