Skip to content

Commit 39c7de4

Browse files
authored
Merge pull request #899 from netbox-community/develop
Release 2.4.0
2 parents 8b16b16 + 238f95c commit 39c7de4

11 files changed

+79
-34
lines changed

β€Ž.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
LINTER_RULES_PATH: /
3232
VALIDATE_ALL_CODEBASE: false
3333
VALIDATE_DOCKERFILE: false
34+
VALIDATE_GITLEAKS: false
3435
FILTER_REGEX_EXCLUDE: (.*/)?(LICENSE|configuration/.*)
3536
EDITORCONFIG_FILE_NAME: .ecrc
3637
DOCKERFILE_HADOLINT_FILE_NAME: .hadolint.yaml

β€ŽDockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ RUN export DEBIAN_FRONTEND=noninteractive \
1313
libpq-dev \
1414
libsasl2-dev \
1515
libssl-dev \
16+
libxml2-dev \
17+
libxml2-dev \
18+
libxmlsec1 \
19+
libxmlsec1-dev \
20+
libxmlsec1-openssl \
21+
libxslt-dev \
22+
pkg-config \
1623
python3-dev \
1724
python3-pip \
1825
python3-venv \
@@ -24,7 +31,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
2431

2532
ARG NETBOX_PATH
2633
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
27-
RUN /opt/netbox/venv/bin/pip install \
34+
RUN sed -i -e '/psycopg2-binary/d' requirements.txt && \
35+
/opt/netbox/venv/bin/pip install \
2836
-r /requirements.txt \
2937
-r /requirements-container.txt
3038

@@ -46,6 +54,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
4654
curl \
4755
libldap-common \
4856
libpq5 \
57+
libxmlsec1-openssl \
4958
openssl \
5059
python3 \
5160
python3-distutils \

β€ŽVERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.4.0

β€Žconfiguration/ldap/ldap_config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ def _import_group_type(group_type_name):
4949
# ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
5050
LDAP_IGNORE_CERT_ERRORS = environ.get('LDAP_IGNORE_CERT_ERRORS', 'False').lower() == 'true'
5151

