Skip to content

Commit 6c5434e

Browse files
authored
Merge pull request #557 from netbox-community/develop
Version 1.3.0: Compatibility with Netbox v3
2 parents 676ca79 + 8e0c795 commit 6c5434e

15 files changed

+34
-41
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020
- uses: actions/setup-python@v2
2121
- name: Lint Code Base
22-
uses: github/super-linter@v3
22+
uses: github/super-linter@v4
2323
env:
2424
DEFAULT_BRANCH: develop
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN apk add --no-cache \
1111
jpeg-dev \
1212
libevent-dev \
1313
libffi-dev \
14-
libressl-dev \
14+
openssl-dev \
1515
libxslt-dev \
1616
musl-dev \
1717
openldap-dev \
@@ -45,12 +45,11 @@ RUN apk add --no-cache \
4545
libevent \
4646
libffi \
4747
libjpeg-turbo \
48-
libressl \
48+
openssl \
4949
libxslt \
5050
postgresql-libs \
5151
python3 \
5252
py3-pip \
53-
ttf-ubuntu-font-family \
5453
unit \
5554
unit-python3
5655

@@ -75,6 +74,8 @@ WORKDIR /opt/netbox/netbox
7574
# to g+w so that pictures can be uploaded to netbox.
7675
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
7776
&& chmod -R g+w media /opt/unit/ \
77+
&& cd /opt/netbox/ && /opt/netbox/venv/bin/python -m mkdocs build \
78+
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \
7879
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
7980

8081
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.0
1+
1.3.0

build.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then
4949
echo " DOCKERFILE The name of Dockerfile to use."
5050
echo " Default: Dockerfile"
5151
echo " DOCKER_FROM The base image to use."
52-
echo " Default: 'alpine:3.13'"
52+
echo " Default: 'alpine:3.14'"
5353
echo " DOCKER_TARGET A specific target to build."
5454
echo " It's currently not possible to pass multiple targets."
5555
echo " Default: main ldap"
@@ -125,7 +125,7 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ]; then
125125

126126
(
127127
$DRY cd "${NETBOX_PATH}"
128-
128+
# shellcheck disable=SC2030
129129
if [ -n "${HTTP_PROXY}" ]; then
130130
git config http.proxy "${HTTP_PROXY}"
131131
fi
@@ -157,7 +157,7 @@ fi
157157
# Determining the value for DOCKER_FROM
158158
###
159159
if [ -z "$DOCKER_FROM" ]; then
160-
DOCKER_FROM="alpine:3.13"
160+
DOCKER_FROM="alpine:3.14"
161161
fi
162162

163163
###
@@ -345,6 +345,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
345345
if [ -n "${DOCKER_FROM}" ]; then
346346
DOCKER_BUILD_ARGS+=(--build-arg "FROM=${DOCKER_FROM}")
347347
fi
348+
# shellcheck disable=SC2031
348349
if [ -n "${HTTP_PROXY}" ]; then
349350
DOCKER_BUILD_ARGS+=(--build-arg "http_proxy=${HTTP_PROXY}")
350351
DOCKER_BUILD_ARGS+=(--build-arg "https_proxy=${HTTPS_PROXY}")

configuration/configuration.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def _read_secret(secret_name, default = None):
4848
# Database connection SSLMODE
4949
'CONN_MAX_AGE': int(environ.get('DB_CONN_MAX_AGE', '300')),
5050
# Max database connection age
51+
'DISABLE_SERVER_SIDE_CURSORS': environ.get('DB_DISABLE_SERVER_SIDE_CURSORS', 'False').lower() == 'true',
52+
# Disable the use of server-side cursors transaction pooling
5153
}
5254

5355
# Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate
@@ -106,9 +108,6 @@ def _read_secret(secret_name, default = None):
106108
# BASE_PATH = 'netbox/'
107109
BASE_PATH = environ.get('BASE_PATH', '')
108110

109-
# Cache timeout in seconds. Set to 0 to dissable caching. Defaults to 900 (15 minutes)
110-
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 900))
111-
112111
# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90)
113112
CHANGELOG_RETENTION = int(environ.get('CHANGELOG_RETENTION', 90))
114113

