Merge branch 'develop' of github.com:dmetzler1988/netbox-docker into bugfix/docker-port-issue

This commit is contained in:
Daniel Metzler 2021-06-29 09:54:06 +02:00
commit f8384384e3
11 changed files with 22 additions and 27 deletions

View File

@ -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 }}

View File

@ -50,7 +50,6 @@ RUN apk add --no-cache \
postgresql-libs \
python3 \
py3-pip \
ttf-ubuntu-font-family \
unit \
unit-python3

View File

@ -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

View File

@ -1,7 +1,7 @@
version: '3.4'
services:
netbox: &netbox
image: netboxcommunity/netbox:${VERSION-latest}
image: netboxcommunity/netbox:${VERSION-v2.11}
depends_on:
- postgres
- redis
@ -28,7 +28,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

View File

@ -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,19 @@ 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
echo "⚙️ Clearing cache data"
./manage.py invalidate all
fi
# Create Superuser if required
if [ "$SKIP_SUPERUSER" == "true" ]; then

View File

@ -1,4 +0,0 @@
# - name: Super Secret Passwords
# slug: super-secret
# - name: SNMP Communities
# slug: snmp

View File

@ -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

View File

@ -1,4 +1,4 @@
napalm==3.2.0
ruamel.yaml==0.17.4
napalm==3.3.1
ruamel.yaml==0.17.9
django-auth-ldap==2.4.0
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.11.1

View File

@ -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)