Announcing Nautobot + Dolt
Last month we published the second blog in a series about running Django on Dolt. Using Dolt as an application-backing store is a new direction for the product. It represents a shift in thinking from "Dolt is a format" to "Dolt is a database". Today we're announcing a new product integration for Dolt, the Version Control plugin for Nautobot.
Nautobot is an open source Network Source of Truth and Network Automation Platform. Its core functionality is to model the intended state of network infrastructure. Nautobot provides flexible and extensible interfaces to validate its data model and safeguard network configuration from errors. A rich feature set allows it to seamlessly integrate with network automation solutions. Adding database versioning with Dolt provides another layer of assurance by enabling human review of change sets and database rollback in the case of errors. Dolt’s branch and merge versioning allows operators to safely modify the data model on branches, merging to production only after validation is complete.
Version Control Plugin
Nautobot's core functionality can be extended through plugins. Nautobot plugins take the form of Django apps loaded alongside the core application. Plugins can add views, database models, and API endpoints. The Version Control plugin is a new addition to the Nautobot ecosystem that brings Git-for-data versioning the platform. The Version Control plugin exposes versioning primitives to the platform and allows Nautobot to use Dolt as its database. As we've demonstrated in previous blogs running a Django application on Dolt is plug-and-play. Dolt is MySQL-compatible, so the MySQL database backend works out of the box. You can demo the Version Control yourself using a local Nautobot instance. Follow the setup guide to get started.
Versioning Application State
Using Dolt as your database means the entire state of your application is versioned. With the Version Control plugin installed, every database read and write happens on a branch and every database write is encapsulated in a commit. The Version Control plugin allows network engineers to apply best practices from software development when managing network infrastructure. The result is a more sophisticated application that mitigates operational risk and creates a granular audit log of changes to the network data model.
Let's look at an example to see the power of this new plugin. We'll start by making a new branch off of "main". Main is the primary branch, it represents the state of production data. By creating "feature branches" to stage changes, we avoid corrupting production as we formulate our updates. To create a new branch, navigate to the "Version Control" tab.
And complete the new branch form
From there we'll navigate to a list view of all IP addresses under the IPAM tab (
IPAM > IP Addresses).
From the banner at the top of the screen, we can see that our current branch has been changed to our newly created feature branch. Changes we make here won't go into production until we merge them back to main. For example purposes, we'll make a set of contrived changes to a few IP Address objects: an addition, an update, and a deletion. Each time we submit a form that writes to the database, the plugin groups those writes into a commit. We can inspect a log of these commits in the commit view (Version Control > Commits (Active Branch)).
And we can visualize a diff of the changes in the diff view (Version Control > Diffs (Active Branch)).
Together, Branches, Commits, and Diffs make for a more principled approach to change management.
Peer Review Production Changes
When we're satisfied with the changes we've made on our feature branch, the first step to applying those changes is to create a pull request. By providing a forum for peer review, pull requests give one more layer of protection against errors in production data. We can create a pull request using the add button in the Version Control tab (Version Control > Pull Requests +).
After populating the appropriate fields, we can see a diff view summary of our new pull request.
The pull request view has additional tabs to view a commit log for the pull request, to view any merge conflicts that would prevent the pull request from being merged, and finally a review tab where users can discuss, approve, or reject the changes. Following the "Add Review" button will navigate you to a pull request review form. Reviews can take the form of a comment, an approval or a rejection of the changeset.
Once a pull request has been approved, the "Merge" button will appear, and you can apply the changes to the main branch. Using the Version Control plugin for human review provides additional guarantees that our source-of-truth data is correct and can be depended on.
Immediate Roll Back
In the event that errors do manifest in the data model, the Version Control plugin provides facilities to roll back our changes. Dolt supports reverting commits at the database layer. Just like the Git equivalent, Dolt revert creates a new commit with the opposite changes of the reverted commits. With the Version Control plugin we can undo individual commits or entire pull requests. For example, if after merging our IP Address pull request we discover a problem, we can revert the merge commit to undo the entire changeset.
From the main branch, we can select the merge commit from our pull request and use the "Revert Select Commits" button. After confirm the revert operation, we will see a new reverting commit has been created in the commit log.
From the diff view we can see each of the changes from the pull request has been reversed. The ability to revert commits is a powerful tool within a change management workflow.
Hosting an application like Nautobot is a major step in Dolt's maturation process. At present, we're the first version controlled SQL database. Our goal is to become the database of choice for any application. Supporting Nautobot and the Version control plugin was a major undertaking for DoltHub. Along the way we added transactions, JSON support, and figured out how to merge foreign keys. Dolt as a product is much better off for the lessons we learned and code we shipped. We believe this is the first of many version-controlled applications. You can learn more about the Nautobot platform on Github. Don't be afraid to give them a star! If you have any questions, or if you want to learn more about Dolt, come chat with us on Discord.