Skip to content

Commit

Permalink
Merge pull request #557 from netbox-community/develop
Browse files Browse the repository at this point in the history
Version 1.3.0: Compatibility with Netbox v3
  • Loading branch information
tobiasge committed Aug 30, 2021
2 parents 676ca79 + 8e0c795 commit 6c5434e
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Lint Code Base
uses: github/super-linter@v3
uses: github/super-linter@v4
env:
DEFAULT_BRANCH: develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apk add --no-cache \
jpeg-dev \
libevent-dev \
libffi-dev \
libressl-dev \
openssl-dev \
libxslt-dev \
musl-dev \
openldap-dev \
Expand Down Expand Up @@ -45,12 +45,11 @@ RUN apk add --no-cache \
libevent \
libffi \
libjpeg-turbo \
libressl \
openssl \
libxslt \
postgresql-libs \
python3 \
py3-pip \
ttf-ubuntu-font-family \
unit \
unit-python3

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

ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.3.0
7 changes: 4 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then
echo " DOCKERFILE The name of Dockerfile to use."
echo " Default: Dockerfile"
echo " DOCKER_FROM The base image to use."
echo " Default: 'alpine:3.13'"
echo " Default: 'alpine:3.14'"
echo " DOCKER_TARGET A specific target to build."
echo " It's currently not possible to pass multiple targets."
echo " Default: main ldap"
Expand Down Expand Up @@ -125,7 +125,7 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ]; then

(
$DRY cd "${NETBOX_PATH}"

# shellcheck disable=SC2030
if [ -n "${HTTP_PROXY}" ]; then
git config http.proxy "${HTTP_PROXY}"
fi
Expand Down Expand Up @@ -157,7 +157,7 @@ fi
# Determining the value for DOCKER_FROM
###
if [ -z "$DOCKER_FROM" ]; then
DOCKER_FROM="alpine:3.13"
DOCKER_FROM="alpine:3.14"
fi

###
Expand Down Expand Up @@ -345,6 +345,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
if [ -n "${DOCKER_FROM}" ]; then
DOCKER_BUILD_ARGS+=(--build-arg "FROM=${DOCKER_FROM}")
fi
# shellcheck disable=SC2031
if [ -n "${HTTP_PROXY}" ]; then
DOCKER_BUILD_ARGS+=(--build-arg "http_proxy=${HTTP_PROXY}")
DOCKER_BUILD_ARGS+=(--build-arg "https_proxy=${HTTPS_PROXY}")
Expand Down
8 changes: 2 additions & 6 deletions configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def _read_secret(secret_name, default = None):
# Database connection SSLMODE
'CONN_MAX_AGE': int(environ.get('DB_CONN_MAX_AGE', '300')),
# Max database connection age
'DISABLE_SERVER_SIDE_CURSORS': environ.get('DB_DISABLE_SERVER_SIDE_CURSORS', 'False').lower() == 'true',
# Disable the use of server-side cursors transaction pooling
}

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

# Cache timeout in seconds. Set to 0 to dissable caching. Defaults to 900 (15 minutes)
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 900))

# Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90)
CHANGELOG_RETENTION = int(environ.get('CHANGELOG_RETENTION', 90))

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

# This determines how often the GitHub API is called to check the latest release of NetBox. Must be at least 1 hour.
RELEASE_CHECK_TIMEOUT = int(environ.get('RELEASE_CHECK_TIMEOUT', 24 * 3600))

# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
# version check or use the URL below to check for release in the official NetBox repository.
# https://api.github.com/repos/netbox-community/netbox/releases
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
ports:
- 8080
postgres:
image: postgres:12-alpine
image: postgres:13-alpine
env_file: env/postgres.env
redis:
image: redis:6-alpine
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.4'
services:
netbox: &netbox
image: netboxcommunity/netbox:${VERSION-latest}
image: netboxcommunity/netbox:${VERSION-v3.0}
depends_on:
- postgres
- redis
Expand Down Expand Up @@ -29,7 +29,7 @@ services:

# postgres
postgres:
image: postgres:12-alpine
image: postgres:13-alpine
env_file: env/postgres.env
volumes:
- netbox-postgres-data:/var/lib/postgresql/data
Expand Down
13 changes: 12 additions & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source /opt/netbox/venv/bin/activate
DB_WAIT_TIMEOUT=${DB_WAIT_TIMEOUT-3}
MAX_DB_WAIT_TIME=${MAX_DB_WAIT_TIME-30}
CUR_DB_WAIT_TIME=0
while ! ./manage.py migrate 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
while ! ./manage.py showmigrations >/dev/null 2>&1 && [ "${CUR_DB_WAIT_TIME}" -lt "${MAX_DB_WAIT_TIME}" ]; do
echo "⏳ Waiting on DB... (${CUR_DB_WAIT_TIME}s / ${MAX_DB_WAIT_TIME}s)"
sleep "${DB_WAIT_TIMEOUT}"
CUR_DB_WAIT_TIME=$((CUR_DB_WAIT_TIME + DB_WAIT_TIMEOUT))
Expand All @@ -24,6 +24,17 @@ if [ "${CUR_DB_WAIT_TIME}" -ge "${MAX_DB_WAIT_TIME}" ]; then
echo "❌ Waited ${MAX_DB_WAIT_TIME}s or more for the DB to become ready."
exit 1
fi
# Check if update is needed
if ! ./manage.py migrate --check >/dev/null 2>&1; then
echo "⚙️ Applying database migrations"
./manage.py migrate --no-input
echo "⚙️ Running trace_paths"
./manage.py trace_paths --no-input
echo "⚙️ Removing stale content types"
./manage.py remove_stale_contenttypes --no-input
echo "⚙️ Removing expired user sessions"
./manage.py clearsessions
fi

# Create Superuser if required
if [ "$SKIP_SUPERUSER" == "true" ]; then
Expand Down
4 changes: 0 additions & 4 deletions initializers/secret_roles.yml

This file was deleted.

2 changes: 2 additions & 0 deletions initializers/sites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# status: active
# facility: Amsterdam 3
# asn: 67890
# tenant: tenant1
# custom_field_data:
# text_field: Description for AMS3
# - name: SING 1
Expand All @@ -28,5 +29,6 @@
# status: active
# facility: Singapore 1
# asn: 09876
# tenant: tenant2
# custom_field_data:
# text_field: Description for SING1
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": [
"config:base"
"config:base",
":disableDependencyDashboard"
],
"enabled": true,
"labels": ["maintenance"],
Expand Down
6 changes: 3 additions & 3 deletions requirements-container.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
napalm==3.2.0
ruamel.yaml==0.17.4
django-auth-ldap==2.4.0
napalm==3.3.1
ruamel.yaml==0.17.16
django-auth-ldap==3.0.0
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.11.1
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions startup_scripts/310_secret_roles.py

This file was deleted.

0 comments on commit 6c5434e

Please sign in to comment.