Dev Container for NetBox Development #17065
mcmehrtens
started this conversation in
Ideas
Replies: 1 comment
-
I already use Devcontainers myself for other projects and I really think this is a good idea. It will greatly help lower the complexity to contribute to the project as I often struggle myself to keep my fork and installation up to date when submitting PRs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
NetBox Development Container
I'm working on my first contribution to the NetBox source, and I thought this would be a fun opportunity to learn how to set up a dev container. After spending some 10-15 hours working through this and getting it (mostly) functional, I thought it might be something the NetBox development community would be interested in!
Proposal
Add a
.devcontainer
directory in the root directory of thenetbox
repo that, at minimum, includes adevcontainer.json
,Dockerfile
, andcompose.yaml
. The dev container will enable developers with a supported IDE (including GitHub Codespaces) to spin up a representative environment that has all necessary dependencies installed to begin writing and testing code.Considerations
Benefits
Repeatable, Containerized Environment
A dev container configuration would provide an option for developers to use a repeatable, containerized development environment, which will eliminate situations where code may only work in specific environments. Containerization also benefits the developer by guaranteeing that the development will not impact their host operating system.
Development-Production Environment Parity
Many users deploy NetBox as a containerized service with external containerized databases. By configuring a dev container that spins up PostgreSQL and Redis database containers, developers' environments will reflect what many users are running in production—potentially catching more problems before deployment.
Reduced Documentation Upkeep
Having a
.devcontainer
will serve as a source of truth for the development environment, reducing the work needed to keep the CONTRIBUTING.md and Getting Starting guide up-to-date.Lower Barrier to Entry
Lastly, and perhaps most importantly, a dev container will provide a no-compromises solution for less technical or experienced developers to set up an environment so they may contribute to NetBox. For professional developers who know how to set up a proper environment, this could save hours that would otherwise be spent configuring a VM, installing databases in that VM, loading demo data, etc.—if they choose to use it.
Downsides
Maintenance
Having an official dev container in the NetBox repository will warrant up-to-date and functional configuration. This additional maintenance will require work by NetBox contributors to ensure the dev container configuration doesn't break after a release cycle.
Potential Learning Curve
Dev containers simplify setup but also introduce a layer of abstraction and potential complexity. Contributors unfamiliar with Docker or containerization may find the process opaque and confusing, especially if they encounter issues that require troubleshooting.
Personal Thoughts
As a matter of self-improvement, I'm actively trying to avoid chasing the newest technologies for no reason, (the "Ooh, shiny"-syndrome) but after using development containers for a university group project, I was struck by their utility. I'd like the technology to become more mainstream on development teams, and given NetBox's relatively complicated development environment, I thought NetBox would be a good candidate for adoption.
Since this would require substantial work, I'd like to gather the developer community's feedback on this feature to a.) provide the go/no-go and b.) help shape the solution to best fit NetBox's developers' needs. I am more than willing to spearhead this feature.
Best regards,
Matt
Beta Was this translation helpful? Give feedback.
All reactions