__netbox: set --data-root default value

The default value is set to preserve all data saved by netbox. As
explained in the manpage, it sets the directory for all data directories
to `~netbox/data/` (would resolve to `/opt/netbox/data/`), so upgrades
will not remove this data.
This commit is contained in:
matze 2020-10-04 17:40:01 +02:00
parent 050812305b
commit 14f7cf8839
3 changed files with 16 additions and 13 deletions

View file

@ -131,7 +131,7 @@ data-root
This parameter set's the media, reports and scripts root to subdirectories This parameter set's the media, reports and scripts root to subdirectories
of the given directory. Values can be overwritten by special parameters like 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 `--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. data of netbox on an other partition. A trailing slash is not needed.
The data directories have following predefined sub-directory names: The data directories have following predefined sub-directory names:
@ -142,23 +142,26 @@ data-root
scripts root: scripts root:
``$data_root/scripts`` ``$data_root/scripts``
To preserve all data from installation upgrades - which just replace the
installation directory - the data will be kept in the netbox home directory
rather than the installation directory by default (``/opt/netbox/data/``).
This way, no data will be deleted after the installation directory
replacement because it remains outside of the installation directory.
media-root media-root
The file path to where media files (like image attachments) are stored. 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. 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 A trailing slash is not needed. Defaults to ``$data_root/media``.
installation directory (``/opt/netbox/netbox/netbox/media``).
reports-root reports-root
The file path of where custom reports are kept. Change this path if you 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 require to store data on an other partition. A trailing slash is not
needed. By default, it will be stored into the installation directory needed. Defaults to ``$data_root/reports``.
(``/opt/netbox/netbox/netbox/reports``).
scripts-root scripts-root
The file path of where custom scripts are kept. Change this path if you 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 require to store data on an other partition. A trailing slash is not
needed. By default, it will be stored into the installation directory needed. Defaults to ``$data_root/scripts``.
(``/opt/netbox/netbox/netbox/scripts``).
BOOLEAN PARAMETERS BOOLEAN PARAMETERS

View file

@ -161,12 +161,11 @@ else
fi fi
export LOGIN_REQUIRED export LOGIN_REQUIRED
if [ -f "$__object/parameter/data-root" ]; then
data_root="$(cat "$__object/parameter/data-root")" data_root="$(cat "$__object/parameter/data-root")"
MEDIA_ROOT="$data_root/media" MEDIA_ROOT="$data_root/media"
REPORTS_ROOT="$data_root/reports" REPORTS_ROOT="$data_root/reports"
SCRIPTS_ROOT="$data_root/scripts" SCRIPTS_ROOT="$data_root/scripts"
fi
if [ -f "$__object/parameter/media-root" ]; then if [ -f "$__object/parameter/media-root" ]; then
MEDIA_ROOT="$(cat "$__object/parameter/media-root")" MEDIA_ROOT="$(cat "$__object/parameter/media-root")"
fi fi

View file

@ -0,0 +1 @@
/opt/netbox/data