This commit is contained in:
jpmvaz
2026-09-13 20:27:51 +01:00
commit 37b00787b9
23 changed files with 2581 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
###############################################################################
# NetBox — all secrets & tunable configuration
#
# Docker Compose auto-loads this file (must be named ".env" and sit next to
# docker-compose.yml). Keep it OUT of version control: echo ".env" >> .gitignore
###############################################################################
# ── Image version ───────────────────────────────────────────────────────────
# Keep the NetBox Docker image tag in sync with the compose file you deploy.
VERSION=v4.6-5.0.2
# ── Web exposure ────────────────────────────────────────────────────────────
# Host port that maps to NetBox's internal 8080. Change if 8000 is taken.
NETBOX_PORT=8000
# Comma-separated hostnames/IPs allowed to reach NetBox. Tighten in production,
# e.g. ALLOWED_HOSTS=netbox.example.com
ALLOWED_HOSTS=*
# ── Core secrets (generated — do not reuse elsewhere) ───────────────────────
SECRET_KEY=2HDStlQcTKmJyE_Wvf7ItgRmXet4sxdK_z9cw42_kShXnCjioRUltX2dTt0mAK2Z0yI
API_TOKEN_PEPPER_1=t5t-KOSYfm3gqPsYJzwiefcOsRmIwxNce7MMUDmXc-qWG96mNVyfvugE_dcH1J_wlaA
# ── PostgreSQL ──────────────────────────────────────────────────────────────
DB_NAME=netbox
DB_USER=netbox
DB_PASSWORD=6ihrE0FOUH3HVs4BSnEW8IT4
# ── Redis / Valkey (two separate instances need two separate passwords) ──────
REDIS_PASSWORD=jArceFdnYgevnBPyevdjMpna
REDIS_CACHE_PASSWORD=0T2NXivbsaulVrQrjI9otiQP
# ── Email / SMTP — PurelyMail ───────────────────────────────────────────────
# smtp.purelymail.com : 465 over SSL/TLS.
# EMAIL_USE_SSL and EMAIL_USE_TLS are mutually exclusive — do NOT set both true.
EMAIL_SERVER=smtp.purelymail.com
EMAIL_PORT=465
EMAIL_USE_SSL=true
EMAIL_USE_TLS=false
EMAIL_USERNAME=you@yourdomain.com
EMAIL_PASSWORD=CHANGE_ME_purelymail_password
EMAIL_FROM=you@yourdomain.com
EMAIL_TIMEOUT=10
# ── Initial superuser ───────────────────────────────────────────────────────
# Set SKIP_SUPERUSER=false to have the container create this account on first
# boot. Change the password/token before deploying, then set back to true.
SKIP_SUPERUSER=false
SUPERUSER_NAME=admin
SUPERUSER_EMAIL=admin@yourdomain.com
SUPERUSER_PASSWORD=CHANGE_ME_admin_password
SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567
+144
View File
@@ -0,0 +1,144 @@
services:
netbox: &netbox
image: docker.io/netboxcommunity/netbox:${VERSION:-v4.6-5.0.2}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
redis-cache:
condition: service_healthy
user: "netbox:root"
ports:
- "${NETBOX_PORT:-8000}:8080"
environment:
# Core
SECRET_KEY: ${SECRET_KEY}
API_TOKEN_PEPPER_1: ${API_TOKEN_PEPPER_1}
ALLOWED_HOSTS: ${ALLOWED_HOSTS:-*}
# Database
DB_HOST: postgres
DB_NAME: ${DB_NAME:-netbox}
DB_USER: ${DB_USER:-netbox}
DB_PASSWORD: ${DB_PASSWORD}
# Redis — task queue
REDIS_HOST: redis
REDIS_DATABASE: "0"
REDIS_PASSWORD: ${REDIS_PASSWORD}
REDIS_SSL: "false"
REDIS_INSECURE_SKIP_TLS_VERIFY: "false"
# Redis — cache
REDIS_CACHE_HOST: redis-cache
REDIS_CACHE_DATABASE: "1"
REDIS_CACHE_PASSWORD: ${REDIS_CACHE_PASSWORD}
REDIS_CACHE_SSL: "false"
REDIS_CACHE_INSECURE_SKIP_TLS_VERIFY: "false"
# Email / SMTP (PurelyMail)
EMAIL_SERVER: ${EMAIL_SERVER:-smtp.purelymail.com}
EMAIL_PORT: ${EMAIL_PORT:-465}
EMAIL_USE_SSL: ${EMAIL_USE_SSL:-true}
EMAIL_USE_TLS: ${EMAIL_USE_TLS:-false}
EMAIL_USERNAME: ${EMAIL_USERNAME}
EMAIL_PASSWORD: ${EMAIL_PASSWORD}
EMAIL_FROM: ${EMAIL_FROM}
EMAIL_TIMEOUT: ${EMAIL_TIMEOUT:-10}
EMAIL_SSL_CERTFILE: ""
EMAIL_SSL_KEYFILE: ""
# Initial superuser
SKIP_SUPERUSER: ${SKIP_SUPERUSER:-true}
SUPERUSER_NAME: ${SUPERUSER_NAME:-admin}
SUPERUSER_EMAIL: ${SUPERUSER_EMAIL:-admin@example.com}
SUPERUSER_PASSWORD: ${SUPERUSER_PASSWORD:-admin}
SUPERUSER_API_TOKEN: ${SUPERUSER_API_TOKEN:-}
# Misc
GRAPHQL_ENABLED: "true"
WEBHOOKS_ENABLED: "true"
METRICS_ENABLED: "false"
MEDIA_ROOT: /opt/netbox/netbox/media
RELEASE_CHECK_URL: https://api.github.com/repos/netbox-community/netbox/releases
healthcheck:
test: curl -f http://localhost:8080/login/ || exit 1
start_period: 90s
timeout: 3s
interval: 15s
volumes:
- 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
ports: []
depends_on:
netbox:
condition: service_healthy
command:
- /opt/netbox/venv/bin/python
- /opt/netbox/netbox/manage.py
- rqworker
healthcheck:
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
start_period: 20s
timeout: 3s
interval: 15s
# postgres
postgres:
image: docker.io/postgres:18-alpine
environment:
POSTGRES_DB: ${DB_NAME:-netbox}
POSTGRES_USER: ${DB_USER:-netbox}
POSTGRES_PASSWORD: ${DB_PASSWORD}
healthcheck:
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
start_period: 20s
timeout: 30s
interval: 10s
retries: 5
volumes:
- netbox-postgres:/var/lib/postgresql
# redis — task queue (persistent)
redis:
image: docker.io/valkey/valkey:9.1-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- valkey-server --appendonly yes --requirepass $$REDIS_PASSWORD
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck: &redis-healthcheck
test: '[ $$(valkey-cli --pass "$${REDIS_PASSWORD}" ping) = ''PONG'' ]'
start_period: 5s
timeout: 3s
interval: 1s
retries: 5
volumes:
- netbox-redis-data:/data
# redis-cache — transient cache
redis-cache:
image: docker.io/valkey/valkey:9.1-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- valkey-server --requirepass $$REDIS_PASSWORD
environment:
REDIS_PASSWORD: ${REDIS_CACHE_PASSWORD}
healthcheck: *redis-healthcheck
volumes:
- netbox-redis-cache-data:/data
volumes:
netbox-media-files:
driver: local
netbox-postgres:
driver: local
netbox-redis-cache-data:
driver: local
netbox-redis-data:
driver: local
netbox-reports-files:
driver: local
netbox-scripts-files:
driver: local
Binary file not shown.