Skip to content

Commit

Permalink
A migrate-able configuration
Browse files Browse the repository at this point in the history
Closes #7
  • Loading branch information
edwardtheharris committed Aug 5, 2024
1 parent b51dde6 commit 285d754
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
19 changes: 16 additions & 3 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM python:3.11-alpine AS nautobot
LABEL io.ghcr.edwardtheharris.helm-nautobot.editor="Xander Harris"
LABEL io.ghcr.edwardtheharris.helm-nautobot.name="nautobot"
LABEL org.opencontainers.image.source="https://github.com/edwardtheharris/helm-nautobot"
LABEL io.ghcr.edwardtheharris.helm-nautobot.version="0.0.1"
LABEL io.ghcr.edwardtheharris.helm-nautobot.version="0.0.1.rc26"
USER root
COPY container/entrypoint.sh /bin/entrypoint.sh
RUN apk add --no-cache \
Expand All @@ -21,8 +21,21 @@ RUN apk add --no-cache \
zlib-dev \
&& groupadd nautobot \
&& useradd -m -d /opt/nautobot -s /bin/bash -g nautobot nautobot \
&& chmod +x /bin/entrypoint.sh
&& chmod +x /bin/entrypoint.sh \
&& python -m pip install --no-cache-dir -U --pre \
loguru \
--no-binary=lxml \
--no-binary=xmlsec \
nautobot[sso] \
pip \
wheel
USER nautobot
RUN python -m venv /opt/nautobot \
&& /opt/nautobot/bin/pip install -U --pre nautobot pip wheel
&& /opt/nautobot/bin/pip install --no-cache-dir -U --pre \
loguru \
--no-binary=lxml \
--no-binary=xmlsec \
nautobot[sso] \
pip \
wheel
CMD ["/bin/entrypoint.sh"]
16 changes: 11 additions & 5 deletions nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
logger.debug(STORAGE_BACKEND)
logger.debug(STORAGE_CONFIG)

AUTH_USER_MODEL = "users.User"
AUTHENTICATION_BACKENDS = [
"social_core.backends.github.GithubOAuth2",
"nautobot.core.authentication.ObjectPermissionBackend",
]
logger.debug(f'{AUTHENTICATION_BACKENDS}')

# The django-redis cache is used to establish concurrent locks using Redis.
#
# "django_prometheus.cache.backends.redis.RedisCache"
Expand All @@ -73,6 +80,7 @@
"default": {
"BACKEND": os.getenv(
"NAUTOBOT_CACHES_BACKEND",
'django_redis.cache.RedisCache'
),
"LOCATION": parse_redis_connection(redis_database=1),
"TIMEOUT": 300,
Expand Down Expand Up @@ -433,6 +441,8 @@
# os.environ["NAUTOBOT_DEVICE_NAME_AS_NATURAL_KEY"] != "":
# DEVICE_NAME_AS_NATURAL_KEY = is_truthy(os.environ["NAUTOBOT_DEVICE_NAME_AS_NATURAL_KEY"])

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

# The number of seconds to cache the member list of dynamic groups.
# Set this to `0` to disable caching.
#
Expand Down Expand Up @@ -649,11 +659,7 @@
SOCIAL_AUTH_JSONFIELD_ENABLED = True
SOCIAL_AUTH_GITHUB_KEY = os.environ.get('SOCIAL_AUTH_GITHUB_KEY', '')
SOCIAL_AUTH_GITHUB_SECRET = os.environ.get('SOCIAL_AUTH_GITHUB_SECRET', '')
AUTHENTICATION_BACKENDS = [
"social_core.backends.github.GithubOAuth2",
"nautobot.core.authentication.ObjectPermissionBackend",
]
logger.debug(f'{AUTHENTICATION_BACKENDS}')

# By default uploaded media is stored on the local filesystem. Using
# Django-storages is also supported. Provide the
# class path of the storage driver in STORAGE_BACKEND and any configuration
Expand Down
5 changes: 4 additions & 1 deletion templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ spec:
- name: NAUTOBOT_REDIS_SCHEME
value: redis
- name: NAUTOBOT_SECRET_KEY
value: {{ .Values.superUser.secretKey }}
valueFrom:
secretKeyRef:
name: secret.superuser
key: secretKey
- name: NAUTOBOT_SUPERUSER_API_TOKEN
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ image:
pullPolicy: Always
repository: ghcr.io/edwardtheharris/helm-nautobot/nautobot
# Overrides the image tag whose default is the chart appVersion.
tag: '0.0.1'
tag: '0.0.1.rc24'
secret:
name: ghcr
data: ''
Expand Down

0 comments on commit 285d754

Please sign in to comment.