Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check form if not using a Nautobot View Class with a model_form. #48

Merged
merged 7 commits into from Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions coverage.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 19 additions & 28 deletions development/Dockerfile
@@ -1,12 +1,29 @@

ARG PYTHON_VER
ARG NAUTOBOT_VER
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER} as welcome_wizard-dev
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}

ENV prometheus_multiproc_dir=/prom_cache

ARG NAUTOBOT_ROOT=/opt/nautobot

ENV NAUTOBOT_ROOT ${NAUTOBOT_ROOT}

WORKDIR $NAUTOBOT_ROOT

# Configure poetry
RUN poetry config virtualenvs.create false \
&& poetry config installer.parallel false

# -------------------------------------------------------------------------------------
# Install Nautobot Plugin
# -------------------------------------------------------------------------------------

WORKDIR /source

# Copy in only pyproject.toml/poetry.lock to help with caching this layer if no updates to dependencies
COPY poetry.lock pyproject.toml /source/

# --no-root declares not to install the project package since we're wanting to take advantage of caching dependency installation
# and the project is copied in and installed after this step
RUN poetry install --no-interaction --no-ansi --no-root
Expand All @@ -15,30 +32,4 @@ RUN poetry install --no-interaction --no-ansi --no-root
COPY . /source
RUN poetry install --no-interaction --no-ansi

COPY development/nautobot_config.py /opt/nautobot/nautobot_config.py

FROM python:${PYTHON_VER}-slim as docs

ENV PYTHONUNBUFFERED=1

# Install all OS package upgrades and dependencies
# hadolint ignore=DL3005,DL3008,DL3013
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git && \
apt-get autoremove -y && \
apt-get clean all && \
rm -rf /var/lib/apt/lists/* && \
pip --no-cache-dir install --upgrade pip wheel

RUN useradd --system --shell /bin/bash --create-home --home-dir /opt/welcome_wizard docs
WORKDIR /opt/welcome_wizard

COPY docs /opt/welcome_wizard/docs
COPY mkdocs.yml /opt/welcome_wizard

RUN pip install -r /opt/welcome_wizard/docs/requirements.txt

USER docs

CMD mkdocs serve -v -a 0.0.0.0:8080
COPY development/nautobot_config.py /opt/nautobot/nautobot_config.py
2 changes: 1 addition & 1 deletion development/creds.example.env
@@ -1,5 +1,5 @@
POSTGRES_PASSWORD=notverysecurepwd
REDIS_PASSWORD=notverysecurepwd
NAUTOBOT_REDIS_PASSWORD=notverysecurepwd
SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj
NAUTOBOT_CREATE_SUPERUSER=true
NAUTOBOT_SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
Expand Down
5 changes: 3 additions & 2 deletions development/dev.env
Expand Up @@ -9,9 +9,10 @@ NAUTOBOT_ROOT=/opt/nautobot
POSTGRES_DB=nautobot
POSTGRES_HOST=postgres
POSTGRES_USER=nautbot
REDIS_HOST=redis
REDIS_PORT=6379
NAUTOBOT_REDIS_HOST=redis
NAUTOBOT_REDIS_PORT=6379
# REDIS_SSL=True
# Uncomment REDIS_SSL if using SSL
SUPERUSER_EMAIL=admin@example.com
SUPERUSER_NAME=admin
NAUTOBOT_LOG_LEVEL=DEBUG
28 changes: 16 additions & 12 deletions development/docker-compose.base.yml
Expand Up @@ -6,15 +6,14 @@ x-nautobot-build: &nautobot-build
PYTHON_VER: "${PYTHON_VER}"
context: "../"
dockerfile: "development/Dockerfile"
target: "welcome_wizard-dev"
x-nautobot-base: &nautobot-base
image: "welcome_wizard/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
env_file:
- "dev.env"
- "creds.env"
tty: true

version: "3.8"
version: "3.4"
services:
nautobot:
ports:
Expand All @@ -26,18 +25,23 @@ services:
<<: *nautobot-base
worker:
entrypoint: "nautobot-server rqworker"
healthcheck:
interval: "5s"
timeout: "5s"
start_period: "5s"
retries: 3
test: ["CMD", "nautobot-server", "health_check"]
depends_on:
- "nautobot"
<<: *nautobot-base
celery_worker:
healthcheck:
disable: true
depends_on:
- "nautobot"
- "redis"
entrypoint:
- "sh"
- "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env
- "nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL" # $$ because of docker-compose
<<: *nautobot-base
docs:
build:
args:
NAUTOBOT_VER: "${NAUTOBOT_VER}"
PYTHON_VER: "${PYTHON_VER}"
context: "../"
dockerfile: "development/Dockerfile"
target: "docs"
ports:
- "8001:8080"
27 changes: 12 additions & 15 deletions development/docker-compose.dev.yml
@@ -1,20 +1,17 @@
# We can't remove volumes in a compose override, for the test configuration using the final containers
# we don't want the volumes so this is the default override file to add the volumes in the dev case
# any override will need to include these volumes to use them.
# see: https://github.com/docker/compose/issues/3729
---
version: "3"
x-nautobot-base: &nautobot-base
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"

version: "3.4"
services:
nautobot:
healthcheck:
disable: true
command: "nautobot-server runserver 0.0.0.0:8080"
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
<<: *nautobot-base
celery_worker:
<<: *nautobot-base
worker:
volumes:
- "./nautobot_config.py:/opt/nautobot/nautobot_config.py"
- "../:/source"
docs:
volumes:
- "../docs:/opt/welcome_wizard/docs"
- "../mkdocs.yml:/opt/welcome_wizard/mkdocs.yml"
<<: *nautobot-base
11 changes: 11 additions & 0 deletions development/docker-compose.docs.yml
@@ -0,0 +1,11 @@
---
version: "3.4"
services:
docs:
image: "welcome_wizard/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}"
entrypoint: "mkdocs serve -v -a 0.0.0.0:8080"
volumes:
- "../docs:/source/docs:ro"
- "../mkdocs.yml:/source/mkdocs.yml:ro"
ports:
- "8001:8080"
2 changes: 1 addition & 1 deletion development/docker-compose.requirements.yml
Expand Up @@ -15,7 +15,7 @@ services:
command:
- "sh"
- "-c" # this is to evaluate the $REDIS_PASSWORD from the env
- "redis-server --appendonly yes --requirepass $$REDIS_PASSWORD"
- "redis-server --appendonly yes --requirepass $$NAUTOBOT_REDIS_PASSWORD"
env_file:
- "dev.env"
- "creds.env"
Expand Down