# Production Docker Compose configuration # Uses the published image; `build` makes it from this checkout (no dev dependencies) # # Two deployment modes: # # 1. With bundled Caddy (TLS, HTTP/3): # docker compose --profile proxy up -d # Access at https:// (port 80/443) # # 2. Behind your own reverse proxy (Traefik, nginx, Caddy, …): # docker compose up -d # Proxy requests to http://nfsen:9000 (internal Docker hostname) # Or uncomment the `ports` entry on the nfsen service to expose 9000 directly. services: nfsen: image: ghcr.io/mbolli/nfsen-ng:latest build: context: .. dockerfile: deploy/Dockerfile # Use production Dockerfile container_name: nfsen-ng expose: - "9000" # Swoole HTTP server (internal only, reachable as nfsen:9000 inside Docker) # Uncomment to expose port 9000 directly to the host (useful when using your own reverse proxy): # ports: # - "9000:9000" volumes: - /var/nfdump/profiles-data:/data/nfsen-ng - nfsen-data:/var/lib/nfsen-ng # RRD database and state (preferences, alert rule state, nfsen-ng.sqlite); survives image upgrades # Optional: a MaxMind GeoLite2/GeoIP2 database for local IP geolocation (see NFSEN_GEOIP_DB below) # Mount the directory, not the file, so a geoipupdate run reaches the container. # - /usr/share/GeoIP:/usr/share/GeoIP:ro environment: - TZ=UTC # Uncomment and set to the timezone nfcapd ran in if it differs from TZ above. # Only needed for bare-metal setups where nfcapd used a non-UTC timezone. # - NFCAPD_TZ=Europe/Berlin # ── Sources & ports ─────────────────────────────────────────────────────── # Required: set to your actual nfcapd source names and ports to track. # No settings.php needed: these env vars fully replace it for standard setups. # For advanced use (custom filters, many sources), copy settings.php.dist instead. - NFSEN_SOURCES=gw1 # Comma-separated NetFlow source names - NFSEN_PORTS=80,443,22,53 # Comma-separated port numbers to track # - NFSEN_FILTERS=["proto tcp"] # Optional: JSON array of filter presets, added once to the saved filters # ── nfdump ─────────────────────────────────────────────────────────────── - NFSEN_NFDUMP_BINARY=/usr/local/nfdump/bin/nfdump - NFSEN_NFDUMP_PROFILES=/data/nfsen-ng # Must match the container-side volume mount path # - NFSEN_NFDUMP_PROFILE=live # - NFSEN_NFDUMP_MAX_PROCESSES=auto # Parallel nfdump processes (default auto: a third of the CPU cores, 2 to 8) # - NFSEN_NFDUMP_WORKERS=2 # Filter threads per nfdump process, passed as -W (default 2) # - NFSEN_MAX_STATS_WINDOW=604800 # Max window of Top Talkers, Conversations and filtered graphs in seconds (default: 0 = unlimited) # ── RRD storage ────────────────────────────────────────────────────────── # - NFSEN_RRD_PATH=/var/lib/nfsen-ng/rrd # The image default, on the nfsen-data volume # ── Import ── docs: https://mbolli.github.io/nfsen-ng/deployment/configuration.html # - NFSEN_SKIP_INITIAL_IMPORT=true # Skip initial import on startup # - NFSEN_IMPORT_YEARS=5 # Import last N years (default: 3) # - NFSEN_TOPN_RETENTION_DAYS=31 # Days of per-interval top-N kept in SQLite for Overview (default: 31, 0 = off); # # budget about 12 MB per source and day in the state directory # ── Integrations ───────────────────────────────────────────────────────── # - NFSEN_GEOIP_DB=/usr/share/GeoIP/GeoLite2-City.mmdb # Local IP geolocation instead of the web service # ── Logging (controls both application and Swoole) ─────────────────────── # - NFSEN_LOG_LEVEL=INFO # DEBUG, INFO, NOTICE, WARNING, ERR, CRIT, ALERT, EMERG # ── OpenSwoole ─────────────────────────────────────────────────────────── # - SWOOLE_WORKER_NUM=1 # Keep at 1: nfsen-ng runs in a single worker # - SWOOLE_MAX_REQUEST=50000 # Max requests per worker before restart (default: 0 = unlimited) # - SWOOLE_MAX_COROUTINE=20000 # Max concurrent SSE connections (default: 10000) restart: unless-stopped caddy: image: caddy:latest container_name: nfsen-caddy ports: - "80:80" # External HTTP port - "443:443" # HTTPS - "443:443/udp" # HTTP/3 volumes: - ./Caddyfile.prod:/etc/caddy/Caddyfile:ro - caddy_data:/data # Certificate storage - caddy_config:/config # Caddy config storage depends_on: - nfsen profiles: - proxy restart: unless-stopped volumes: nfsen-data: # nfsen-ng's own data: rrd/ (RRD database) and state/ (preferences, alert rule state, nfsen-ng.sqlite) caddy_data: caddy_config: