aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2023-09-05 19:10:28 -0700
committerMike Crute <mike@crute.us>2023-09-05 19:10:28 -0700
commit2ec55d13b91e63a237f4523c17fe50c81709bb2b (patch)
tree679c168f1b98ffc85a5542ceee9f9c7c9e3ac076
parent3be9b1285553b8b77b728a3eb20f7e71075524dd (diff)
downloaddockerfiles-2ec55d13b91e63a237f4523c17fe50c81709bb2b.tar.bz2
dockerfiles-2ec55d13b91e63a237f4523c17fe50c81709bb2b.tar.xz
dockerfiles-2ec55d13b91e63a237f4523c17fe50c81709bb2b.zip
netbox: upgrade to 3.6.0
-rw-r--r--netbox/Dockerfile2
-rw-r--r--netbox/Makefile4
-rw-r--r--netbox/configuration.py2
-rw-r--r--netbox/django.patch27
-rw-r--r--netbox/simplevisor.json5
5 files changed, 8 insertions, 32 deletions
diff --git a/netbox/Dockerfile b/netbox/Dockerfile
index b3620a2..29f911f 100644
--- a/netbox/Dockerfile
+++ b/netbox/Dockerfile
@@ -4,7 +4,6 @@ LABEL maintainer="Mike Crute <mike@crute.us>"
4ARG netbox_version 4ARG netbox_version
5 5
6ADD configuration.py /configuration.py 6ADD configuration.py /configuration.py
7ADD django.patch /django.patch
8 7
9RUN set -euxo pipefail; \ 8RUN set -euxo pipefail; \
10 \ 9 \
@@ -39,7 +38,6 @@ RUN set -euxo pipefail; \
39 \ 38 \
40 cd /; \ 39 cd /; \
41 mv /configuration.py /opt/netbox/netbox/netbox/configuration.py; \ 40 mv /configuration.py /opt/netbox/netbox/netbox/configuration.py; \
42 patch -p1 < /django.patch; rm /django.patch; \
43 cd /opt/netbox; \ 41 cd /opt/netbox; \
44 \ 42 \
45 export NETBOX_SECRET_KEY="testing key for running the build that must be at least fifty characters"; \ 43 export NETBOX_SECRET_KEY="testing key for running the build that must be at least fifty characters"; \
diff --git a/netbox/Makefile b/netbox/Makefile
index 793beaa..d3bfdbb 100644
--- a/netbox/Makefile
+++ b/netbox/Makefile
@@ -1,5 +1,5 @@
1VERSION=3.5.7 1VERSION=3.6.0
2VERSION_TAG=$(VERSION)-0 2VERSION_TAG=$(VERSION)-1
3IMAGE=docker.crute.me/netbox:$(VERSION_TAG) 3IMAGE=docker.crute.me/netbox:$(VERSION_TAG)
4LATEST=$(subst :$(VERSION_TAG),,$(IMAGE)):latest 4LATEST=$(subst :$(VERSION_TAG),,$(IMAGE)):latest
5 5
diff --git a/netbox/configuration.py b/netbox/configuration.py
index 74d7a15..8768961 100644
--- a/netbox/configuration.py
+++ b/netbox/configuration.py
@@ -10,7 +10,7 @@ DATABASE = {
10 'PASSWORD': os.getenv("NETBOX_DB_PASSWORD"), 10 'PASSWORD': os.getenv("NETBOX_DB_PASSWORD"),
11 'CONN_MAX_AGE': 300, 11 'CONN_MAX_AGE': 300,
12 'OPTIONS': { 12 'OPTIONS': {
13 'role': os.getenv("NETBOX_SET_ROLE"), 13 'assume_role': os.getenv("NETBOX_SET_ROLE"),
14 } 14 }
15} 15}
16 16
diff --git a/netbox/django.patch b/netbox/django.patch
deleted file mode 100644
index 7318a49..0000000
--- a/netbox/django.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1--- a/usr/lib/python3.11/site-packages/django/db/backends/postgresql/base.py 21:41:07.000000000 -0800
2+++ b/usr/lib/python3.11/site-packages/django/db/backends/postgresql/base.py 19:52:18.092424193 -0800
3@@ -199,6 +199,7 @@
4 else:
5 conn_params = {**settings_dict["OPTIONS"]}
6
7+ conn_params.pop("role", None)
8 conn_params.pop("isolation_level", None)
9 if settings_dict["USER"]:
10 conn_params["user"] = settings_dict["USER"]
11@@ -256,6 +257,16 @@
12 if not self.get_autocommit():
13 self.connection.commit()
14
15+ # Set the role on the connection. This is useful if the
16+ # credential used to login is not the same as the role that
17+ # owns database resources. This scenario can occur when using
18+ # temporary credentials generated by an external system like
19+ # Vault.
20+ options = self.settings_dict["OPTIONS"]
21+ if options["role"]:
22+ with self.connection.cursor() as cursor:
23+ cursor.execute("SET ROLE %s", (options["role"],))
24+
25 @async_unsafe
26 def create_cursor(self, name=None):
27 if name:
diff --git a/netbox/simplevisor.json b/netbox/simplevisor.json
index 666a765..e0740b9 100644
--- a/netbox/simplevisor.json
+++ b/netbox/simplevisor.json
@@ -51,6 +51,11 @@
51 "name": "clearcache", 51 "name": "clearcache",
52 "cmd": ["/usr/bin/python3", "/opt/netbox/netbox/manage.py", "clearcache"], 52 "cmd": ["/usr/bin/python3", "/opt/netbox/netbox/manage.py", "clearcache"],
53 "run-as": "netbox" 53 "run-as": "netbox"
54 },
55 {
56 "name": "lazy_reindex",
57 "cmd": ["/usr/bin/python3", "/opt/netbox/netbox/manage.py", "reindex", "--lazy"],
58 "run-as": "netbox"
54 } 59 }
55 ], 60 ],
56 "main": [ 61 "main": [