diff --git a/Dockerfile b/Dockerfile index 8e9ba9b..4f3b5a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,12 @@ COPY plugin_requirements.txt /opt/netbox/ RUN /usr/local/bin/uv pip install -r /opt/netbox/plugin_requirements.txt COPY configuration/plugins.py /etc/netbox/config/plugins.py +COPY configuration/base_path.py /etc/netbox/config/base_path.py COPY configuration/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -COPY entrypoint.sh /opt/netbox/entrypoint.sh +COPY docker/entrypoint.sh /opt/netbox/entrypoint.sh +COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh -LABEL internal_version="4.6.1.0" +LABEL internal_version="4.6.1.1" LABEL prometheus_scrape="true" LABEL prometheus_address="netbox:8080" diff --git a/README.md b/README.md index 087927d..1265284 100644 --- a/README.md +++ b/README.md @@ -22,5 +22,7 @@ On your favorite terminal (that we know the best terminal is env TAG=latest IMAGE=saashup/netbox-docker docker compose up -d ``` +Unlike [the official Netbox Docker distribution](https://github.com/netbox-community/netbox-docker), we have acivated the [BASE_PATH](https://netboxlabs.com/docs/netbox/configuration/system/#base_path) environment variable. + # Hosting Check https://saashup.com for more information. diff --git a/configuration/base_path.py b/configuration/base_path.py new file mode 100644 index 0000000..b8d456c --- /dev/null +++ b/configuration/base_path.py @@ -0,0 +1,3 @@ +from os import environ + +BASE_PATH = environ.get("BASE_PATH", "") diff --git a/entrypoint.sh b/docker/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to docker/entrypoint.sh diff --git a/docker/launch-netbox.sh b/docker/launch-netbox.sh new file mode 100755 index 0000000..0844457 --- /dev/null +++ b/docker/launch-netbox.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ -n "$BASE_PATH" ]; then + STATIC_PATH="/${BASE_PATH}static" +else + STATIC_PATH="/static" +fi + +echo $STATIC_PATH + +exec granian \ + --host "::" \ + --port "8080" \ + --interface "wsgi" \ + --no-ws \ + --workers "${GRANIAN_WORKERS:-4}" \ + --respawn-failed-workers \ + --backpressure "${GRANIAN_BACKPRESSURE:-${GRANIAN_WORKERS:-4}}" \ + --loop "uvloop" \ + --log \ + --log-level "info" \ + --access-log \ + --working-dir "/opt/netbox/netbox/" \ + --static-path-route "${STATIC_PATH}" \ + --static-path-mount "/opt/netbox/netbox/static/" \ + --static-path-dir-to-file index.html \ + --pid-file "/tmp/granian.pid" \ + "${GRANIAN_EXTRA_ARGS[@]}" \ + "netbox.granian:application"