Skip to content

Commit c60defe

Browse files
authored
Merge pull request #1609 from netbox-community/develop
Release 4.0.0
2 parents 7d6f006 + 7e95612 commit c60defe

18 files changed

+145
-215
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ extend-ignore = E203, W503
44
per-file-ignores =
55
configuration/*:E131,E251,E266,E302,E305,E501,E722
66
startup_scripts/startup_script_utils/__init__.py:F401
7-
docker/*:E266,E722
7+
docker/*:E266,E722,E501

.github/workflows/push.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
packages: read
2424
statuses: write
2525
steps:
26-
- uses: actions/checkout@v5
26+
- uses: actions/checkout@v6
2727
with:
2828
# Full git history is needed to get a proper
2929
# list of changed files within `super-linter`
@@ -42,6 +42,7 @@ jobs:
4242
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
4343
VALIDATE_GITLEAKS: false
4444
VALIDATE_JSCPD: false
45+
VALIDATE_PYTHON_PYLINT: false
4546
VALIDATE_TRIVY: false
4647
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
4748
EDITORCONFIG_FILE_NAME: .editorconfig-checker.json
@@ -73,7 +74,7 @@ jobs:
7374
steps:
7475
- id: git-checkout
7576
name: Checkout
76-
uses: actions/checkout@v5
77+
uses: actions/checkout@v6
7778
- id: buildx-setup
7879
name: Set up Docker Buildx
7980
uses: docker/setup-buildx-action@v3

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
steps:
3333
- id: source-checkout
3434
name: Checkout
35-
uses: actions/checkout@v5
35+
uses: actions/checkout@v6
3636
with:
3737
ref: ${{ matrix.build.branch }}
3838
- id: set-netbox-docker-version

Dockerfile

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ARG NETBOX_PATH
2727
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
2828
ENV VIRTUAL_ENV=/opt/netbox/venv
2929
RUN \
30-
# Gunicorn is not needed because we use Nginx Unit
30+
# Gunicorn is not needed because we use Granian
3131
sed -i -e '/gunicorn/d' /requirements.txt && \
3232
# We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt
3333
# we have potential version conflicts and the build will fail.
@@ -46,8 +46,6 @@ RUN \
4646
ARG FROM
4747
FROM ${FROM} AS main
4848

49-
COPY docker/unit.list /etc/apt/sources.list.d/unit.list
50-
ADD --chmod=444 --chown=0:0 https://unit.nginx.org/keys/nginx-keyring.gpg /usr/share/keyrings/nginx-keyring.gpg
5149
RUN export DEBIAN_FRONTEND=noninteractive \
5250
&& apt-get update -qq \
5351
&& apt-get upgrade \
@@ -64,8 +62,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
6462
openssl \
6563
python3 \
6664
tini \
67-
unit-python3.12=1.34.2-1~noble \
68-
unit=1.34.2-1~noble \
6965
&& rm -rf /var/lib/apt/lists/*
7066

7167
# Copy the modified 'requirements*.txt' files, to have the files actually used during installation
@@ -80,22 +76,23 @@ COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
8076
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
8177
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
8278
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
79+
COPY docker/super_user.py /opt/netbox/super_user.py
8380
COPY configuration/ /etc/netbox/config/
84-
COPY docker/nginx-unit.json /etc/unit/
81+
COPY docker/granian.py /opt/netbox/netbox/netbox/granian.py
8582
COPY VERSION /opt/netbox/VERSION
8683

8784
WORKDIR /opt/netbox/netbox
8885

8986
# Must set permissions for '/opt/netbox/netbox/media' directory
9087
# to g+w so that pictures can be uploaded to netbox.
91-
RUN mkdir -p static media /opt/unit/state/ /opt/unit/tmp/ \
92-
&& chown -R unit:root /opt/unit/ media reports scripts \
93-
&& chmod -R g+w /opt/unit/ media reports scripts \
94-
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
95-
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
96-
&& DEBUG="true" SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input \
97-
&& mkdir /opt/netbox/netbox/local \
98-
&& echo "build: Docker-$(cat /opt/netbox/VERSION)" > /opt/netbox/netbox/local/release.yaml
88+
RUN useradd --home-dir /opt/netbox/ --no-create-home --no-user-group --system --shell /bin/false --uid 999 --gid 0 netbox \
89+
&& mkdir -p static media local \
90+
&& chown -R netbox:root media reports scripts \
91+
&& chmod -R g+w media reports scripts \
92+
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
93+
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
94+
&& DEBUG="true" SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input \
95+
&& echo "build: Docker-$(cat /opt/netbox/VERSION)" > /opt/netbox/netbox/local/release.yaml
9996

10097
ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH VIRTUAL_ENV=/opt/netbox/venv UV_NO_CACHE=1
10198
ENTRYPOINT [ "/usr/bin/tini", "--" ]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.2
1+
4.0.0

configuration/configuration.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ def _environ_get_and_map(variable_name: str, default: str | None = None, map_fn:
310310
REMOTE_AUTH_SUPERUSERS = _environ_get_and_map('REMOTE_AUTH_SUPERUSERS', '', _AS_LIST)
311311
REMOTE_AUTH_STAFF_GROUPS = _environ_get_and_map('REMOTE_AUTH_STAFF_GROUPS', '', _AS_LIST)
312312
REMOTE_AUTH_STAFF_USERS = _environ_get_and_map('REMOTE_AUTH_STAFF_USERS', '', _AS_LIST)
313+
# SSO Configuration
314+
SOCIAL_AUTH_OKTA_OPENIDCONNECT_KEY = environ.get('SOCIAL_AUTH_OKTA_OPENIDCONNECT_KEY')
315+
SOCIAL_AUTH_OKTA_OPENIDCONNECT_SECRET = _read_secret('okta_openidconnect_secret', environ.get('SOCIAL_AUTH_OKTA_OPENIDCONNECT_SECRET', ''))
316+
SOCIAL_AUTH_OKTA_OPENIDCONNECT_API_URL = environ.get('SOCIAL_AUTH_OKTA_OPENIDCONNECT_API_URL')
317+
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = environ.get('SOCIAL_AUTH_GOOGLE_OAUTH2_KEY')
318+
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = _read_secret('google_oauth2_secret', environ.get('SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET', ''))
313319

314320
# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
315321
# version check or use the URL below to check for release in the official NetBox repository.

configuration/extra.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@
3333

3434

3535
## By default uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the
36-
## class path of the storage driver in STORAGE_BACKEND and any configuration options in STORAGE_CONFIG. For example:
37-
# STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage'
38-
# STORAGE_CONFIG = {
39-
# 'AWS_ACCESS_KEY_ID': 'Key ID',
40-
# 'AWS_SECRET_ACCESS_KEY': 'Secret',
41-
# 'AWS_STORAGE_BUCKET_NAME': 'netbox',
42-
# 'AWS_S3_REGION_NAME': 'eu-west-1',
36+
## class path of the storage driver and any configuration options in STORAGES. For example:
37+
# STORAGES = {
38+
# 'default': {
39+
# 'BACKEND': 'storages.backends.s3boto3.S3Boto3Storage',
40+
# 'OPTIONS': {
41+
# 'access_key': 'Key ID',
42+
# 'secret_key': 'Secret',
43+
# 'bucket_name': 'netbox',
44+
# 'region_name': 'us-west-1',
45+
# }
46+
# },
47+
# 'staticfiles': {
48+
# 'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage',
49+
# }
4350
# }
4451

4552

docker-compose.override.yml.example

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ services:
22
netbox:
33
ports:
44
- "8000:8080"
5-
# If you want the Nginx unit status page visible from the
6-
# outside of the container add the following port mapping:
7-
# - "8001:8081"
85
# healthcheck:
96
# Time for which the health check can fail after the container is started.
107
# This depends mostly on the performance of your database. On the first start,
@@ -19,4 +16,18 @@ services:
1916
# SUPERUSER_EMAIL: ""
2017
# SUPERUSER_NAME: ""
2118
# SUPERUSER_PASSWORD: ""
19+
# SSO Configuration
20+
# SOCIAL_AUTH_OKTA_OPENIDCONNECT_KEY: "your_okta_client_id"
21+
# SOCIAL_AUTH_OKTA_OPENIDCONNECT_API_URL: "https://your-domain.okta.com"
22+
# SOCIAL_AUTH_GOOGLE_OAUTH2_KEY: "your_google_client_id"
23+
# secrets:
24+
# - okta_openidconnect_secret
25+
# - google_oauth2_secret
26+
27+
# Uncomment to use Docker secrets for SSO credentials
28+
# secrets:
29+
# okta_openidconnect_secret:
30+
# file: ./secrets/okta_secret.txt
31+
# google_oauth2_secret:
32+
# file: ./secrets/google_secret.txt
2233

docker-compose.test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
redis-cache:
1010
condition: service_healthy
1111
env_file: env/netbox.env
12-
user: "unit:root"
12+
user: "netbox:root"
1313
volumes:
1414
- ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro
1515
healthcheck:
@@ -30,7 +30,7 @@ services:
3030
interval: 15s
3131

3232
postgres:
33-
image: docker.io/postgres:17-alpine
33+
image: docker.io/postgres:18-alpine
3434
env_file: env/postgres.env
3535
healthcheck:
3636
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER ## $$ because of docker-compose
@@ -40,7 +40,7 @@ services:
4040
retries: 5
4141

4242
redis: &redis
43-
image: docker.io/valkey/valkey:8.1-alpine
43+
image: docker.io/valkey/valkey:9.0-alpine
4444
command:
4545
- sh
4646
- -c # this is to evaluate the $REDIS_PASSWORD from the env

docker-compose.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
services:
22
netbox: &netbox
3-
image: docker.io/netboxcommunity/netbox:${VERSION-v4.4-3.4.1}
3+
image: docker.io/netboxcommunity/netbox:${VERSION-v4.5-4.0.0}
44
depends_on:
55
- postgres
66
- redis
77
- redis-cache
88
env_file: env/netbox.env
9-
user: "unit:root"
9+
user: "netbox:root"
1010
healthcheck:
1111
test: curl -f http://localhost:8080/login/ || exit 1
1212
start_period: 90s
@@ -34,7 +34,7 @@ services:
3434

3535
# postgres
3636
postgres:
37-
image: docker.io/postgres:17-alpine
37+
image: docker.io/postgres:18-alpine
3838
healthcheck:
3939
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
4040
start_period: 20s
@@ -43,11 +43,11 @@ services:
4343
retries: 5
4444
env_file: env/postgres.env
4545
volumes:
46-
- netbox-postgres-data:/var/lib/postgresql/data
46+
- netbox-postgres:/var/lib/postgresql
4747

4848
# redis
4949
redis:
50-
image: docker.io/valkey/valkey:8.1-alpine
50+
image: docker.io/valkey/valkey:9.0-alpine
5151
command:
5252
- sh
5353
- -c # this is to evaluate the $REDIS_PASSWORD from the env
@@ -62,7 +62,7 @@ services:
6262
volumes:
6363
- netbox-redis-data:/data
6464
redis-cache:
65-
image: docker.io/valkey/valkey:8.1-alpine
65+
image: docker.io/valkey/valkey:9.0-alpine
6666
command:
6767
- sh
6868
- -c # this is to evaluate the $REDIS_PASSWORD from the env
@@ -75,7 +75,7 @@ services:
7575
volumes:
7676
netbox-media-files:
7777
driver: local
78-
netbox-postgres-data:
78+
netbox-postgres:
7979
driver: local
8080
netbox-redis-cache-data:
8181
driver: local

0 commit comments

Comments
 (0)