mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-25 09:23:14 +01:00
Move config to /etc/netbox/config (Fixes #54)
With this the configuration is moved to /etc/netbox/config and the default reports directory is set to /etc/netbox/reports. This enables the user to mount reports from a config map or persistent volume in OpenShift.
This commit is contained in:
parent
5b62a4c0ad
commit
b46bd58e0a
@ -35,12 +35,12 @@ WORKDIR /opt/netbox
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
|
||||
COPY configuration/gunicorn_config.py /etc/netbox/
|
||||
COPY configuration/gunicorn_config.py /etc/netbox/config/
|
||||
COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf
|
||||
COPY docker/docker-entrypoint.sh docker-entrypoint.sh
|
||||
COPY startup_scripts/ /opt/netbox/startup_scripts/
|
||||
COPY initializers/ /opt/netbox/initializers/
|
||||
COPY configuration/configuration.py /etc/netbox/configuration.py
|
||||
COPY configuration/configuration.py /etc/netbox/config/configuration.py
|
||||
|
||||
WORKDIR /opt/netbox/netbox
|
||||
|
||||
@ -48,7 +48,7 @@ ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
|
||||
|
||||
VOLUME ["/etc/netbox-nginx/"]
|
||||
|
||||
CMD ["gunicorn", "-c /etc/netbox/gunicorn_config.py", "netbox.wsgi"]
|
||||
CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"]
|
||||
|
||||
LABEL SRC_URL="$URL"
|
||||
|
||||
|
@ -6,4 +6,4 @@ FROM $DOCKER_ORG/$DOCKER_REPO:$FROM_TAG
|
||||
RUN pip install django_auth_ldap
|
||||
|
||||
COPY docker/ldap_config.docker.py /opt/netbox/netbox/netbox/ldap_config.py
|
||||
COPY configuration/ldap_config.py /etc/netbox/ldap_config.py
|
||||
COPY configuration/ldap_config.py /etc/netbox/config/ldap_config.py
|
||||
|
@ -80,7 +80,7 @@ You should therefore adjust the configuration for production setups, at least th
|
||||
|
||||
You may run this image in a cluster such as Docker Swarm, Kubernetes or OpenShift, but this is advanced level.
|
||||
|
||||
In this case, we encourage you to statically configure NetBox by starting from [NetBox's example config file][default-config], and mounting it into your container in the directory `/etc/netbox/` using the mechanism provided by your container platform (i.e. [Docker Swarm configs][swarm-config], [Kubernetes ConfigMap][k8s-config], [OpenShift ConfigMaps][openshift-config]).
|
||||
In this case, we encourage you to statically configure NetBox by starting from [NetBox's example config file][default-config], and mounting it into your container in the directory `/etc/netbox/config/` using the mechanism provided by your container platform (i.e. [Docker Swarm configs][swarm-config], [Kubernetes ConfigMap][k8s-config], [OpenShift ConfigMaps][openshift-config]).
|
||||
|
||||
But if you rather continue to configure your application through environment variables, you may continue to use [the built-in configuration file][docker-config].
|
||||
We discourage storing secrets in environment variables, as environment variable are passed on to all sub-processes and may leak easily into other systems, e.g. error collecting tools that often collect all environment variables whenever an error occurs.
|
||||
|
@ -141,7 +141,7 @@ PREFER_IPV4 = os.environ.get('PREFER_IPV4', 'False').lower() == 'true'
|
||||
|
||||
# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
|
||||
# this setting is derived from the installed location.
|
||||
REPORTS_ROOT = os.environ.get('REPORTS_ROOT', os.path.join(BASE_DIR, 'reports'))
|
||||
REPORTS_ROOT = os.environ.get('REPORTS_ROOT', '/etc/netbox/reports')
|
||||
|
||||
# Time zone (default: UTC)
|
||||
TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')
|
||||
|
@ -10,7 +10,7 @@ services:
|
||||
- postgres
|
||||
env_file: netbox.env
|
||||
volumes:
|
||||
- ./configuration:/etc/netbox:ro
|
||||
- ./configuration:/etc/netbox/config:ro
|
||||
command:
|
||||
- ./manage.py
|
||||
- test
|
||||
|
@ -12,11 +12,11 @@ services:
|
||||
volumes:
|
||||
- ./startup_scripts:/opt/netbox/startup_scripts:ro
|
||||
- ./initializers:/opt/netbox/initializers:ro
|
||||
- ./configuration:/etc/netbox:ro
|
||||
- ./configuration:/etc/netbox/config:ro
|
||||
- netbox-nginx-config:/etc/netbox-nginx/
|
||||
- netbox-static-files:/opt/netbox/netbox/static
|
||||
- netbox-media-files:/opt/netbox/netbox/media
|
||||
- netbox-report-files:/opt/netbox/netbox/reports
|
||||
- netbox-report-files:/etc/netbox/reports:ro
|
||||
nginx:
|
||||
image: nginx:1.13-alpine
|
||||
command: nginx -g 'daemon off;' -c /etc/netbox-nginx/nginx.conf
|
||||
|
@ -2,7 +2,7 @@ import importlib.util
|
||||
import sys
|
||||
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location('configuration', '/etc/netbox/configuration.py')
|
||||
spec = importlib.util.spec_from_file_location('configuration', '/etc/netbox/config/configuration.py')
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
sys.modules['netbox.configuration'] = module
|
||||
|
@ -2,7 +2,7 @@ import importlib.util
|
||||
import sys
|
||||
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location('ldap_config', '/etc/netbox/ldap_config.py')
|
||||
spec = importlib.util.spec_from_file_location('ldap_config', '/etc/netbox/config/ldap_config.py')
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
sys.modules['netbox.ldap_config'] = module
|
||||
|
Loading…
Reference in New Issue
Block a user