Compare commits

...

20 commits

Author SHA1 Message Date
Félix Bouynot fd331cc3e1
Merge 6967b2ca34 into a0961edd76 2025-12-04 09:39:44 +09:00
Tobias Genannt a0961edd76
Merge pull request #1574 from netbox-community/renovate/sentry-sdk-2.x
Some checks failed
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
Update dependency sentry-sdk to v2.47.0
2025-12-03 21:08:13 +01:00
renovate[bot] 9a68d6fd70
Update dependency sentry-sdk to v2.47.0 2025-12-03 19:34:23 +00:00
Tobias Genannt d6ee283a24
Merge pull request #1567 from netbox-community/renovate/sentry-sdk-2.x
Some checks failed
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
Update dependency sentry-sdk to v2.46.0
2025-11-24 15:22:50 +01:00
renovate[bot] 10031c2990
Update dependency sentry-sdk to v2.46.0 2025-11-24 13:50:32 +00:00
Tobias Genannt 50021466ad
Merge pull request #1565 from netbox-community/renovate/actions-checkout-6.x
Some checks failed
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
Update actions/checkout action to v6
2025-11-20 20:55:15 +01:00
renovate[bot] 0f2fb47d9c
Update actions/checkout action to v6 2025-11-20 18:38:17 +00:00
Tobias Genannt cff630efa0
Merge pull request #1564 from netbox-community/renovate/sentry-sdk-2.x
Some checks failed
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
Update dependency sentry-sdk to v2.45.0
2025-11-19 06:52:02 +01:00
renovate[bot] 74b0a41f3e
Update dependency sentry-sdk to v2.45.0 2025-11-18 22:51:24 +00:00
Tobias Genannt 9de4e23f9c
Merge pull request #1562 from netbox-community/renovate/granian-2.x
Some checks failed
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
Update dependency granian to v2.6.0
2025-11-16 19:27:33 +01:00
renovate[bot] db027b14a3
Update dependency granian to v2.6.0 2025-11-16 17:56:30 +00:00
Tobias Genannt 07fcb205b4
Switch server to Granian (#1561)
Some checks failed
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
* Switch server to Granian

Because the development of Nginx Unit has been stopped, switch the server
to Granian which still allows to serve the Python application and the
static files from one server.

* Addressed review comments

* Update docker/launch-netbox.sh

Co-authored-by: Christian Mäder <cimnine@users.noreply.github.com>

* Update docker/launch-netbox.sh

Co-authored-by: Christian Mäder <cimnine@users.noreply.github.com>

---------

Co-authored-by: Christian Mäder <cimnine@users.noreply.github.com>
2025-11-12 12:57:50 +00:00
Tobias Genannt c89fd3331b
Merge pull request #1560 from netbox-community/renovate/sentry-sdk-2.x
Some checks failed
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
push / Checks syntax of our code (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Has been cancelled
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Has been cancelled
Update dependency sentry-sdk to v2.44.0
2025-11-11 15:15:09 +01:00
renovate[bot] f474cc585c
Update dependency sentry-sdk to v2.44.0 2025-11-11 13:43:40 +00:00
Tobias Genannt 8147115847
Merge pull request #1559 from netbox-community/renovate/dulwich-0.x
Some checks are pending
push / Checks syntax of our code (push) Waiting to run
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Waiting to run
Update dependency dulwich to v0.24.10
2025-11-10 22:42:50 +01:00
renovate[bot] 22688dedd4
Update dependency dulwich to v0.24.10 2025-11-10 20:51:29 +00:00
Tobias Genannt 86223f210a
Merge pull request #1523 from netbox-community/renovate/docker.io-postgres-18.x
Some checks are pending
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh feature, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (./build.sh main, ubuntu-24.04-arm) (push) Waiting to run
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04) (push) Waiting to run
push / Checks syntax of our code (push) Waiting to run
push / Builds new NetBox Docker Images (./build-latest.sh, ubuntu-24.04) (push) Waiting to run
push / Builds new NetBox Docker Images (PRERELEASE=true ./build-latest.sh, ubuntu-24.04-arm) (push) Waiting to run
Update docker.io/postgres Docker tag to v18
2025-11-10 12:57:48 +01:00
Tobias Genannt 665e27560f
Merge pull request #1500 from netbox-community/renovate/docker.io-valkey-valkey-9.x
Update docker.io/valkey/valkey Docker tag to v9
2025-11-10 12:57:24 +01:00
renovate[bot] 88a2e48923
Update docker.io/postgres Docker tag to v18 2025-09-26 02:25:40 +00:00
renovate[bot] 00d8dd75d6
Update docker.io/valkey/valkey Docker tag to v9 2025-08-15 00:38:39 +00:00
12 changed files with 57 additions and 168 deletions

View file

@ -23,7 +23,7 @@ jobs:
packages: read packages: read
statuses: write statuses: write
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: with:
# Full git history is needed to get a proper # Full git history is needed to get a proper
# list of changed files within `super-linter` # list of changed files within `super-linter`
@ -42,6 +42,7 @@ jobs:
VALIDATE_GITHUB_ACTIONS_ZIZMOR: false VALIDATE_GITHUB_ACTIONS_ZIZMOR: false
VALIDATE_GITLEAKS: false VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false VALIDATE_JSCPD: false
VALIDATE_PYTHON_PYLINT: false
VALIDATE_TRIVY: false VALIDATE_TRIVY: false
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*) FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
EDITORCONFIG_FILE_NAME: .editorconfig-checker.json EDITORCONFIG_FILE_NAME: .editorconfig-checker.json
@ -73,7 +74,7 @@ jobs:
steps: steps:
- id: git-checkout - id: git-checkout
name: Checkout name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v6
- id: buildx-setup - id: buildx-setup
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3

