So, as usual, I edit my Dockerfile-Plugins to bump the version number, do a docker-compose build and a docker-compose up -d to go up to the newest version.
However, the bug was still there, in that searching for a provider account does nothing. It turns out that a required step when performing a Netbox upgrade is to run upgrade.sh which among other things re-build the search cache:
This will re-index the search cache, but only if there were any changes made in the database models (there were none between 4.0.3 and 4.0.5) and thus the re-index never happened.
Manually running the rebuild using the command docker exec netbox-docker_netbox_1 ./manage.py reindex --lazy seems to have fixed the issue.
Expected Behavior
The upgrade logic (or, ideally, running upgrade.sh) should run on all version updates, and checking for database migrations is not a sufficient heuristic. For example, a persistent file could be created inside the container recording the version on startup, and if that version changes, the upgrade script is ran.
driftadm@dsdocker02:~/netbox-docker$ git status
On branch plugins
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: docker-compose.yml
Untracked files:
(use "git add <file>..." to include in what will be committed)
Dockerfile-Plugins
a.log
build.log
configuration/plugins.py
netbox-plugin-mclag/
plugin_requirements.txt
no changes added to commit (use "git add" and/or "git commit -a")
driftadm@dsdocker02:~/netbox-docker$
Startup Command
docker-compose up -d
NetBox Logs
driftadm@dsdocker02:~/netbox-docker$ docker-compose logs netbox
Attaching to netbox-docker_netbox_1
netbox_1 | ↩️ Skip creating the superuser
netbox_1 | 🧬 loaded config '/etc/netbox/config/configuration.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/extra.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/logging.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/plugins.py'
netbox_1 | 🧬 loaded config '/etc/netbox/config/social-auth.py'
netbox_1 | ✅ Initialisation is done.
netbox_1 | ⏳ Waiting for control socket to be created... (1/10)
netbox_1 | 2024/06/10 08:47:25 [warn] 6#6 Unit is running unprivileged, then it cannot use arbitrary user and group.
netbox_1 | 2024/06/10 08:47:25 [info] 6#6 unit 1.32.0 started
netbox_1 | 2024/06/10 08:47:25 [info] 84#84 discovery started
netbox_1 | 2024/06/10 08:47:25 [notice] 84#84 module: python 3.11.6 "/usr/lib/unit/modules/python3.11.unit.so"
netbox_1 | 2024/06/10 08:47:25 [info] 6#6 controller started
netbox_1 | 2024/06/10 08:47:25 [notice] 6#6 process 84 exited with code 0
netbox_1 | 2024/06/10 08:47:25 [info] 86#86 router started
netbox_1 | 2024/06/10 08:47:25 [info] 86#86 OpenSSL 3.0.10 1 Aug 2023, 300000a0
netbox_1 | ⚙️ Applying configuration from /etc/unit/nginx-unit.json
netbox_1 | 2024/06/10 08:47:26 [info] 89#89 "netbox" prototype started
netbox_1 | 2024/06/10 08:47:26 [info] 90#90 "netbox" application started
netbox_1 | ✅ Unit configuration loaded successfully
netbox_1 | 2024/06/10 08:47:28 [notice] 6#6 process 82 exited with code 0
netbox_1 | 2024/06/10 08:47:33 [info] 122#122 "netbox" application started
Current Behavior
There was a defect in Netbox 4.0.3 where circuit provider accounts were not indexed (https://github.com/netbox-community/netbox/issues/16286) which was resolved in Netbox 4.0.5.
So, as usual, I edit my Dockerfile-Plugins to bump the version number, do a
docker-compose build
and adocker-compose up -d
to go up to the newest version.However, the bug was still there, in that searching for a provider account does nothing. It turns out that a required step when performing a Netbox upgrade is to run
upgrade.sh
which among other things re-build the search cache:https://github.com/netbox-community/netbox/blob/56b6b1b9d864a12d05b8cd6d9f4f1a476fa00e85/upgrade.sh#L110-L113
However, netbox-docker never calls this script, instead it has its own update logic:
https://github.com/netbox-community/netbox-docker/blob/0c99ff8b5663db3e0db5a45660cebda9f917508b/docker/docker-entrypoint.sh#L39-L51
This will re-index the search cache, but only if there were any changes made in the database models (there were none between 4.0.3 and 4.0.5) and thus the re-index never happened.
Manually running the rebuild using the command
docker exec netbox-docker_netbox_1 ./manage.py reindex --lazy
seems to have fixed the issue.Expected Behavior
The upgrade logic (or, ideally, running
upgrade.sh
) should run on all version updates, and checking for database migrations is not a sufficient heuristic. For example, a persistent file could be created inside the container recording the version on startup, and if that version changes, the upgrade script is ran.Docker Compose Version
docker-compose up -d
Docker Version
The git Revision
8692d54b838522ef947246ec5d62c2308efff7aa
The git Status
Startup Command
docker-compose up -d
NetBox Logs
Content of docker-compose.override.yml