Skip to content

Commit ed62561

Browse files
authored
Merge pull request #394 from netbox-community/develop
Prepare version 1.0.0
2 parents aa4d630 + 5109e34 commit ed62561

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+646
-145
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,3 @@ If your log is very long, create a Gist instead (and post the link to it): https
6565
```text
6666
LOG LOG LOG
6767
```
68-
69-
The output of `docker-compose logs nginx`:
70-
<!--
71-
Only if you have gotten a 5xx http error, else delete this section.
72-
If your log is very long, create a Gist instead (and post the link to it): https://gist.github.com
73-
-->
74-
75-
```text
76-
LOG LOG LOG
77-
```

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: The \#netbox-docker Slack channel
4+
url: http://slack.networktocode.com/
5+
about: It's usually the quickest way to seek help when you're in trouble with regards to Netbox Docker.
6+
7+
- name: Github Discussions
8+
url: https://github.com/netbox-community/netbox-docker/discussions
9+
about: This is the right place to ask questions about how to use or do certain things with Netbox Docker.
10+
11+
- name: Have you had a look at our Wiki?
12+
url: https://github.com/netbox-community/netbox-docker/wiki
13+
about: Our wiki contains information for common problems and tips for operating Netbox Docker in production.

.github/workflows/push.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13+
continue-on-error: ${{ matrix.docker_from == 'alpine:edge' }}
1314
strategy:
1415
matrix:
1516
build_cmd:
@@ -19,7 +20,7 @@ jobs:
1920
- ./build.sh develop
2021
docker_from:
2122
- '' # use the default of the build script
22-
# - python:3.10-rc-alpine # disable until dependencies work
23+
- alpine:edge
2324
fail-fast: false
2425
runs-on: ubuntu-latest
2526
name: Builds new Netbox Docker Images

Dockerfile

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,15 @@ RUN apk add --no-cache \
1212
libffi-dev \
1313
libxslt-dev \
1414
openldap-dev \
15-
postgresql-dev
16-
17-
WORKDIR /install
18-
19-
RUN pip install --prefix="/install" --no-warn-script-location \
20-
# gunicorn is used for launching netbox
21-
gunicorn \
22-
greenlet \
23-
eventlet \
24-
# napalm is used for gathering information from network devices
25-
napalm \
26-
# ruamel is used in startup_scripts
27-
'ruamel.yaml>=0.15,<0.16' \
28-
# django_auth_ldap is required for ldap
29-
django_auth_ldap \
30-
# django-storages was introduced in 2.7 and is optional
31-
django-storages
15+
postgresql-dev \
16+
py3-pip \
17+
python3-dev \
18+
&& python3 -m venv /opt/netbox/venv \
19+
&& /opt/netbox/venv/bin/python3 -m pip install --upgrade pip setuptools
3220

3321
ARG NETBOX_PATH
34-
COPY ${NETBOX_PATH}/requirements.txt /
35-
RUN pip install --prefix="/install" --no-warn-script-location -r /requirements.txt
22+
COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt /
23+
RUN /opt/netbox/venv/bin/pip install -r /requirements.txt -r /requirements-container.txt
3624

3725
###
3826
# Main stage
@@ -44,42 +32,46 @@ FROM ${FROM} as main
4432
RUN apk add --no-cache \
4533
bash \
4634
ca-certificates \
35+
curl \
4736
graphviz \
4837
libevent \
4938
libffi \
5039
libjpeg-turbo \
5140
libressl \
5241
libxslt \
5342
postgresql-libs \
54-
ttf-ubuntu-font-family
43+
python3 \
44+
py3-pip \
45+
ttf-ubuntu-font-family \
46+
unit \
47+
unit-python3
5548

5649
WORKDIR /opt
5750

58-
COPY --from=builder /install /usr/local
51+
COPY --from=builder /opt/netbox/venv /opt/netbox/venv
5952

6053
ARG NETBOX_PATH
6154
COPY ${NETBOX_PATH} /opt/netbox
6255

6356
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
64-
COPY docker/gunicorn_config.py /etc/netbox/
65-
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
6657
COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh
58+
COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh
6759
COPY startup_scripts/ /opt/netbox/startup_scripts/
6860
COPY initializers/ /opt/netbox/initializers/
6961
COPY configuration/ /etc/netbox/config/
62+
COPY docker/nginx-unit.json /etc/unit/
7063

7164
WORKDIR /opt/netbox/netbox
7265

73-
# Must set permissions for '/opt/netbox/netbox/static' directory
74-
# to g+w so that `./manage.py collectstatic` can be executed during
75-
# container startup.
7666
# Must set permissions for '/opt/netbox/netbox/media' directory
7767
# to g+w so that pictures can be uploaded to netbox.
78-
RUN mkdir static && chmod -R g+w static media
68+
RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
69+
&& chmod -R g+w media /opt/unit/ \
70+
&& SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
7971

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

82-
CMD ["gunicorn", "-c /etc/netbox/gunicorn_config.py", "netbox.wsgi"]
74+
CMD [ "/opt/netbox/launch-netbox.sh" ]
8375

8476
LABEL ORIGINAL_TAG="" \
8577
NETBOX_GIT_BRANCH="" \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cd netbox-docker
5656
tee docker-compose.override.yml <<EOF
5757
version: '3.4'
5858
services:
59-
nginx:
59+
netbox:
6060
ports:
6161
- 8000:8080
6262
EOF

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.27.0
1+
1.0.0

build.sh

Lines changed: 7 additions & 7 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: 'python:3.9-alpine'"
52+
echo " Default: 'alpine:3.13'"
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"
@@ -106,7 +106,7 @@ else
106106
fi
107107

