Merge pull request #951 from tobiasge/new-unit

Updated to new unit version
This commit is contained in:
Tobias Genannt 2023-03-01 08:53:24 +01:00 committed by GitHub
commit 5f8a09536c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 23 deletions

View File

@ -66,8 +66,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq \ && apt-get update -qq \
&& apt-get install \ && apt-get install \
--yes -qq --no-install-recommends \ --yes -qq --no-install-recommends \
unit=1.27.0-1~jammy \ unit=1.29.1-1~jammy \
unit-python3.10=1.27.0-1~jammy \ unit-python3.10=1.29.1-1~jammy \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/netbox/venv /opt/netbox/venv COPY --from=builder /opt/netbox/venv /opt/netbox/venv
@ -94,7 +94,7 @@ RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \
--config-file /opt/netbox/mkdocs.yml --site-dir /opt/netbox/netbox/project-static/docs/ \ --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 && SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
ENV LANG=C.UTF-8 PATH=/opt/netbox/venv/bin:$PATH ENV LANG=C.utf8 PATH=/opt/netbox/venv/bin:$PATH
ENTRYPOINT [ "/usr/bin/tini", "--" ] ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ] CMD [ "/opt/netbox/docker-entrypoint.sh", "/opt/netbox/launch-netbox.sh" ]

View File

@ -332,7 +332,7 @@ elif [[ "${IMAGE_NAME_TAGS[0]}" = docker.io* ]]; then
if ! printf '%s\n' "${IMAGES_LAYERS_OLD[@]}" | grep -q -P "^${BASE_LAST_LAYER}\$"; then if ! printf '%s\n' "${IMAGES_LAYERS_OLD[@]}" | grep -q -P "^${BASE_LAST_LAYER}\$"; then
SHOULD_BUILD="true" SHOULD_BUILD="true"
BUILD_REASON="${BUILD_REASON} debian" BUILD_REASON="${BUILD_REASON} ubuntu"
fi fi
if [ "${NETBOX_GIT_REF}" != "${NETBOX_GIT_REF_OLD}" ]; then if [ "${NETBOX_GIT_REF}" != "${NETBOX_GIT_REF_OLD}" ]; then
SHOULD_BUILD="true" SHOULD_BUILD="true"

View File

@ -2,7 +2,10 @@ version: '3.4'
services: services:
netbox: netbox:
ports: ports:
- 8000:8080 - "8000:8080"
# If you want the Nginx unit status page visible from the
# outside of the container add the following port mapping:
# - "8001:8081"
healthcheck: healthcheck:
# Time for which the health check can fail after the container is started. # Time for which the health check can fail after the container is started.
# This depends mostly on the performance of your database. On the first start, # This depends mostly on the performance of your database. On the first start,

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
UNIT_CONFIG="${UNIT_CONFIG-/etc/unit/nginx-unit.json}" UNIT_CONFIG="${UNIT_CONFIG-/etc/unit/nginx-unit.json}"
# Also used in "nginx-unit.json"
UNIT_SOCKET="/opt/unit/unit.sock" UNIT_SOCKET="/opt/unit/unit.sock"
load_configuration() { load_configuration() {

View File

@ -1,30 +1,45 @@
{ {
"listeners": { "listeners": {
"0.0.0.0:8080": { "0.0.0.0:8080": {
"pass": "routes" "pass": "routes/main"
}, },
"[::]:8080": { "[::]:8080": {
"pass": "routes" "pass": "routes/main"
},
"0.0.0.0:8081": {
"pass": "routes/status"
},
"[::]:8081": {
"pass": "routes/status"
} }
}, },
"routes": {
"routes": [ "main": [
{ {
"match": { "match": {
"uri": "/static/*" "uri": "/static/*"
},
"action": {
"share": "/opt/netbox/netbox${uri}"
}
}, },
"action": { {
"share": "/opt/netbox/netbox${uri}" "action": {
"pass": "applications/netbox"
}
} }
}, ],
"status": [
{ {
"action": { "match": {
"pass": "applications/netbox" "uri": "/status/*"
},
"action": {
"proxy": "http://unix:/opt/unit/unit.sock"
}
} }
} ]
], },
"applications": { "applications": {
"netbox": { "netbox": {
"type": "python 3", "type": "python 3",
@ -38,6 +53,5 @@
} }
} }
}, },
"access_log": "/dev/stdout" "access_log": "/dev/stdout"
} }