Closed ewscott9 closed 1 month ago
Ah-ha! Installing it on the netbox-worker-1 fixed the problem. It seems to be working now.
To resolve I had to run through the installation process listed here: https://github.com/netboxlabs/netbox-branching/blob/develop/docs/index.md
On both netbox-1 and netbox-worker-1. I also found that postgres-1 already has the GRANT CREATE ON DATABASE $database TO $user;
set.
Specifically I did the following: Part1
# Enter the postgres-1 container and grant db creation for db_user.
docker exec -u root -ti netbox-docker-301-postgres-1 /bin/bash
#I believe the defaults for these on netbox docker are netbox:netbox.
psql -U <db_user> -d <db_name> -W
# run this in psql cli
GRANT CREATE ON DATABASE <dbname> TO <dbusername>
\q
Part 2
# Next run all of Part 3 via docker exec for the following 3 containers:
docker exec -u root -ti netbox-docker-301-netbox-worker-1 /bin/bash
docker exec -u root -ti netbox-docker-301-netbox-housekeeping-1 /bin/bash
docker exec -u root -ti netbox-docker-301-netbox-1 /bin/bash
Part 3
# Run the following. (copy between the ###'s for the longer commands)
### Activate the NetBox virtual environment and Install the plugin from PyPI
source /opt/netbox/venv/bin/activate
pip install netboxlabs-netbox-branching
###
### Append PLUGINS to configuration.py
echo "
PLUGINS = [
# ...
'netbox_branching',
]" >> /opt/netbox/netbox/netbox/configuration.py
###
### Create local_settings.py
echo "
from netbox_branching.utilities import DynamicSchemaDict
from .configuration import DATABASE
# Wrap DATABASES with DynamicSchemaDict for dynamic schema support
DATABASES = DynamicSchemaDict({
'default': DATABASE,
})
# Employ our custom database router
DATABASE_ROUTERS = [
'netbox_branching.database.BranchAwareRouter',
]" >> /opt/netbox/netbox/netbox/local_settings.py
###
/opt/netbox/netbox/manage.py migrate
Plugin Version
5.0
NetBox Version
4.1.0 (Netbox-Docker 3.0.1)
Python Version
3.12.3
Steps to Reproduce
Expected Behavior
The provision branch job should leave the pending status, and for the branch's activate button should turn bright green.
Observed Behavior
I get the following error in the logs when I try to create a branch. Looks like netbox-worker-1 doesn't know about the netbox_branching plugin, maybe I need to install the plugin on both instances (I installed the plugin on netbox-1 and added
GRANT CREATE ON DATABASE <dbname> TO <username>
to the psql db on posgres-1).