Skip to content

Commit b4a6be3

Browse files
authored
Merge pull request #1001 from netbox-community/develop
Version 2.6.0
2 parents 3286faa + 02a9264 commit b4a6be3

File tree

13 files changed

+41
-102
lines changed

13 files changed

+41
-102
lines changed

.dockerignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
.git
2-
.github
3-
.travis.yml
1+
.git*
42
*.md
5-
env
63
build*
7-
docker-compose.override.yml
4+
docker-compose*
5+
env
6+
test-configuration
87
.netbox/.git*
9-
.netbox/.travis.yml
8+
.netbox/contrib
109
.netbox/scripts
10+
.netbox/upgrade.sh

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ RUN export DEBIAN_FRONTEND=noninteractive \
3030

3131
ARG NETBOX_PATH
3232
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
33-
RUN sed -i -e '/psycopg2-binary/d' /requirements.txt && \
33+
RUN \
34+
# We compile 'psycopg2' in the build process
35+
sed -i -e '/psycopg2-binary/d' /requirements.txt && \
36+
# Gunicorn is not needed because we use Nginx Unit
37+
sed -i -e '/gunicorn/d' /requirements.txt && \
3438
# We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt
3539
# we have potential version conflicts and the build will fail.
3640
# That's why we just replace it in the original requirements.txt.
@@ -93,11 +97,11 @@ WORKDIR /opt/netbox/netbox
9397
# Must set permissions for '/opt/netbox/netbox/media' directory
9498
# to g+w so that pictures can be uploaded to netbox.
9599
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
96-
&& chown -R unit:root media /opt/unit/ \
97-
&& chmod -R g+w media /opt/unit/ \
98-
&& cd /opt/netbox/ && SECRET_KEY="dummy" /opt/netbox/venv/bin/python -m mkdocs build \
100+
&& chown -R unit:root /opt/unit/ media reports scripts \
101+
&& chmod -R g+w /opt/unit/ media reports scripts \
102+
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
99103
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
100-
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
104+
&& SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
101105

102106
ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH
103107
ENTRYPOINT [ "/usr/bin/tini", "--" ]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ For each of the above tag, there is an extra tag:
9999
## Documentation
100100

101101
Please refer [to our wiki on GitHub][netbox-docker-wiki] for further information on how to use the NetBox Docker image properly.
102-
The wiki covers advanced topics such as using files for secrets, configuring TLS, deployment to Kubernetes, monitoring and configuring NAPALM and LDAP.
102+
The wiki covers advanced topics such as using files for secrets, configuring TLS, deployment to Kubernetes, monitoring and configuring LDAP.
103103

104104
Our wiki is a community effort.
105105
Feel free to correct errors, update outdated information or provide additional guides and insights.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.5.3
1+
2.6.0