View file

@ -32,7 +32,7 @@ jobs:
steps: steps:
- id: source-checkout - id: source-checkout
name: Checkout name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v6
with: with:
ref: ${{ matrix.build.branch }} ref: ${{ matrix.build.branch }}
- id: set-netbox-docker-version - id: set-netbox-docker-version

View file

@ -27,7 +27,7 @@ ARG NETBOX_PATH
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt / COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
ENV VIRTUAL_ENV=/opt/netbox/venv ENV VIRTUAL_ENV=/opt/netbox/venv
RUN \ RUN \
# Gunicorn is not needed because we use Nginx Unit # Gunicorn is not needed because we use Granian
sed -i -e '/gunicorn/d' /requirements.txt && \ sed -i -e '/gunicorn/d' /requirements.txt && \
# We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt # We need 'social-auth-core[all]' in the Docker image. But if we put it in our own requirements-container.txt
# we have potential version conflicts and the build will fail. # we have potential version conflicts and the build will fail.
@ -46,8 +46,6 @@ RUN \
ARG FROM ARG FROM
FROM ${FROM} AS main FROM ${FROM} AS main
COPY docker/unit.list /etc/apt/sources.list.d/unit.list
ADD --chmod=444 --chown=0:0 https://unit.nginx.org/keys/nginx-keyring.gpg /usr/share/keyrings/nginx-keyring.gpg
RUN export DEBIAN_FRONTEND=noninteractive \ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq \ && apt-get update -qq \
&& apt-get upgrade \ && apt-get upgrade \
@ -64,8 +62,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
openssl \ openssl \
python3 \ python3 \
tini \ tini \
unit-python3.12=1.34.2-1~noble \
unit=1.34.2-1~noble \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy the modified 'requirements*.txt' files, to have the files actually used during installation # Copy the modified 'requirements*.txt' files, to have the files actually used during installation
@ -81,20 +77,20 @@ COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
COPY configuration/ /etc/netbox/config/ COPY configuration/ /etc/netbox/config/
COPY docker/nginx-unit.json /etc/unit/ COPY docker/granian.py /opt/netbox/netbox/netbox/granian.py
COPY VERSION /opt/netbox/VERSION COPY VERSION /opt/netbox/VERSION
WORKDIR /opt/netbox/netbox WORKDIR /opt/netbox/netbox
# Must set permissions for '/opt/netbox/netbox/media' directory # Must set permissions for '/opt/netbox/netbox/media' directory
# to g+w so that pictures can be uploaded to netbox. # to g+w so that pictures can be uploaded to netbox.
RUN mkdir -p static media /opt/unit/state/ /opt/unit/tmp/ \ RUN useradd --home-dir /opt/netbox/ --no-create-home --no-user-group --system --shell /bin/false --uid 999 --gid 0 netbox \
&& chown -R unit:root /opt/unit/ media reports scripts \ && mkdir -p static media local \
&& chmod -R g+w /opt/unit/ media reports scripts \ && chown -R netbox:root media reports scripts \
&& chmod -R g+w media reports scripts \
&& cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \ && cd /opt/netbox/ && SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python -m mkdocs build \
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \ --config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
&& DEBUG="true" SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input \ && DEBUG="true" SECRET_KEY="dummyKeyWithMinimumLength-------------------------" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input \
&& mkdir /opt/netbox/netbox/local \
&& echo "build: Docker-$(cat /opt/netbox/VERSION)" > /opt/netbox/netbox/local/release.yaml && echo "build: Docker-$(cat /opt/netbox/VERSION)" > /opt/netbox/netbox/local/release.yaml
ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH VIRTUAL_ENV=/opt/netbox/venv UV_NO_CACHE=1 ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH VIRTUAL_ENV=/opt/netbox/venv UV_NO_CACHE=1