52+
# Include this setting if you want to validate the LDAP server certificates against a CA certificate directory on your server
53+
# Note that this is a NetBox-specific setting which sets:
54+
# ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, LDAP_CA_CERT_DIR)
55+
LDAP_CA_CERT_DIR = environ.get('LDAP_CA_CERT_DIR', None)
56+
57+
# Include this setting if you want to validate the LDAP server certificates against your own CA.
58+
# Note that this is a NetBox-specific setting which sets:
59+
# ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, LDAP_CA_CERT_FILE)
60+
LDAP_CA_CERT_FILE = environ.get('LDAP_CA_CERT_FILE', None)
61+
5262
AUTH_LDAP_USER_SEARCH_BASEDN = environ.get('AUTH_LDAP_USER_SEARCH_BASEDN', '')
5363
AUTH_LDAP_USER_SEARCH_ATTR = environ.get('AUTH_LDAP_USER_SEARCH_ATTR', 'sAMAccountName')
5464
AUTH_LDAP_USER_SEARCH = LDAPSearch(

β€Ždocker-compose.test.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ services:
33
netbox:
44
image: ${IMAGE-netboxcommunity/netbox:latest}
55
depends_on:
6-
- postgres
7-
- redis
8-
- redis-cache
6+
postgres:
7+
condition: service_healthy
8+
redis:
9+
condition: service_started
10+
redis-cache:
11+
condition: service_started
912
env_file: env/netbox.env
10-
environment:
11-
SKIP_STARTUP_SCRIPTS: ${SKIP_STARTUP_SCRIPTS-false}
1213
user: 'unit:root'
1314
volumes:
1415
- ./configuration:/etc/netbox/config:z,ro
@@ -17,8 +18,13 @@ services:
1718
- ./scripts:/etc/netbox/scripts:z,ro
1819
- netbox-media-files:/opt/netbox/netbox/media:z
1920
postgres:
20-
image: postgres:14-alpine
21+
image: postgres:15-alpine
2122
env_file: env/postgres.env
23+
healthcheck:
24+
test: ["CMD-SHELL", "pg_isready"]
25+
interval: 10s
26+
timeout: 5s
27+
retries: 5
2228
redis:
2329
image: redis:7-alpine
2430
command:

β€Ždocker-compose.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
version: '3.4'
22
services:
33
netbox: &netbox
4-
image: netboxcommunity/netbox:${VERSION-v3.3-2.3.0}
4+
image: netboxcommunity/netbox:${VERSION-v3.4-2.4.0}
55
depends_on:
66
- postgres
77
- redis
88
- redis-cache
9-
- netbox-worker
109
env_file: env/netbox.env
1110
user: 'unit:root'
11+
healthcheck:
12+
start_period: 60s
13+
timeout: 3s
14+
interval: 15s
15+
test: "curl -f http://localhost:8080/api/ || exit 1"
1216
volumes:
1317
- ./configuration:/etc/netbox/config:z,ro
1418
- ./reports:/etc/netbox/reports:z,ro
@@ -17,23 +21,33 @@ services:
1721
netbox-worker:
1822
<<: *netbox
1923
depends_on:
20-
- redis
21-
- postgres
24+
netbox:
25+
condition: service_healthy
2226
command:
2327
- /opt/netbox/venv/bin/python
2428
- /opt/netbox/netbox/manage.py
2529
- rqworker
30+
healthcheck:
31+
start_period: 20s
32+
timeout: 3s
33+
interval: 15s
34+
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
2635
netbox-housekeeping:
2736
<<: *netbox
2837
depends_on:
29-
- redis
30-
- postgres
38+
netbox:
39+
condition: service_healthy
3140
command:
3241
- /opt/netbox/housekeeping.sh
42+
healthcheck:
43+
start_period: 20s
44+
timeout: 3s
45+
interval: 15s
46+
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
3347

3448
# postgres
3549
postgres:
36-
image: postgres:14-alpine
50+
image: postgres:15-alpine
3751
env_file: env/postgres.env
3852
volumes:
3953
- netbox-postgres-data:/var/lib/postgresql/data
@@ -56,7 +70,7 @@ services:
5670
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
5771
env_file: env/redis-cache.env
5872
volumes:
59-
- netbox-redis-cache-data:/data
73+
- netbox-redis-cache-data:/data
6074

6175
volumes:
6276
netbox-media-files:
@@ -66,4 +80,4 @@ volumes:
6680
netbox-redis-data:
6781
driver: local
6882
netbox-redis-cache-data:
69-
driver: local
83+
driver: local

β€Ždocker/docker-entrypoint.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ END
8080
echo "πŸ’‘ Superuser Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}"
8181
fi
8282

83-
# Print warning if startup scripts (and initializers) would've been run # Remove for next release
84-
if [ "$SKIP_STARTUP_SCRIPTS" == "true" ]; then
85-
# Nothing to do
86-
echo "" # Empty block not allowed
87-
else
88-
echo "⚠️⚠️⚠️ WARNING: The initializers have been moved to a plugin. See release notes."
89-
echo "⚠️⚠️⚠️ Set environment variable 'SKIP_STARTUP_SCRIPTS' to 'true' to remove this warning."
90-
fi
91-
9283
echo "βœ… Initialisation is done."
9384

9485
# Launch whatever is passed by docker

β€Ždocker/housekeeping.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
2-
SECONDS=${HOUSEKEEPING_INTERVAL:=86400}
3-
echo "Interval set to ${SECONDS} seconds"
2+
SLEEP_SECONDS=${HOUSEKEEPING_INTERVAL:=86400}
3+
echo "Interval set to ${SLEEP_SECONDS} seconds"
44
while true; do
55
date
66
/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping
7-
sleep "${SECONDS}s"
7+
sleep "${SLEEP_SECONDS}s"
88
done

β€Ždocker/nginx-unit.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"listeners": {
3-
"*:8080": {
3+
"0.0.0.0:8080": {
4+
"pass": "routes"
5+
},
6+
"[::]:8080": {
47
"pass": "routes"
58
}
69
},

β€Žrequirements-container.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
django-auth-ldap==4.1.0
22
django-storages[azure,boto3,dropbox,google,libcloud,sftp]==1.13.1
33
napalm==4.0.0
4-
psycopg2==2.9.4
5-
social-auth-core[openidconnect]==4.3.0
4+
psycopg2==2.9.5
5+
python3-saml==1.14.0
6+
social-auth-core[all]==4.3.0

β€Žtest.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,29 @@ if [ -z "${IMAGE}" ]; then
3535
fi
3636

3737
# The docker compose command to use
38-
doco="docker-compose --file docker-compose.test.yml --project-name netbox_docker_test_${1}"
38+
doco="docker compose --file docker-compose.test.yml --project-name netbox_docker_test"
3939

4040
test_setup() {
4141
echo "πŸ— Setup up test environment"
42+
$doco up --detach --quiet-pull --wait --force-recreate --renew-anon-volumes --no-start
43+
$doco start postgres
44+
$doco start redis
45+
$doco start redis-cache
4246
}
4347

4448
test_netbox_unit_tests() {
4549
echo "⏱ Running NetBox Unit Tests"
4650
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py test
4751
}
4852

53+
test_compose_db_setup() {
54+
echo "⏱ Running NetBox DB migrations"
55+
$doco run --rm netbox /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate
56+
}
57+
4958
test_cleanup() {
5059
echo "πŸ’£ Cleaning Up"
51-
$doco down -v
60+
$doco down --volumes
5261
}
5362

5463
echo "🐳🐳🐳 Start testing '${IMAGE}'"
@@ -58,5 +67,6 @@ trap test_cleanup EXIT ERR
5867
test_setup
5968

6069
test_netbox_unit_tests
70+
test_compose_db_setup
6171

6272
echo "🐳🐳🐳 Done testing '${IMAGE}'"

0 commit comments

Comments
Β (0)