jordanrvillarreal / netbox-build-o-matic

This is a basic series of bash scripts that will build and configure a new NetBox instance per the official documentation.
Apache License 2.0
13 stars 1 forks source link

Django Permissions #1

Open steele-ntwrk opened 8 months ago

steele-ntwrk commented 8 months ago

Hey Jordan,

I thought I would just let you know the install seems to fail now with the following error

(venv) root@dev-netbox:/opt/netbox/netbox# python manage.py migrate Operations to perform: Apply all migrations: account, admin, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless Running migrations: Traceback (most recent call last): File "/opt/netbox-3.7.4/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute return self.cursor.execute(sql) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-3.7.4/venv/lib/python3.11/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) psycopg.errors.InsufficientPrivilege: permission denied for schema public LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA...

steele-ntwrk commented 8 months ago

I just seem to have fixed it it with the following:

sudo -u postgres psql

\c netbox

GRANT ALL PRIVILEGES ON SCHEMA public TO netbox; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO netbox; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO netbox; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO netbox; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO netbox;

Without looking into it too much, probably change in syntax with setting DB permissions with the new ver of pqsl