View file

@ -2,9 +2,6 @@ services:
netbox: netbox:
ports: ports:
- "8000:8080" - "8000:8080"
# If you want the Nginx unit status page visible from the
# outside of the container add the following port mapping:
# - "8001:8081"
# healthcheck: # healthcheck:
# Time for which the health check can fail after the container is started. # Time for which the health check can fail after the container is started.
# This depends mostly on the performance of your database. On the first start, # This depends mostly on the performance of your database. On the first start,
@ -19,4 +16,3 @@ services:
# SUPERUSER_EMAIL: "" # SUPERUSER_EMAIL: ""
# SUPERUSER_NAME: "" # SUPERUSER_NAME: ""
# SUPERUSER_PASSWORD: "" # SUPERUSER_PASSWORD: ""

View file

@ -9,7 +9,7 @@ services:
redis-cache: redis-cache:
condition: service_healthy condition: service_healthy
env_file: env/netbox.env env_file: env/netbox.env
user: "unit:root" user: "netbox:root"
volumes: volumes:
- ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro - ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro
healthcheck: healthcheck:
@ -30,7 +30,7 @@ services:
interval: 15s interval: 15s
postgres: postgres:
image: docker.io/postgres:17-alpine image: docker.io/postgres:18-alpine
env_file: env/postgres.env env_file: env/postgres.env
healthcheck: healthcheck:
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER ## $$ because of docker-compose test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER ## $$ because of docker-compose
@ -40,7 +40,7 @@ services:
retries: 5 retries: 5
redis: &redis redis: &redis
image: docker.io/valkey/valkey:8.1-alpine image: docker.io/valkey/valkey:9.0-alpine
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env

View file

@ -6,7 +6,7 @@ services:
- redis - redis
- redis-cache - redis-cache
env_file: env/netbox.env env_file: env/netbox.env
user: "unit:root" user: "netbox:root"
healthcheck: healthcheck:
test: curl -f http://localhost:8080/login/ || exit 1 test: curl -f http://localhost:8080/login/ || exit 1
start_period: 90s start_period: 90s
@ -34,7 +34,7 @@ services:
# postgres # postgres
postgres: postgres:
image: docker.io/postgres:17-alpine image: docker.io/postgres:18-alpine
healthcheck: healthcheck:
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
start_period: 20s start_period: 20s
@ -47,7 +47,7 @@ services:
# redis # redis
redis: redis:
image: docker.io/valkey/valkey:8.1-alpine image: docker.io/valkey/valkey:9.0-alpine
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env
@ -62,7 +62,7 @@ services:
volumes: volumes:
- netbox-redis-data:/data - netbox-redis-data:/data
redis-cache: redis-cache:
image: docker.io/valkey/valkey:8.1-alpine image: docker.io/valkey/valkey:9.0-alpine
command: command:
- sh - sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env - -c # this is to evaluate the $REDIS_PASSWORD from the env

13
docker/granian.py Normal file
View file

@ -0,0 +1,13 @@
from granian.utils.proxies import wrap_wsgi_with_proxy_headers
from netbox.wsgi import application
application = wrap_wsgi_with_proxy_headers(
application,
trusted_hosts=[
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"fc00::/7",
"fe80::/10",
],
)

View file

