Merge pull request #557 from netbox-community/develop
Version 1.3.0: Compatibility with Netbox v3
This commit is contained in:
commit
6c5434ee20
|
@ -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 }}
|
||||
|
|
|
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
|
@ -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" ]
|
||||
|
|
7
build.sh
7
build.sh
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
###
|
||||
|
@ -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}")
|
||||
|
|
|
@ -48,6 +48,8 @@ DATABASE = {
|
|||
# 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
|
||||
|
@ -106,9 +108,6 @@ BANNER_LOGIN = environ.get('BANNER_LOGIN', '')
|
|||
# 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))
|
||||
|
||||
|
@ -210,9 +209,6 @@ REMOTE_AUTH_HEADER = environ.get('REMOTE_AUTH_HEADER', 'HTTP_REMOTE_USER')
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
@ -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
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# - name: Super Secret Passwords
|
||||
# slug: super-secret
|
||||
# - name: SNMP Communities
|
||||
# slug: snmp
|
|
@ -20,6 +20,7 @@
|
|||
# status: active
|
||||
# facility: Amsterdam 3
|
||||
# asn: 67890
|
||||
# tenant: tenant1
|
||||
# custom_field_data:
|
||||
# text_field: Description for AMS3
|
||||
# - name: SING 1
|
||||
|
@ -28,5 +29,6 @@
|
|||
# status: active
|
||||
# facility: Singapore 1
|
||||
# asn: 09876
|
||||
# tenant: tenant2
|
||||
# custom_field_data:
|
||||
# text_field: Description for SING1
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
"config:base",
|
||||
":disableDependencyDashboard"
|
||||
],
|
||||
"enabled": true,
|
||||
"labels": ["maintenance"],
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import sys
|
||||
from secrets.models import SecretRole
|
||||
|
||||
from startup_script_utils import load_yaml
|
||||
|
||||
secret_roles = load_yaml("/opt/netbox/initializers/secret_roles.yml")
|
||||
|
||||
if secret_roles is None:
|
||||
sys.exit()
|
||||
|
||||
for params in secret_roles:
|
||||
secret_role, created = SecretRole.objects.get_or_create(**params)
|
||||
|
||||
if created:
|
||||
print("🔑 Created Secret Role", secret_role.name)
|
Loading…
Reference in New Issue