__netbox: new config parameters for data paths
.. to move them to an other partition.
This commit is contained in:
parent
88ddebd040
commit
f5c8c26db6
4 changed files with 80 additions and 12 deletions
|
@ -154,15 +154,6 @@ EOF
|
|||
cat << EOF
|
||||
}
|
||||
EOF
|
||||
|
||||
else
|
||||
cat << EOF
|
||||
# HTTP proxies NetBox should use when sending outbound HTTP requests (e.g. for webhooks).
|
||||
# HTTP_PROXIES = {
|
||||
# 'http': 'http://10.10.1.10:3128',
|
||||
# 'https': 'http://10.10.1.10:1080',
|
||||
# }
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
|
@ -190,10 +181,18 @@ MAINTENANCE_MODE = False
|
|||
# all objects by specifying "?limit=0".
|
||||
MAX_PAGE_SIZE = 1000
|
||||
|
||||
EOF
|
||||
|
||||
if [ "$MEDIA_ROOT" != "" ]; then
|
||||
cat << EOF
|
||||
# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that
|
||||
# the default value of this setting is derived from the installed location.
|
||||
# MEDIA_ROOT = '/opt/netbox/netbox/media'
|
||||
MEDIA_ROOT = '$MEDIA_ROOT'
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
# By default uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the
|
||||
# class path of the storage driver in STORAGE_BACKEND and any configuration options in STORAGE_CONFIG. For example:
|
||||
# STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage'
|
||||
|
@ -257,14 +256,27 @@ RELEASE_CHECK_TIMEOUT = 24 * 3600
|
|||
RELEASE_CHECK_URL = None
|
||||
# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases'
|
||||
|
||||
EOF
|
||||
|
||||
if [ "$REPORTS_ROOT" != "" ]; then
|
||||
cat << EOF
|
||||
# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
|
||||
# this setting is derived from the installed location.
|
||||
# REPORTS_ROOT = '/opt/netbox/netbox/reports'
|
||||
REPORTS_ROOT = '$REPORTS_ROOT'
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$SCRIPTS_ROOT" != "" ]; then
|
||||
cat << EOF
|
||||
# The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of
|
||||
# this setting is derived from the installed location.
|
||||
# SCRIPTS_ROOT = '/opt/netbox/netbox/scripts'
|
||||
SCRIPTS_ROOT = '$SCRIPTS_ROOT'
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
# By default, NetBox will store session data in the database. Alternatively, a file path can be specified here to use
|
||||
# local file storage instead. (This can be useful for enabling authentication on a standby instance with read-only
|
||||
# database access.) Note that the user as which NetBox runs must have read and write permissions to this path.
|
||||
|
|
|
@ -107,6 +107,39 @@ http-proxy
|
|||
https-proxy
|
||||
Proxy which will be used with any HTTP request like webhooks.
|
||||
|
||||
data-root
|
||||
This parameter set's the media, reports and scripts root to subdirectories
|
||||
of the given directory. Values can be overwritten by special parameters like
|
||||
`--media-root` for example. Use this option if you want to store persistant
|
||||
data of netbox on an other partition. A trailing shlash is not needed.
|
||||
|
||||
The data directories have following predefined sub-directory names:
|
||||
|
||||
media root:
|
||||
``$data_root/media``
|
||||
reports root:
|
||||
``$data_root/reports``
|
||||
scripts root:
|
||||
``$data_root/scripts``
|
||||
|
||||
media-root
|
||||
The file path to where media files (like image attachments) are stored.
|
||||
Change this path if you require to store data on an other partiotion.
|
||||
A trailing slash is not needed. By default, it will be stored into the
|
||||
installation directory (``/opt/netbox/netbox/netbox/media``).
|
||||
|
||||
reports-root
|
||||
The file path of where custom reports are kept. Change this path if you
|
||||
require to store data on an other partition. A trailing slash is not
|
||||
needed. By default, it will be stored into the installation directory
|
||||
(``/opt/netbox/netbox/netbox/reports``).
|
||||
|
||||
scripts-root
|
||||
The file path of where custom scripts are kept. Change this path if you
|
||||
require to store data on an other partition. A trailing slash is not
|
||||
needed. By default, it will be stored into the installation directory
|
||||
(``/opt/netbox/netbox/netbox/scripts``).
|
||||
|
||||
BOOLEAN PARAMETERS
|
||||
------------------
|
||||
redis-ssl
|
||||
|
|
|
@ -138,6 +138,25 @@ else
|
|||
fi
|
||||
export LOGIN_REQUIRED
|
||||
|
||||
if [ -f "$__object/parameter/data-root" ]; then
|
||||
data_root="$(cat "$__object/parameter/data-root")"
|
||||
MEDIA_ROOT="$data_root/media"
|
||||
REPORTS_ROOT="$data_root/reports"
|
||||
SCRIPTS_ROOT="$data_root/scripts"
|
||||
fi
|
||||
if [ -f "$__object/parameter/media-root" ]; then
|
||||
MEDIA_ROOT="$(cat "$__object/parameter/media-root")"
|
||||
fi
|
||||
export MEDIA_ROOT
|
||||
if [ -f "$__object/parameter/reports-root" ]; then
|
||||
REPORTS_ROOT="$(cat "$__object/parameter/reports-root")"
|
||||
fi
|
||||
export REPORTS_ROOT
|
||||
if [ -f "$__object/parameter/scripts-root" ]; then
|
||||
SCRIPTS_ROOT="$(cat "$__object/parameter/scripts-root")"
|
||||
fi
|
||||
export SCRIPTS_ROOT
|
||||
|
||||
|
||||
# Create system user used to run netbox.
|
||||
__user netbox --system --home /opt/netbox --create-home
|
||||
|
|
|
@ -19,3 +19,7 @@ smtp-from-email
|
|||
basepath
|
||||
http-proxy
|
||||
https-proxy
|
||||
data-root
|
||||
media-root
|
||||
reports-root
|
||||
scripts-root
|
||||
|
|
Loading…
Reference in a new issue