Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- dnsmasq
- ironic-nautobot-client
- understack-tests
- nautobot
uses: ./.github/workflows/build-container-reuse.yaml
secrets: inherit
with:
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/openstack_octavia/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

- name: Build octavia_port_names (override or hostname)
ansible.builtin.set_fact:
octavia_port_names: "{{ octavia_port_names | default([]) + [ (hostvars[item].octavia_host_override | default(item)) ] }}"
octavia_port_names: "{{ octavia_port_names | default([]) + [hostvars[item].octavia_host_override | default(item)] }}"
loop: "{{ groups['all'] }}"
when:
- hostvars[item].ovs_enabled is defined
Expand Down
20 changes: 20 additions & 0 deletions containers/nautobot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# renovate: datasource=docker depName=networktocode/nautobot versioning=semver
ARG NAUTOBOT_VERSION=3.0.2
ARG PYTHON_VERSION=3.12
ARG NAUTOBOT_CONTAINER_TYPE=""

FROM ghcr.io/nautobot/nautobot${NAUTOBOT_CONTAINER_TYPE}:${NAUTOBOT_VERSION}-py${PYTHON_VERSION} AS prod

LABEL org.opencontainers.image.source=https://github.com/rackerlabs/understack

ENV PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100

# install plugin_requirements to /opt/nautobot/ per the Nautobot Docker Compose example
COPY ./containers/nautobot/plugin_requirements.txt /opt/nautobot/
RUN pip install --no-warn-script-location -r /opt/nautobot/plugin_requirements.txt
# copy in a sample config
COPY ./containers/nautobot/nautobot_config.py /opt/nautobot_config/nautobot_config.py
# copy in the healthcheck script for celery beats
COPY ./containers/nautobot/scripts/nautobot_celery_beats_hcheck.py /opt/nautobot/
6 changes: 6 additions & 0 deletions containers/nautobot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# nautobot container builds

``` bash
docker compose -f docker-compose.nautobot.yml -f docker-compose.postgres.yml -f docker-compose.redis.yml build
docker compose -f docker-compose.nautobot.yml -f docker-compose.postgres.yml -f docker-compose.redis.yml up
```
10 changes: 10 additions & 0 deletions containers/nautobot/default-creds.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# default creds file

NAUTOBOT_DB_PASSWORD=changeme
NAUTOBOT_REDIS_PASSWORD=changeme
NAUTOBOT_SECRET_KEY=changeme

NAUTOBOT_SUPERUSER_NAME=admin
[email protected]
NAUTOBOT_SUPERUSER_PASSWORD=admin
NAUTOBOT_SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
43 changes: 43 additions & 0 deletions containers/nautobot/development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
################################################################################
# DEV File: Store environment information. NOTE: Secrets NOT stored here!
################################################################################
# Nautobot Configuration Environment Variables
NAUTOBOT_ALLOWED_HOSTS=*
NAUTOBOT_BANNER_TOP="Local"
NAUTOBOT_CHANGELOG_RETENTION=0
NAUTOBOT_CONFIG=/opt/nautobot_config/nautobot_config.py

NAUTOBOT_CREATE_SUPERUSER=true
NAUTOBOT_DEBUG=True
NAUTOBOT_DJANGO_EXTENSIONS_ENABLED=True
NAUTOBOT_DJANGO_TOOLBAR_ENABLED=True
NAUTOBOT_LOG_LEVEL=DEBUG
NAUTOBOT_METRICS_ENABLED=True
NAUTOBOT_NAPALM_TIMEOUT=5
NAUTOBOT_MAX_PAGE_SIZE=0

# Redis Configuration Environment Variables
NAUTOBOT_REDIS_HOST=redis
NAUTOBOT_REDIS_PORT=6379
# Uncomment NAUTOBOT_REDIS_SSL if using SSL
# NAUTOBOT_REDIS_SSL=True

# Nautobot DB Connection Environment Variables
NAUTOBOT_DB_ENGINE=django.db.backends.postgresql
NAUTOBOT_DB_NAME=nautobot
NAUTOBOT_DB_USER=nautobot
NAUTOBOT_DB_HOST=db
NAUTOBOT_DB_TIMEOUT=300

# Use them to overwrite the defaults in nautobot_config.py
# NAUTOBOT_DB_ENGINE=django.db.backends.postgresql
# NAUTOBOT_DB_PORT=5432

