Upload custom scripts outside of GUI #8069

Closed
opened 2025-12-29 20:31:55 +01:00 by adam · 5 comments
Owner

Originally created by @K4pper on GitHub (May 16, 2023).

NetBox version

v3.5.1

Feature type

Change to existing functionality

Proposed functionality

Versions prior to Netbox 3.5 you had the option to upload custom scripts to the path /opt/netbox/netbox/scripts. I would propose to bring this option back. While still having the option to upload via the web GUI.
After updating to Netbox 3.5 you have to upload scripts from the Netbox web GUI, this makes it impossible for us to upload scripts since we have a read-only file system on our Netbox deployment.

Use case

This feature would make it possible to upload scripts outside of the GUI which is a necessity for deployments which have a read-only filesystem.

An example of a deployment with a read-only filesystem is our own which runs on Kubernetes, where it is very common to have such a setup.

Database changes

N/A

External dependencies

N/A

Originally created by @K4pper on GitHub (May 16, 2023). ### NetBox version v3.5.1 ### Feature type Change to existing functionality ### Proposed functionality Versions prior to Netbox 3.5 you had the option to upload custom scripts to the path **/opt/netbox/netbox/scripts**. I would propose to bring this option back. While still having the option to upload via the web GUI. After updating to Netbox 3.5 you have to upload scripts from the Netbox web GUI, this makes it impossible for us to upload scripts since we have a **read-only** file system on our Netbox deployment. ### Use case This feature would make it possible to upload scripts outside of the GUI which is a necessity for deployments which have a read-only filesystem. An example of a deployment with a read-only filesystem is our own which runs on Kubernetes, where it is very common to have such a setup. ### Database changes N/A ### External dependencies N/A
adam added the type: feature label 2025-12-29 20:31:55 +01:00
adam closed this issue 2025-12-29 20:31:55 +01:00
Author
Owner

@Omripresent commented on GitHub (May 30, 2023):

I think we could use a similar code from this migration https://github.com/netbox-community/netbox/blob/develop/netbox/extras/migrations/0091_create_managedfiles.py and run it on every startup to synchronize the files present in the scripts folder to the database.

We should probably add a two way functionality to add new files/modules to the database as well as removal of database records for files that has been removed.

@Omripresent commented on GitHub (May 30, 2023): I think we could use a similar code from this migration https://github.com/netbox-community/netbox/blob/develop/netbox/extras/migrations/0091_create_managedfiles.py and run it on every startup to synchronize the files present in the scripts folder to the database. We should probably add a two way functionality to add new files/modules to the database as well as removal of database records for files that has been removed.
Author
Owner

@Omripresent commented on GitHub (May 31, 2023):

I have the proposed changes that can help with this use case here https://github.com/netbox-community/netbox/compare/develop...Omripresent:netbox:develop

It accounts for both single file and python modules as well as normalizing the managed file lookup query across the Django view and API view fixing #12609.

@Omripresent commented on GitHub (May 31, 2023): I have the proposed changes that can help with this use case here https://github.com/netbox-community/netbox/compare/develop...Omripresent:netbox:develop It accounts for both single file and python modules as well as normalizing the managed file lookup query across the Django view and API view fixing #12609.
Author
Owner

@sean-kang commented on GitHub (Jun 9, 2023):

I agree with this. We run NetBox on multiple docker containers for highly availability and this recent change broke the scripts for the same reason.

@sean-kang commented on GitHub (Jun 9, 2023): I agree with this. We run NetBox on multiple docker containers for highly availability and this recent change broke the scripts for the same reason.
Author
Owner

@rasanentimo commented on GitHub (Aug 30, 2023):

This feature is important for any container based installations (kubernetes, docker). This would allow to keep the app stateless for easier administration, allow the use of readonly filesystem for more secure solution and also skip the manual steps.

There's related conversion in #12643 #12663

@rasanentimo commented on GitHub (Aug 30, 2023): This feature is important for any container based installations (kubernetes, docker). This would allow to keep the app stateless for easier administration, allow the use of readonly filesystem for more secure solution and also skip the manual steps. There's related conversion in #12643 #12663
Author
Owner

@jeremystretch commented on GitHub (Oct 13, 2023):

The solution for this in NetBox v3.5 and later is to define remote data sources from which reports & scripts are synchronized. This provides a much cleaner and more robust workflow while ensuring the necessary database representations of these files are created in a reliable manner.

@jeremystretch commented on GitHub (Oct 13, 2023): The solution for this in NetBox v3.5 and later is to define [remote data sources](https://docs.netbox.dev/en/stable/features/synchronized-data/) from which reports & scripts are synchronized. This provides a _much_ cleaner and more robust workflow while ensuring the necessary database representations of these files are created in a reliable manner.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8069