@ -1,57 +1,20 @@
#!/bin/bash #!/bin/bash
UNIT_CONFIG="${UNIT_CONFIG-/etc/unit/nginx-unit.json}" exec granian \
# Also used in "nginx-unit.json" --host "::" \
UNIT_SOCKET="/opt/unit/unit.sock" --port "8080" \
--interface "wsgi" \
load_configuration() { --no-ws \
MAX_WAIT=10 --workers "${GRANIAN_WORKERS:-4}" \
WAIT_COUNT=0 --respawn-failed-workers \
while [ ! -S $UNIT_SOCKET ]; do --backpressure "${GRANIAN_BACKPRESSURE:-${GRANIAN_WORKERS:-4}}" \
if [ $WAIT_COUNT -ge $MAX_WAIT ]; then --loop "uvloop" \
echo "⚠️ No control socket found; configuration will not be loaded." --log \
return 1 --log-level "info" \
fi --access-log \
--working-dir "/opt/netbox/netbox/" \
WAIT_COUNT=$((WAIT_COUNT + 1)) --static-path-route "/static" \
echo "⏳ Waiting for control socket to be created... (${WAIT_COUNT}/${MAX_WAIT})" --static-path-mount "/opt/netbox/netbox/static/" \
--pid-file "/tmp/granian.pid" \
sleep 1 "${GRANIAN_EXTRA_ARGS[@]}" \
done "netbox.granian:application"
# even when the control socket exists, it does not mean unit has finished initialisation
# this curl call will get a reply once unit is fully launched
curl --silent --output /dev/null --request GET --unix-socket $UNIT_SOCKET http://localhost/
echo "⚙️ Applying configuration from $UNIT_CONFIG"
RESP_CODE=$(
curl \
--silent \
--output /dev/null \
--write-out '%{http_code}' \
--request PUT \
--data-binary "@${UNIT_CONFIG}" \
--unix-socket $UNIT_SOCKET \
http://localhost/config
)
if [ "$RESP_CODE" != "200" ]; then
echo "⚠️ Could not load Unit configuration"
kill "$(cat /opt/unit/unit.pid)"
return 1
fi
echo "✅ Unit configuration loaded successfully"
}
load_configuration &
exec unitd \
--no-daemon \
--control unix:$UNIT_SOCKET \
--pid /opt/unit/unit.pid \
--log /dev/stdout \
--statedir /opt/unit/state/ \
--tmpdir /opt/unit/tmp/ \
--user unit \
--group root

View file

@ -1,82 +0,0 @@
{
"listeners": {
"0.0.0.0:8080": {
"pass": "routes/main",
"forwarded": {
"client_ip": "X-Forwarded-For",
"protocol": "X-Forwarded-Proto",
"source": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
}
},
"0.0.0.0:8081": {
"pass": "routes/status",
"forwarded": {
"client_ip": "X-Forwarded-For",
"protocol": "X-Forwarded-Proto",
"source": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]
}
},
"[::]:8080": {
"pass": "routes/main",
"forwarded": {
"client_ip": "X-Forwarded-For",
"protocol": "X-Forwarded-Proto",
"source": ["fc00::/7", "fe80::/10"]
}
},
"[::]:8081": {
"pass": "routes/status",
"forwarded": {
"client_ip": "X-Forwarded-For",
"protocol": "X-Forwarded-Proto",
"source": ["fc00::/7", "fe80::/10"]
}
}
},
"routes": {
"main": [
{
"match": {
"uri": "/static/*"
},
"action": {
"share": "/opt/netbox/netbox${uri}"
}
},
{
"action": {
"pass": "applications/netbox"
}
}
],
"status": [
{
"match": {
"uri": "/status/*"
},
"action": {
"proxy": "http://unix:/opt/unit/unit.sock"
}
}
]
},
"applications": {
"netbox": {
"type": "python 3",
"path": "/opt/netbox/netbox/",
"module": "netbox.wsgi",
"home": "/opt/netbox/venv",
"processes": {
"max": 4,
"spare": 1,
"idle_timeout": 120
}
}
},
"access_log": "/dev/stdout",
"settings": {
"http": {
"max_body_size": 104857600
}
}
}

View file

@ -1 +0,0 @@
deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] http://packages.nginx.org/unit/ubuntu/ noble unit

2
env/netbox.env vendored
View file

@ -15,6 +15,8 @@ EMAIL_USERNAME=netbox
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`! # EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive, i.e. they can't both be `true`!
EMAIL_USE_SSL=false EMAIL_USE_SSL=false
EMAIL_USE_TLS=false EMAIL_USE_TLS=false
GRANIAN_BACKPRESSURE=4
GRANIAN_WORKERS=4
GRAPHQL_ENABLED=true GRAPHQL_ENABLED=true
MEDIA_ROOT=/opt/netbox/netbox/media MEDIA_ROOT=/opt/netbox/netbox/media
METRICS_ENABLED=false METRICS_ENABLED=false

View file

@ -1,6 +1,7 @@
django-auth-ldap==5.2.0 django-auth-ldap==5.2.0
dulwich==0.24.8 dulwich==0.24.10
granian[uvloop]==2.6.0
python3-saml==1.16.0 python3-saml==1.16.0
--no-binary lxml --no-binary lxml
--no-binary xmlsec --no-binary xmlsec
sentry-sdk[django]==2.43.0 sentry-sdk[django]==2.47.0