build-functions/get-public-image-config.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
check_if_tags_exists() {
4+
local image=$1
5+
local tag=$2
6+
skopeo list-tags "docker://$image" | jq -r ".Tags | contains([\"$tag\"])"
7+
}
8+
39
get_image_label() {
410
local label=$1
511
local image=$2

build.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ fi
139139

140140
# Check if we have everything needed for the build
141141
source ./build-functions/check-commands.sh
142-
142+
# Load all build functions
143+
source ./build-functions/get-public-image-config.sh
143144
source ./build-functions/gh-functions.sh
144145

145146
IMAGE_NAMES="${IMAGE_NAMES-docker.io/netboxcommunity/netbox}"
@@ -309,19 +310,22 @@ gh_env "FINAL_DOCKER_TAG=${IMAGE_NAME_TAGS[0]}"
309310
###
310311
# Checking if the build is necessary,
311312
# meaning build only if one of those values changed:
313+
# - a new tag is beeing created
312314
# - base image digest
313315
# - netbox git ref (Label: netbox.git-ref)
314316
# - netbox-docker git ref (Label: org.opencontainers.image.revision)
315317
###
316-
# Load information from registry (only for docker.io)
318+
# Load information from registry (only for first registry in "IMAGE_NAMES")
317319
SHOULD_BUILD="false"
318320
BUILD_REASON=""
319321
if [ -z "${GH_ACTION}" ]; then
320322
# Asuming non Github builds should always proceed
321323
SHOULD_BUILD="true"
322324
BUILD_REASON="${BUILD_REASON} interactive"
325+
elif [ "false" == "$(check_if_tags_exists "${IMAGE_NAMES[0]}" "$TARGET_DOCKER_TAG")" ]; then
326+
SHOULD_BUILD="true"
327+
BUILD_REASON="${BUILD_REASON} newtag"
323328
else
324-
source ./build-functions/get-public-image-config.sh
325329
echo "Checking labels for '${FINAL_DOCKER_TAG}'"
326330
BASE_LAST_LAYER=$(get_image_last_layer "${DOCKER_FROM}")
327331
OLD_BASE_LAST_LAYER=$(get_image_label netbox.last-base-image-layer "${FINAL_DOCKER_TAG}")

configuration/configuration.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
136136
if 'BANNER_LOGIN' in environ:
137137
BANNER_LOGIN = environ.get('BANNER_LOGIN', None)
138138

139-
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
140-
# BASE_PATH = 'netbox/'
141-
BASE_PATH = environ.get('BASE_PATH', '')
142-
143139
# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90)
144140
if 'CHANGELOG_RETENTION' in environ:
145141
CHANGELOG_RETENTION = _environ_get_and_map('CHANGELOG_RETENTION', None, _AS_INT)
@@ -239,20 +235,6 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
239235
# Expose Prometheus monitoring metrics at the HTTP endpoint '/metrics'
240236
METRICS_ENABLED = _environ_get_and_map('METRICS_ENABLED', 'False', _AS_BOOL)
241237

242-
# Credentials that NetBox will uses to authenticate to devices when connecting via NAPALM.
243-
if 'NAPALM_USERNAME' in environ:
244-
NAPALM_USERNAME = environ.get('NAPALM_USERNAME', None)
245-
if 'NAPALM_PASSWORD' in environ:
246-
NAPALM_PASSWORD = _read_secret('napalm_password', environ.get('NAPALM_PASSWORD', None))
247-
248-
# NAPALM timeout (in seconds). (Default: 30)
249-
if 'NAPALM_TIMEOUT' in environ:
250-
NAPALM_TIMEOUT = _environ_get_and_map('NAPALM_TIMEOUT', None, _AS_INT)
251-
252-
# # NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must
253-
# # be provided as a dictionary.
254-
# NAPALM_ARGS = None
255-
256238
# Determine how many objects to display per page within a list. (Default: 50)
257239
if 'PAGINATE_COUNT' in environ:
258240
PAGINATE_COUNT = _environ_get_and_map('PAGINATE_COUNT', None, _AS_INT)
@@ -301,17 +283,9 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
301283
RELEASE_CHECK_URL = environ.get('RELEASE_CHECK_URL', None)
302284
# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases'
303285

304-
# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
305-
# this setting is derived from the installed location.
306-
REPORTS_ROOT = environ.get('REPORTS_ROOT', '/etc/netbox/reports')
307-
308286
# Maximum execution time for background tasks, in seconds.
309287
RQ_DEFAULT_TIMEOUT = _environ_get_and_map('RQ_DEFAULT_TIMEOUT', 300, _AS_INT)
310288

311-
# The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of
312-
# this setting is derived from the installed location.
313-
SCRIPTS_ROOT = environ.get('SCRIPTS_ROOT', '/etc/netbox/scripts')
314-
315289
# The name to use for the csrf token cookie.
316290
CSRF_COOKIE_NAME = environ.get('CSRF_COOKIE_NAME', 'csrftoken')
317291

configuration/extra.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
# 'file', 'ftp', 'ftps', 'http', 'https', 'irc', 'mailto', 'sftp', 'ssh', 'tel', 'telnet', 'tftp', 'vnc', 'xmpp',
1616
# )
1717

18-
19-
## NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must
20-
## be provided as a dictionary.
21-
# NAPALM_ARGS = {}
22-
23-
2418
## Enable installed plugins. Add the name of each plugin to the list.
2519
# from netbox.configuration.configuration import PLUGINS
2620
# PLUGINS.append('my_plugin')

docker-compose.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.4'
22
services:
33
netbox: &netbox
4-
image: docker.io/netboxcommunity/netbox:${VERSION-v3.4-2.5.3}
4+
image: docker.io/netboxcommunity/netbox:${VERSION-v3.4-2.6.0}
55
depends_on:
66
- postgres
77
- redis
@@ -15,9 +15,9 @@ services:
1515
test: "curl -f http://localhost:8080/api/ || exit 1"
1616
volumes:
1717
- ./configuration:/etc/netbox/config:z,ro
18-
- ./reports:/etc/netbox/reports:z,ro
19-
- ./scripts:/etc/netbox/scripts:z,ro
20-
- netbox-media-files:/opt/netbox/netbox/media:z
18+
- netbox-media-files:/opt/netbox/netbox/media:z,rw
19+
- netbox-reports-files:/opt/netbox/netbox/reports:z,rw
20+
- netbox-scripts-files:/opt/netbox/netbox/scripts:z,rw
2121
netbox-worker:
2222
<<: *netbox
2323
depends_on:
@@ -77,7 +77,11 @@ volumes:
7777
driver: local
7878
netbox-postgres-data:
7979
driver: local
80+
netbox-redis-cache-data:
81+
driver: local
8082
netbox-redis-data:
8183
driver: local
82-
netbox-redis-cache-data:
84+
netbox-reports-files:
85+
driver: local
86+
netbox-scripts-files:
8387
driver: local

env/netbox.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ REDIS_INSECURE_SKIP_TLS_VERIFY=false
2929
REDIS_PASSWORD=H733Kdjndks81
3030
REDIS_SSL=false
3131
RELEASE_CHECK_URL=https://api.github.com/repos/netbox-community/netbox/releases
32-
SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
32+
SECRET_KEY=r(m)9nLGnz$(_q3N4z1k(EFsMCjjjzx08x9VhNVcfd%6RF#r!6DE@+V5Zk2X
3333
SKIP_SUPERUSER=true
3434
WEBHOOKS_ENABLED=true

0 commit comments

Comments
 (0)