Skip to content

Commit 6d25a54

Browse files
authored
Merge pull request #1219 from netbox-community/develop
Version 2.9.0
2 parents f1ca9ab + 36f409a commit 6d25a54

12 files changed

+64
-43
lines changed

.github/workflows/push.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ on:
55
push:
66
branches-ignore:
77
- release
8+
- renovate/**
89
pull_request:
910
branches-ignore:
1011
- release
1112

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
1217
jobs:
1318
lint:
1419
runs-on: ubuntu-latest
@@ -23,15 +28,17 @@ jobs:
2328
with:
2429
python-version: '3.9'
2530
- name: Lint Code Base
26-
uses: github/super-linter@v5
31+
uses: github/super-linter@v6
2732
env:
2833
DEFAULT_BRANCH: develop
2934
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3035
SUPPRESS_POSSUM: true
3136
LINTER_RULES_PATH: /
3237
VALIDATE_ALL_CODEBASE: false
38+
VALIDATE_CHECKOV: false
3339
VALIDATE_DOCKERFILE: false
3440
VALIDATE_GITLEAKS: false
41+
VALIDATE_JSCPD: false
3542
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
3643
EDITORCONFIG_FILE_NAME: .ecrc
3744
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml
@@ -49,35 +56,36 @@ jobs:
4956
- PRERELEASE=true ./build-latest.sh
5057
- ./build.sh feature
5158
- ./build.sh develop
52-
platform:
53-
- linux/amd64
54-
- linux/arm64
59+
os:
60+
- ubuntu-latest
61+
- self-hosted
5562
fail-fast: false
5663
env:
5764
GH_ACTION: enable
5865
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5966
IMAGE_NAMES: docker.io/netboxcommunity/netbox
60-
runs-on: ubuntu-latest
67+
runs-on: ${{ matrix.os }}
6168
name: Builds new NetBox Docker Images
6269
steps:
6370
- id: git-checkout
6471
name: Checkout
6572
uses: actions/checkout@v4
66-
- id: qemu-setup
67-
name: Set up QEMU
68-
uses: docker/setup-qemu-action@v3
6973
- id: buildx-setup
7074
name: Set up Docker Buildx
7175
uses: docker/setup-buildx-action@v3
76+
- id: arm-buildx-platform
77+
name: Set BUILDX_PLATFORM to ARM64
78+
if: matrix.os == 'self-hosted'
79+
run: |
80+
echo "BUILDX_PLATFORM=linux/arm64" >>"${GITHUB_ENV}"
7281
- id: docker-build
73-
name: Build the image for '${{ matrix.platform }}' with '${{ matrix.build_cmd }}'
82+
name: Build the image for '${{ matrix.os }}' with '${{ matrix.build_cmd }}'
7483
run: ${{ matrix.build_cmd }}
7584
env:
76-
BUILDX_PLATFORM: ${{ matrix.platform }}
7785
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
7886
- id: arm-time-limit
7987
name: Set Netbox container start_period higher on ARM64
80-
if: matrix.platform == 'linux/arm64'
88+
if: matrix.os == 'self-hosted'
8189
run: |
8290
echo "NETBOX_START_PERIOD=240s" >>"${GITHUB_ENV}"
8391
- id: docker-test

Dockerfile

+4-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ RUN export DEBIAN_FRONTEND=noninteractive \
3131
ARG NETBOX_PATH
3232
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
3333
RUN \
34-
# We compile 'psycopg' in the build process
35-
sed -i -e '/psycopg/d' /requirements.txt && \
3634
# Gunicorn is not needed because we use Nginx Unit
3735
sed -i -e '/gunicorn/d' /requirements.txt && \
3836
# We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt
3937
# we have potential version conflicts and the build will fail.
4038
# That's why we just replace it in the original requirements.txt.
41-
sed -i -e 's/social-auth-core\[openidconnect\]/social-auth-core\[all\]/g' /requirements.txt && \
39+
sed -i -e 's/social-auth-core/social-auth-core\[all\]/g' /requirements.txt && \
4240
/opt/netbox/venv/bin/pip install \
4341
-r /requirements.txt \
4442
-r /requirements-container.txt
@@ -69,13 +67,13 @@ RUN export DEBIAN_FRONTEND=noninteractive \
6967
tini \
7068
&& curl --silent --output /usr/share/keyrings/nginx-keyring.gpg \
7169
https://unit.nginx.org/keys/nginx-keyring.gpg \
72-
&& echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ lunar unit" \
70+
&& echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ mantic unit" \
7371
> /etc/apt/sources.list.d/unit.list \
7472
&& apt-get update -qq \
7573
&& apt-get install \
7674
--yes -qq --no-install-recommends \
77-
unit=1.31.1-1~lunar \
78-
unit-python3.11=1.31.1-1~lunar \
75+
unit=1.32.0-1~mantic \
76+
unit-python3.11=1.32.0-1~mantic \
7977
&& rm -rf /var/lib/apt/lists/*
8078

8179
COPY --from=builder /opt/netbox/venv /opt/netbox/venv

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ There is a more complete [_Getting Started_ guide on our wiki][wiki-getting-star
3434
git clone -b release https://github.com/netbox-community/netbox-docker.git
3535
cd netbox-docker
3636
tee docker-compose.override.yml <<EOF
37-
version: '3.4'
3837
services:
3938
netbox:
4039
ports:

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.8.0
1+
2.9.0

build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ DOCKERFILE The name of Dockerfile to use.
6161
${_GREEN}Default:${_CLEAR} Dockerfile
6262
6363
DOCKER_FROM The base image to use.
64-
${_GREEN}Default:${_CLEAR} 'ubuntu:23.04'
64+
${_GREEN}Default:${_CLEAR} 'ubuntu:23.10'
6565
6666
BUILDX_PLATFORMS
6767
Specifies the platform(s) to build the image for.
@@ -219,7 +219,7 @@ fi
219219
# Determining the value for DOCKER_FROM
220220
###
221221
if [ -z "$DOCKER_FROM" ]; then
222-
DOCKER_FROM="docker.io/ubuntu:23.04"
222+
DOCKER_FROM="docker.io/ubuntu:23.10"
223223
fi
224224

225225
###

configuration/configuration.py

+29-8
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
8686
'tasks': {
8787
'HOST': environ.get('REDIS_HOST', 'localhost'),
8888
'PORT': _environ_get_and_map('REDIS_PORT', 6379, _AS_INT),
89+
'SENTINELS': [tuple(uri.split(':')) for uri in _environ_get_and_map('REDIS_SENTINELS', '', _AS_LIST) if uri != ''],
90+
'SENTINEL_SERVICE': environ.get('REDIS_SENTINEL_SERVICE', 'default'),
91+
'SENTINEL_TIMEOUT': _environ_get_and_map('REDIS_SENTINEL_TIMEOUT', 10, _AS_INT),
8992
'USERNAME': environ.get('REDIS_USERNAME', ''),
9093
'PASSWORD': _read_secret('redis_password', environ.get('REDIS_PASSWORD', '')),
9194
'DATABASE': _environ_get_and_map('REDIS_DATABASE', 0, _AS_INT),
@@ -95,6 +98,8 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
9598
'caching': {
9699
'HOST': environ.get('REDIS_CACHE_HOST', environ.get('REDIS_HOST', 'localhost')),
97100
'PORT': _environ_get_and_map('REDIS_CACHE_PORT', environ.get('REDIS_PORT', '6379'), _AS_INT),
101+
'SENTINELS': [tuple(uri.split(':')) for uri in _environ_get_and_map('REDIS_CACHE_SENTINELS', '', _AS_LIST) if uri != ''],
102+
'SENTINEL_SERVICE': environ.get('REDIS_CACHE_SENTINEL_SERVICE', environ.get('REDIS_SENTINEL_SERVICE', 'default')),
98103
'USERNAME': environ.get('REDIS_CACHE_USERNAME', environ.get('REDIS_USERNAME', '')),
99104
'PASSWORD': _read_secret('redis_cache_password', environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', ''))),
100105
'DATABASE': _environ_get_and_map('REDIS_CACHE_DATABASE', '1', _AS_INT),
@@ -183,6 +188,13 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
183188
if 'ENFORCE_GLOBAL_UNIQUE' in environ:
184189
ENFORCE_GLOBAL_UNIQUE = _environ_get_and_map('ENFORCE_GLOBAL_UNIQUE', None, _AS_BOOL)
185190

191+
# By default, netbox sends census reporting data using a single HTTP request each time a worker starts.
192+
# This data enables the project maintainers to estimate how many NetBox deployments exist and track the adoption of new versions over time.
193+
# The only data reported by this function are the NetBox version, Python version, and a pseudorandom unique identifier.
194+
# To opt out of census reporting, set CENSUS_REPORTING_ENABLED to False.
195+
if 'CENSUS_REPORTING_ENABLED' in environ:
196+
CENSUS_REPORTING_ENABLED = _environ_get_and_map('CENSUS_REPORTING_ENABLED', None, _AS_BOOL)
197+
186198
# Exempt certain models from the enforcement of view permissions. Models listed here will be viewable by all users and
187199
# by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
188200
EXEMPT_VIEW_PERMISSIONS = _environ_get_and_map('EXEMPT_VIEW_PERMISSIONS', '', _AS_LIST)
@@ -300,6 +312,23 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
300312
# The name to use for the session cookie.
301313
SESSION_COOKIE_NAME = environ.get('SESSION_COOKIE_NAME', 'sessionid')
302314

315+
# If true, the `includeSubDomains` directive will be included in the HTTP Strict Transport Security (HSTS) header.
316+
# This directive instructs the browser to apply the HSTS policy to all subdomains of the current domain.
317+
SECURE_HSTS_INCLUDE_SUBDOMAINS = _environ_get_and_map('SECURE_HSTS_INCLUDE_SUBDOMAINS', 'False', _AS_BOOL)
318+
319+
# If true, the `preload` directive will be included in the HTTP Strict Transport Security (HSTS) header.
320+
# This directive instructs the browser to preload the site in HTTPS. Browsers that use the HSTS preload list will force the
321+
# site to be accessed via HTTPS even if the user types HTTP in the address bar.
322+
SECURE_HSTS_PRELOAD = _environ_get_and_map('SECURE_HSTS_PRELOAD', 'False', _AS_BOOL)
323+
324+
# If set to a non-zero integer value, the SecurityMiddleware sets the HTTP Strict Transport Security (HSTS) header on all
325+
# responses that do not already have it. This will instruct the browser that the website must be accessed via HTTPS,
326+
# blocking any HTTP request.
327+
SECURE_HSTS_SECONDS = _environ_get_and_map('SECURE_HSTS_SECONDS', 0, _AS_INT)
328+
329+
# If true, all non-HTTPS requests will be automatically redirected to use HTTPS.
330+
SECURE_SSL_REDIRECT = _environ_get_and_map('SECURE_SSL_REDIRECT', 'False', _AS_BOOL)
331+
303332
# By default, NetBox will store session data in the database. Alternatively, a file path can be specified here to use
304333
# local file storage instead. (This can be useful for enabling authentication on a standby instance with read-only
305334
# database access.) Note that the user as which NetBox runs must have read and write permissions to this path.
@@ -308,11 +337,3 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
308337
# Time zone (default: UTC)
309338
TIME_ZONE = environ.get('TIME_ZONE', 'UTC')
310339

311-
# Date/time formatting. See the following link for supported formats:
312-
# https://docs.djangoproject.com/en/stable/ref/templates/builtins/#date
313-
DATE_FORMAT = environ.get('DATE_FORMAT', 'N j, Y')
314-
SHORT_DATE_FORMAT = environ.get('SHORT_DATE_FORMAT', 'Y-m-d')
315-
TIME_FORMAT = environ.get('TIME_FORMAT', 'g:i a')
316-
SHORT_TIME_FORMAT = environ.get('SHORT_TIME_FORMAT', 'H:i:s')
317-
DATETIME_FORMAT = environ.get('DATETIME_FORMAT', 'N j, Y g:i a')
318-
SHORT_DATETIME_FORMAT = environ.get('SHORT_DATETIME_FORMAT', 'Y-m-d H:i')

docker-compose.override.yml.example

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.4'
21
services:
32
netbox:
43
ports:

docker-compose.test.override.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.4'
21
services:
32
netbox:
43
ports:

docker-compose.test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.4'
21
services:
32
netbox: &netbox
43
image: ${IMAGE-netboxcommunity/netbox:latest}

docker-compose.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
version: '3.4'
21
services:
32
netbox: &netbox
4-
image: docker.io/netboxcommunity/netbox:${VERSION-v3.7-2.8.0}
3+
image: docker.io/netboxcommunity/netbox:${VERSION-v4.0-2.9.0}
54
depends_on:
65
- postgres
76
- redis

docker/docker-entrypoint.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ else
7272
fi
7373

7474
./manage.py shell --interface python <<END
75-
from django.contrib.auth.models import User
76-
from users.models import Token
75+
from users.models import Token, User
7776
if not User.objects.filter(username='${SUPERUSER_NAME}'):
78-
u=User.objects.create_superuser('${SUPERUSER_NAME}', '${SUPERUSER_EMAIL}', '${SUPERUSER_PASSWORD}')
77+
u = User.objects.create_superuser('${SUPERUSER_NAME}', '${SUPERUSER_EMAIL}', '${SUPERUSER_PASSWORD}')
7978
Token.objects.create(user=u, key='${SUPERUSER_API_TOKEN}')
8079
END
8180

@@ -87,7 +86,7 @@ from users.models import Token
8786
try:
8887
old_default_token = Token.objects.get(key="0123456789abcdef0123456789abcdef01234567")
8988
if old_default_token:
90-
print("⚠️ Warning: You have the old default admin token in your database. This token is widely known; please remove it.")
89+
print("⚠️ Warning: You have the old default admin API token in your database. This token is widely known; please remove it. Log in as your superuser and check API Tokens in your user menu.")
9190
except Token.DoesNotExist:
9291
pass
9392
END

requirements-container.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
django-auth-ldap==4.6.0
2-
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.14.2
3-
dulwich==0.21.7
4-
psycopg[c,pool]==3.1.16
5-
python3-saml==1.16.0
1+
django-auth-ldap==4.8.0
2+
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.14.3
3+
dulwich==0.22.1
4+
python3-saml==1.16.0 --no-binary lxml
5+
sentry-sdk==2.1.1

0 commit comments

Comments
 (0)