Skip to main content

Pliki yaml do konfiguracji netbox

InstalacjÄ™

netboxa

docker-compose.yaml

w
services:dockerze netbox:opieramy &na instrukcji:
netboxcommunity/netbox image: docker.io/netboxcommunity/netbox:${VERSION-v4.2-3.2.0} depends_on: - postgresDocker - redis - redis-cache env_file: env/netbox.env user: "unit:root" healthcheck: test: curl -f http://localhost:8080/login/ || exit 1 start_period: 90s timeout: 3s interval: 15s volumes: - ./configuration:/etc/netbox/config:z,ro - netbox-media-files:/opt/netbox/netbox/media:rw - netbox-reports-files:/opt/netbox/netbox/reports:rw - netbox-scripts-files:/opt/netbox/netbox/scripts:rw netbox-worker: <<: *netbox depends_on: netbox: condition: service_healthy command: - /opt/netbox/venv/bin/python - /opt/netbox/netbox/manage.py - rqworker healthcheck: test: ps -auxImage | grepDocker -vHub
Polega grepna |odpowiedniej grepzmianie -qpliku rqworker || exit 1 start_period: 20s timeout: 3s interval: 15s netbox-housekeeping: <<: *netbox depends_on: netbox: condition: service_healthy command: - /opt/netbox/housekeeping.sh healthcheck: test: ps -aux | grep -v grep | grep -q housekeeping || exit 1 start_period: 20s timeout: 3s interval: 15s # postgres postgres: image: docker.io/postgres:17-alpine healthcheck: test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER start_period: 20s timeout: 30s interval: 10s retries: 5 env_file: env/postgres.env volumes: - netbox-postgres-data:/var/lib/postgresql/data # redis redis: image: docker.io/valkey/valkey:8.0-alpine command: - sh - -c # this is to evaluate the $REDIS_PASSWORD from the env - valkey-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose healthcheck: &redis-healthcheck test: '[ $$(valkey-cli --pass "$${REDIS_PASSWORD}" ping) = ''PONG'' ]' start_period: 5s timeout: 3s interval: 1s retries: 5 env_file: env/redis.env volumes: - netbox-redis-data:/data redis-cache: image: docker.io/valkey/valkey:8.0-alpine command: - sh - -c # this is to evaluate the $REDIS_PASSWORD from the env - valkey-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose healthcheck: *redis-healthcheck env_file: env/redis-cache.env volumes: - netbox-redis-cache-data:/data volumes: netbox-media-files: driver: local netbox-postgres-data: driver: local netbox-redis-cache-data: driver: local netbox-redis-data: driver: local netbox-reports-files: driver: local netbox-scripts-files: driver: local
override

docker-compose-override.yml

services:

#Netbox config

  netbox:
    image: netbox:latest-plugins
    pull_policy: never
    ports:
      - 8000:8080
    volumes:
      - /docker/apps/netbox/docker/nginx-unit.json:/etc/unit/nginx-unit.json:ro
          volumes:
      - /docker/apps/netbox/configuration:/etc/netbox/config:z,ro
      - /docker/apps/netbox/media:/opt/netbox/netbox/media:rw
      - /docker/apps/netbox/reports:/opt/netbox/netbox/reports:rw
      - /docker/apps/netbox/scripts:/opt/netbox/netbox/scripts:rw
    environment:
      REMOTE_AUTH_ENABLED: "True"
      REMOTE_AUTH_BACKEND: "netbox.authentication.LDAPBackend"
      AUTH_LDAP_SERVER_URI: "ldaps://domain.local"
      AUTH_LDAP_BIND_DN: "CN=srv_netbox,OU=ServiceUsers,OU=Users,DC=domain,dc=local"
      AUTH_LDAP_BIND_PASSWORD: "TrudneHasło"
      AUTH_LDAP_USER_SEARCH_BASEDN: "OU=Users,OU=BCC,DC=domain,dc=local"
      AUTH_LDAP_GROUP_SEARCH_BASEDN: "OU=Groups,OU=BCC,DC=domain,dc=local"
      AUTH_LDAP_REQUIRE_GROUP_DN: "CN=netbox_access,OU=Netbox,OU=Groups,DC=domain,dc=local"
      AUTH_LDAP_GROUP_TYPE: "NestedGroupOfNamesType"
      AUTH_LDAP_IS_ADMIN_DN: "CN=netbox_admins,OU=Netbox,OU=Groups,DC=domain,dc=local"
      AUTH_LDAP_IS_SUPERUSER_DN: "CN=netbox_superusers,OU=Netbox,OU=Groups,DC=domain,dc=local"
      LDAP_IGNORE_CERT_ERRORS: "true"
    build:
      context: .
      dockerfile: Dockerfile-Plugins
  netbox-worker:
    image: netbox:latest-plugins
    pull_policy: never
  netbox-housekeeping:
    image: netbox:latest-plugins
    pull_policy: never
  restart: unless-stopped

#Netbox-Worker config

  netbox-worker:
    restart: unless-stopped

#DB config

  postgres:
    volumes:
      - /docker/apps/netbox/postgres:/var/lib/postgresql/data
    restart: unless-stopped
    
#REDIS config

  redis:
    volumes:
      - /docker/apps/netbox/redis:/data
    restart: unless-stopped
    
#REDIS config 

  redis-cache:
    volumes:
      - /docker/apps/netbox/redis-cache:/data
    restart: unless-stopped

Dockerfile-Plugins

FROM netboxcommunity/netbox:latest

COPY ./plugin_requirements.txt /opt/netbox/
RUN /usr/local/bin/uv pip install -r /opt/netbox/plugin_requirements.txt

# These lines are only required if your plugin has its own static files.
COPY configuration/configuration.py /etc/netbox/config/configuration.py
COPY configuration/plugins.py /etc/netbox/config/plugins.py
RUN DEBUG="true" SECRET_KEY="SecretKEY" \
    /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

plugins-requirements.txt