# Needed for Postgres should match the values for Nautobot above
POSTGRES_USER=${NAUTOBOT_DB_USER}
POSTGRES_DB=${NAUTOBOT_DB_NAME}

# Needed to initialize the Postgres super user, use the same for dev
POSTGRES_PASSWORD=${NAUTOBOT_DB_PASSWORD}

NAUTOBOT_SSOT_HIDE_EXAMPLE_JOBS="True"
20 changes: 20 additions & 0 deletions containers/nautobot/docker-compose.ansible.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
version: "3.8"
name: undercloud-nautobot
services:
setup:
profiles: ["setup"]
image: local/undercloud-nautobot-ansible:latest
build:
context: ../ansible
dockerfile: Dockerfile
env_file:
- "rax-creds.env"
restart: 'no'
volumes:
- "../:/source"
depends_on:
nautobot:
condition: "service_healthy"
worker:
condition: "service_healthy"
73 changes: 73 additions & 0 deletions containers/nautobot/docker-compose.nautobot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
version: "3.8"
name: undercloud-nautobot
services:
nautobot:
image: local/understack-nautobot:latest
build:
context: ../../.
dockerfile: containers/nautobot/Dockerfile
env_file:
- "default-creds.env"
- "development.env"
environment:
- PYTHONDONTWRITEBYTECODE=1
ports:
- "8000:8080"
depends_on:
redis:
condition: "service_started"
db:
condition: "service_healthy"
healthcheck:
interval: "30s"
timeout: "30s"
start_period: "30s"
retries: 15
worker:
image: local/undercloud-nautobot:latest
build:
context: ../../.
dockerfile: containers/nautobot/Dockerfile
entrypoint:
- "sh"
- "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env and $$ because of docker-compose
- "nautobot-server celery worker -l $$NAUTOBOT_LOG_LEVEL --events"
env_file:
- "default-creds.env"
- "development.env"
environment:
- PYTHONDONTWRITEBYTECODE=1
depends_on:
nautobot:
condition: "service_started"
healthcheck:
interval: "30s"
timeout: "30s" # its taking a long time to start sometimes
start_period: "30s"
retries: 10
test: ["CMD", "bash", "-c", "nautobot-server celery inspect ping --destination celery@$$HOSTNAME"] ## $$ because of docker-compose

nautobot-celery-beats:
image: local/undercloud-nautobot:latest
build:
context: ../../.
dockerfile: containers/nautobot/Dockerfile
environment:
- PYTHONDONTWRITEBYTECODE=1
entrypoint:
- "sh"
- "-c" # this is to evaluate the $NAUTOBOT_LOG_LEVEL from the env and $$ because of docker-compose
- "nautobot-server celery beat -l $$NAUTOBOT_LOG_LEVEL"
env_file:
- "default-creds.env"
- "development.env"
depends_on:
nautobot:
condition: "service_healthy"
healthcheck:
interval: "30s"
timeout: "10s"
start_period: "30s"
retries: 3
test: ["CMD", "python", "/opt/nautobot/nautobot_celery_beats_hcheck.py"]
22 changes: 22 additions & 0 deletions containers/nautobot/docker-compose.postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
version: "3.8"
name: undercloud-nautobot
services:
nautobot:
environment:
- "NAUTOBOT_DB_ENGINE=django.db.backends.postgresql"
db:
image: "postgres:16-alpine"
env_file:
- "default-creds.env"
- "development.env"
volumes:
- "postgres_data:/var/lib/postgresql/data"
healthcheck:
test: "pg_isready --username=$$POSTGRES_USER --dbname=$$POSTGRES_DB"
interval: "10s"
timeout: "5s"
retries: 10

volumes:
postgres_data: {}
13 changes: 13 additions & 0 deletions containers/nautobot/docker-compose.redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
version: "3.8"
name: undercloud-nautobot
services:
redis:
image: "redis:7-alpine"
command:
- "sh"
- "-c" # this is to evaluate the $NAUTOBOT_REDIS_PASSWORD from the env
- "redis-server --appendonly yes --requirepass $$NAUTOBOT_REDIS_PASSWORD"
env_file:
- "default-creds.env"
- "development.env"
Loading
Loading