@@ -210,9 +209,6 @@ def _read_secret(secret_name, default = None):
210209
REMOTE_AUTH_AUTO_CREATE_USER = environ.get('REMOTE_AUTH_AUTO_CREATE_USER', 'True').lower() == 'true'
211210
REMOTE_AUTH_DEFAULT_GROUPS = list(filter(None, environ.get('REMOTE_AUTH_DEFAULT_GROUPS', '').split(' ')))
212211

213-
# This determines how often the GitHub API is called to check the latest release of NetBox. Must be at least 1 hour.
214-
RELEASE_CHECK_TIMEOUT = int(environ.get('RELEASE_CHECK_TIMEOUT', 24 * 3600))
215-
216212
# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
217213
# version check or use the URL below to check for release in the official NetBox repository.
218214
# https://api.github.com/repos/netbox-community/netbox/releases

docker-compose.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
ports:
2121
- 8080
2222
postgres:
23-
image: postgres:12-alpine
23+
image: postgres:13-alpine
2424
env_file: env/postgres.env
2525
redis:
2626
image: redis:6-alpine

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.4'
22
services:
33
netbox: &netbox
4-
image: netboxcommunity/netbox:${VERSION-latest}
4+
image: netboxcommunity/netbox:${VERSION-v3.0}
55
depends_on:
66
- postgres
77
- redis
@@ -29,7 +29,7 @@ services:
2929

3030
# postgres
3131
postgres:
32-
image: postgres:12-alpine
32+
image: postgres:13-alpine
3333
env_file: env/postgres.env
3434
volumes:
3535
- netbox-postgres-data:/var/lib/postgresql/data

docker/docker-entrypoint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ source /opt/netbox/venv/bin/activate
1515
DB_WAIT_TIMEOUT=${DB_WAIT_TIMEOUT-3}
1616
MAX_DB_WAIT_TIME=${MAX_DB_WAIT_TIME-30}
1717
CUR_DB_WAIT_TIME=0
18-
while ! ./manage.py migrate 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
18+
while ! ./manage.py showmigrations >/dev/null 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
1919
echo "⏳ Waiting on DB... (${CUR_DB_WAIT_TIME}s / ${MAX_DB_WAIT_TIME}s)"
2020
sleep "${DB_WAIT_TIMEOUT}"
2121
CUR_DB_WAIT_TIME=$((CUR_DB_WAIT_TIME + DB_WAIT_TIMEOUT))
@@ -24,6 +24,17 @@ if [ "${CUR_DB_WAIT_TIME}" -ge "${MAX_DB_WAIT_TIME}" ]; then
2424
echo "❌ Waited ${MAX_DB_WAIT_TIME}s or more for the DB to become ready."
2525
exit 1
2626
fi
27+
# Check if update is needed
28+
if ! ./manage.py migrate --check >/dev/null 2>&1; then
29+
echo "⚙️ Applying database migrations"
30+
./manage.py migrate --no-input
31+
echo "⚙️ Running trace_paths"
32+
./manage.py trace_paths --no-input
33+
echo "⚙️ Removing stale content types"
34+
./manage.py remove_stale_contenttypes --no-input
35+
echo "⚙️ Removing expired user sessions"
36+
./manage.py clearsessions
37+
fi
2738

2839
# Create Superuser if required
2940
if [ "$SKIP_SUPERUSER" == "true" ]; then

initializers/secret_roles.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

initializers/sites.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# status: active
2121
# facility: Amsterdam 3
2222
# asn: 67890
23+
# tenant: tenant1
2324
# custom_field_data:
2425
# text_field: Description for AMS3
2526
# - name: SING 1
@@ -28,5 +29,6 @@
2829
# status: active
2930
# facility: Singapore 1
3031
# asn: 09876
32+
# tenant: tenant2
3133
# custom_field_data:
3234
# text_field: Description for SING1

renovate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": [
3-
"config:base"
3+
"config:base",
4+
":disableDependencyDashboard"
45
],
56
"enabled": true,
67
"labels": ["maintenance"],

requirements-container.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
napalm==3.2.0
2-
ruamel.yaml==0.17.4
3-
django-auth-ldap==2.4.0
1+
napalm==3.3.1
2+
ruamel.yaml==0.17.16
3+
django-auth-ldap==3.0.0
44
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.11.1
File renamed without changes.

startup_scripts/310_secret_roles.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)