145 lines
4.2 KiB
YAML
145 lines
4.2 KiB
YAML
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
|