108108
###
109-
# Variables for fetching the source
109+
# Variables for fetching the Netbox source
110110
###
111111
SRC_ORG="${SRC_ORG-netbox-community}"
112112
SRC_REPO="${SRC_REPO-netbox}"
@@ -115,10 +115,10 @@ URL="${URL-https://github.com/${SRC_ORG}/${SRC_REPO}.git}"
115115
NETBOX_PATH="${NETBOX_PATH-.netbox}"
116116

117117
###
118-
# Fetching the source
118+
# Fetching the Netbox source
119119
###
120120
if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then
121-
echo "🌐 Checking out '${NETBOX_BRANCH}' of netbox from the url '${URL}' into '${NETBOX_PATH}'"
121+
echo "🌐 Checking out '${NETBOX_BRANCH}' of Netbox from the url '${URL}' into '${NETBOX_PATH}'"
122122
if [ ! -d "${NETBOX_PATH}" ]; then
123123
$DRY git clone -q --depth 10 -b "${NETBOX_BRANCH}" "${URL}" "${NETBOX_PATH}"
124124
fi
@@ -135,7 +135,7 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then
135135
$DRY git checkout -qf FETCH_HEAD
136136
$DRY git prune
137137
)
138-
echo "✅ Checked out netbox"
138+
echo "✅ Checked out Netbox"
139139
fi
140140

141141
###
@@ -157,7 +157,7 @@ fi
157157
# Determining the value for DOCKER_FROM
158158
###
159159
if [ -z "$DOCKER_FROM" ]; then
160-
DOCKER_FROM="python:3.9-alpine"
160+
DOCKER_FROM="alpine:3.13"
161161
fi
162162

163163
###
@@ -271,7 +271,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
271271

272272
if ! printf '%s\n' "${IMAGES_LAYERS_OLD[@]}" | grep -q -P "^${PYTHON_LAST_LAYER}\$"; then
273273
SHOULD_BUILD="true"
274-
BUILD_REASON="${BUILD_REASON} python"
274+
BUILD_REASON="${BUILD_REASON} alpine"
275275
fi
276276
if [ "${NETBOX_GIT_REF}" != "${NETBOX_GIT_REF_OLD}" ]; then
277277
SHOULD_BUILD="true"

docker-compose.test.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,18 @@ services:
77
- redis
88
- redis-cache
99
env_file: env/netbox.env
10+
environment:
11+
SKIP_STARTUP_SCRIPTS: ${SKIP_STARTUP_SCRIPTS-false}
1012
user: '101'
1113
volumes:
1214
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
1315
- ./${INITIALIZERS_DIR-initializers}:/opt/netbox/initializers:z,ro
1416
- ./configuration:/etc/netbox/config:z,ro
1517
- ./reports:/etc/netbox/reports:z,ro
1618
- ./scripts:/etc/netbox/scripts:z,ro
17-
- netbox-nginx-config:/etc/netbox-nginx:z
18-
- netbox-static-files:/opt/netbox/netbox/static:z
1919
- netbox-media-files:/opt/netbox/netbox/media:z
20-
nginx:
21-
command: nginx -c /etc/netbox-nginx/nginx.conf
22-
image: nginx:1.19-alpine
23-
depends_on:
24-
- netbox
2520
ports:
2621
- 8080
27-
volumes:
28-
- netbox-static-files:/opt/netbox/netbox/static:ro
29-
- netbox-nginx-config:/etc/netbox-nginx/:ro
3022
postgres:
3123
image: postgres:12-alpine
3224
env_file: env/postgres.env
@@ -45,9 +37,5 @@ services:
4537
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
4638
env_file: env/redis-cache.env
4739
volumes:
48-
netbox-static-files:
49-
driver: local
50-
netbox-nginx-config:
51-
driver: local
5240
netbox-media-files:
5341
driver: local

docker-compose.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,19 @@ services:
1515
- ./configuration:/etc/netbox/config:z,ro
1616
- ./reports:/etc/netbox/reports:z,ro
1717
- ./scripts:/etc/netbox/scripts:z,ro
18-
- netbox-nginx-config:/etc/netbox-nginx:z
19-
- netbox-static-files:/opt/netbox/netbox/static:z
2018
- netbox-media-files:/opt/netbox/netbox/media:z
19+
ports:
20+
- "8080"
2121
netbox-worker:
2222
<<: *netbox
2323
depends_on:
2424
- redis
2525
entrypoint:
26-
- python3
26+
- /opt/netbox/venv/bin/python
2727
- /opt/netbox/netbox/manage.py
2828
command:
2929
- rqworker
30-
31-
# nginx
32-
nginx:
33-
command: nginx -c /etc/netbox-nginx/nginx.conf
34-
image: nginx:1.19-alpine
35-
depends_on:
36-
- netbox
37-
ports:
38-
- 8080
39-
volumes:
40-
- netbox-static-files:/opt/netbox/netbox/static:ro
41-
- netbox-nginx-config:/etc/netbox-nginx/:ro
30+
ports: []
4231

4332
# postgres
4433
postgres:
@@ -66,10 +55,6 @@ services:
6655
env_file: env/redis-cache.env
6756

6857
volumes:
69-
netbox-static-files:
70-
driver: local
71-
netbox-nginx-config:
72-
driver: local
7358
netbox-media-files:
7459
driver: local
7560
netbox-postgres-data:

docker/configuration.docker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import importlib.util
1010
import sys
1111

12+
1213
def _filename(f):
1314
return f.name
1415

0 commit comments

Comments
 (0)