Skip to main content

Configuration Reference

This is the complete configuration reference for Nekzus. For a quick introduction to configuration, see the Getting Started Guide.


File Format

Nekzus supports both YAML and JSON configuration files. The format is determined by file extension:

ExtensionFormat
.yaml, .ymlYAML
.jsonJSON
# Specify configuration file path
./nekzus -config /path/to/config.yaml

# Run without TLS (development only)
./nekzus -config config.yaml -insecure-http
YAML Recommended

YAML is the preferred format for its readability and comment support. All examples in this reference use YAML.


Configuration Hierarchy

Configuration values are resolved in the following priority order:

  1. Environment Variables - Highest priority, overrides all other sources
  2. Configuration File - Values from YAML/JSON config file
  3. Auto-detection/Defaults - Built-in defaults and runtime detection

Server Configuration

The server section configures the HTTP/HTTPS server, listening address, TLS certificates, and base URL for external access.

server:
addr: ":8443"
base_url: ""
tls_cert: ""
tls_key: ""
http_redirect_addr: ""

Server Options

OptionTypeDefaultDescription
addrstring:8443Server listen address in host:port or :port format
base_urlstringauto-detectBase URL for QR code pairing and external access
tls_certstring""Path to TLS certificate file (PEM format)
tls_keystring""Path to TLS private key file (PEM format)
http_redirect_addrstring""Address for HTTP to HTTPS redirect server

TLS Configuration

When running behind a reverse proxy (Caddy, nginx, Traefik), leave TLS settings empty:

server:
addr: ":8080"
tls_cert: ""
tls_key: ""

Use the -insecure-http flag when starting the server.

Base URL Resolution

The base URL is resolved in priority order:

  1. NEKZUS_BASE_URL environment variable
  2. server.base_url in configuration file
  3. Auto-detection from local network IP
Auto-Detection

When auto-detected, the base URL is constructed as {protocol}://{local_ip}{addr} where protocol is determined by TLS configuration.

Validation Rules

  • addr must be valid host:port or :port format
  • Port must be between 0 and 65535
  • If tls_cert is set, tls_key is required (and vice versa)

Authentication Configuration

The auth section configures JWT-based authentication.

auth:
issuer: "nekzus"
audience: "nekzus-mobile"
hs256_secret: ""
default_scopes: []

Authentication Options

OptionTypeDefaultDescription
issuerstringnekzusJWT issuer claim
audiencestringnekzus-mobileJWT audience claim
hs256_secretstringauto-generateHMAC-SHA256 signing secret (minimum 32 characters)
default_scopes[]string[]Default scopes applied to routes without explicit scopes

JWT Secret Requirements

Production Security

The JWT secret is critical for security. Follow these requirements:

  • Minimum 32 characters
  • Avoid weak patterns: dev, test, change-me, example
  • Use environment variable NEKZUS_JWT_SECRET for sensitive deployments
  • If not provided, a cryptographically secure secret is auto-generated on startup
Secret Validation

In production environments (when ENVIRONMENT is not development, dev, test, or empty), weak secret patterns are rejected with an error.


Bootstrap Tokens

The bootstrap section configures initial authentication tokens for device pairing.

bootstrap:
tokens:
- "your-secure-bootstrap-token"
- "another-valid-token"

Bootstrap Options

OptionTypeDefaultDescription
tokens[]string[]List of valid bootstrap tokens for device pairing
QR Code Pairing

Bootstrap tokens are optional. If not provided, devices can pair using the QR code flow from the web UI, which generates short-lived tokens.


Storage Configuration

The storage section configures SQLite database persistence.

storage:
database_path: "./data/nexus.db"

Storage Options

OptionTypeDefaultDescription
database_pathstring./data/nexus.dbPath to SQLite database file

Discovery Configuration

The discovery section enables automatic service discovery from Docker containers, mDNS services, and Kubernetes resources.

discovery:
enabled: true

docker:
enabled: true
socket_path: "unix:///var/run/docker.sock"
poll_interval: "30s"
network_mode: "all"
networks: []
exclude_networks: []

mdns:
enabled: true
scan_interval: "60s"
services:
- "_http._tcp"
- "_https._tcp"
- "_homeassistant._tcp"

kubernetes:
enabled: false
kubeconfig: ""
namespaces: []
poll_interval: "30s"

Discovery Options

OptionTypeDefaultDescription
enabledboolfalseEnable service discovery

Docker Discovery

OptionTypeDefaultDescription
enabledboolfalseEnable Docker container discovery
socket_pathstringunix:///var/run/docker.sockDocker socket path
poll_intervalduration30sInterval between discovery polls
network_modestringallNetwork selection mode: all, first, or preferred
networks[]string[]Specific networks to scan (required for preferred mode)
exclude_networks[]string[]Networks to exclude from discovery

Network Modes

ModeDescription
allDiscover services on all container networks
firstUse only the first network found
preferredUse networks from networks list, fallback to first
Preferred Mode

When using network_mode: preferred, the networks list must contain at least one network name.

mDNS Discovery

OptionTypeDefaultDescription
enabledboolfalseEnable mDNS/Bonjour discovery
scan_intervalduration60sInterval between mDNS scans
services[]string["_http._tcp", "_https._tcp"]Service types to discover

Kubernetes Discovery

OptionTypeDefaultDescription
enabledboolfalseEnable Kubernetes service discovery
kubeconfigstring""Path to kubeconfig (empty for in-cluster config)
namespaces[]string[]Namespaces to watch (empty for all)
poll_intervalduration30sInterval between discovery polls
Kubernetes Auto-Discovery

Nekzus uses smart label inference to auto-discover Kubernetes services:

Discovery MethodConfidence Score
Ingress-exposed services1.00
Explicit nekzus.enable=true label0.95
LoadBalancer/NodePort with standard K8s labels0.70
Helm charts with standard labels0.60
Other auto-discovered services0.50

System namespaces (kube-system, kube-public, kube-node-lease) are automatically excluded.


Toolbox Configuration

The toolbox section enables one-click service deployment using Docker Compose templates.

toolbox:
enabled: true
catalog_dir: "./toolbox"
data_dir: "./data/toolbox"
host_data_dir: ""
auto_route: true
auto_start: true

Toolbox Options

OptionTypeDefaultDescription
enabledboolfalseEnable toolbox feature
catalog_dirstring./toolboxDirectory containing Compose-based service templates
data_dirstring./data/toolboxBase directory for service data volumes (container path)
host_data_dirstring""Host path for Docker-in-Docker bind mounts
auto_routebooltrueAutomatically create routes for deployed services
auto_startbooltrueAutomatically start containers after deployment
Deprecated: catalog_path

The catalog_path option (YAML-based catalog) is deprecated and will be removed in a future release. Use catalog_dir for Compose-based templates.

Docker-in-Docker

When running Nekzus inside a Docker container, set host_data_dir to the host path that maps to data_dir inside the container. This ensures volume bind mounts work correctly.


Federation Configuration

The federation section enables peer-to-peer federation for multi-instance deployments.

federation:
enabled: false
cluster_secret: ""
gossip_port: 7946
mdns_enabled: true
bootstrap_peers: []
sync:
full_sync_interval: "300s"
anti_entropy_period: "60s"
allow_remote_routes: false

Federation Options

OptionTypeDefaultDescription
enabledboolfalseEnable peer-to-peer federation
cluster_secretstringrequiredShared secret for peer authentication (minimum 32 characters)
gossip_portint7946Port for gossip protocol (TCP/UDP)
mdns_enabledbooltrueEnable mDNS peer discovery
bootstrap_peers[]string[]Initial peer addresses (host:port format)
allow_remote_routesboolfalseAllow proxying requests to remote peer services

Sync Options

OptionTypeDefaultDescription
full_sync_intervalduration300sInterval for complete catalog synchronization
anti_entropy_periodduration60sInterval for anti-entropy repair
Security Warning: allow_remote_routes

Setting allow_remote_routes: true allows proxying requests to any service discovered by federated peers. Only enable this in trusted network environments where all peers are under your control.

Multi-Server Setup
Server 1 (Main)
federation:
enabled: true
cluster_secret: "your-32-character-or-longer-secret"
gossip_port: 7946
mdns_enabled: true
bootstrap_peers: [] # Main server, no bootstrap needed
Server 2 (Secondary)
federation:
enabled: true
cluster_secret: "your-32-character-or-longer-secret"
gossip_port: 7946
mdns_enabled: true
bootstrap_peers:
- "192.168.1.100:7946" # Main server address

Runtimes Configuration

The runtimes section configures container runtime settings for management operations (list, start, stop, restart, stats).

runtimes:
primary: "docker"

docker:
enabled: true
socket_path: ""

kubernetes:
enabled: false
kubeconfig: ""
context: ""
namespaces: []
metrics_server: true
metrics_cache_ttl: "30s"

Runtime Options

OptionTypeDefaultDescription
primarystringdockerPrimary runtime for container operations (docker or kubernetes)

Docker Runtime

OptionTypeDefaultDescription
enabledbooltrueEnable Docker runtime
socket_pathstringunix:///var/run/docker.sockDocker socket path (empty for default)

Kubernetes Runtime

OptionTypeDefaultDescription
enabledboolfalseEnable Kubernetes runtime
kubeconfigstring""Path to kubeconfig (empty for in-cluster or default)
contextstring""Kubernetes context (empty for current context)
namespaces[]string[]Namespaces to manage (empty for all)
metrics_serverbooltrueUse Metrics Server for pod statistics
metrics_cache_ttlduration30sCache TTL for pod metrics

Metrics Configuration

The metrics section configures the Prometheus metrics endpoint.

metrics:
enabled: true
path: "/metrics"

Metrics Options

OptionTypeDefaultDescription
enabledbooltrueEnable/disable the metrics HTTP endpoint
pathstring/metricsMetrics endpoint path
Internal Metrics Collection

Metrics are always collected internally for observability. The enabled setting only controls whether the HTTP endpoint is exposed.

Validation Rules

  • path must start with /
  • path cannot conflict with API paths (/api/v1/healthz, /api/*)

Hot Reload

  • enabled can be hot-reloaded without restart
  • path requires a restart to take effect

Health Checks Configuration

The health_checks section configures service health monitoring.

health_checks:
enabled: true
interval: "30s"
timeout: "5s"
unhealthy_threshold: 3
path: "/"
per_service:
grafana:
path: "/api/health"
interval: "30s"
timeout: "5s"

Health Check Options

OptionTypeDefaultDescription
enabledbooltrueEnable service health monitoring
intervalduration10sDefault check interval
timeoutduration5sDefault HTTP request timeout
unhealthy_thresholdint2Consecutive failures before marking unhealthy
pathstring/Default health check path
per_servicemap{}Per-service configuration overrides

Per-Service Overrides

OptionTypeDescription
pathstringHealth check endpoint path
intervaldurationCheck interval for this service
timeoutdurationRequest timeout for this service

Notifications Configuration

The notifications section configures WebSocket notifications for mobile devices.

notifications:
enabled: false
ack_timeout: "30s"

queue:
worker_count: 4
buffer_size: 1000
retry_interval: "30s"
max_retries: 3

offline_detection:
enabled: false
check_interval: "1m"
offline_threshold: "5m"

Notification Options

OptionTypeDefaultDescription
enabledboolfalseEnable notification system
ack_timeoutduration30sTimeout waiting for client acknowledgment

Queue Options

OptionTypeDefaultDescription
worker_countint4Number of worker goroutines
buffer_sizeint1000Channel buffer size
retry_intervalduration30sRetry interval for failed notifications
max_retriesint3Maximum retry attempts

Offline Detection Options

OptionTypeDefaultDescription
enabledboolfalseEnable offline device detection
check_intervalduration1mHow often to check for offline devices
offline_thresholdduration5mDuration after which device is considered offline

Backup Configuration

The backup section configures automatic database backups.

backup:
enabled: true
directory: "./data/backups"
schedule: "24h"
retention: 7

Backup Options

OptionTypeDefaultDescription
enabledbooltrueEnable automatic backups
directorystring./data/backupsDirectory to store backup files
scheduleduration24hBackup interval (e.g., 24h, 12h, 1h)
retentionint7Number of backups to keep (older backups are deleted)

Scripts Configuration

The scripts section configures user script execution.

scripts:
enabled: false
directory: "./scripts"
default_timeout: 300
max_output_bytes: 10485760

Scripts Options

OptionTypeDefaultDescription
enabledboolfalseEnable script execution feature
directorystring./scriptsDirectory containing user scripts
default_timeoutint300Default script timeout in seconds
max_output_bytesint10485760Maximum output size in bytes (10 MB)

System Configuration

The system section configures system-level settings.

system:
host_root_path: ""

System Options

OptionTypeDefaultDescription
host_root_pathstring""Path to mounted host root filesystem for host metrics
Container Metrics

When running in a container, set host_root_path to the mount point of the host filesystem (e.g., /mnt/host) to report accurate host system metrics (CPU, RAM, disk) instead of container metrics.


Routes Configuration

The routes section defines static reverse proxy route mappings.

routes:
- id: "route:grafana"
app_id: "grafana"
path_base: "/apps/grafana/"
to: "http://127.0.0.1:3000"
scopes: ["access:grafana"]
websockets: true
strip_prefix: true

Route Options

OptionTypeDefaultRequiredDescription
idstring-YesUnique route identifier
app_idstring-NoAssociated application ID
path_basestring-YesURL path prefix (must start with /)
tostring-YesUpstream service URL
container_idstring""NoExplicit link to Docker/Kubernetes container
scopes[]string[]NoRequired authorization scopes
public_accessboolfalseNoBypass authentication (explicit opt-out)
websocketsboolfalseNoEnable WebSocket proxying
strip_prefixboolfalseNoStrip path prefix before proxying
strip_response_cookiesboolfalseNoRemove Set-Cookie headers from upstream
rewrite_cookie_pathsboolfalseNoRewrite cookie paths when strip_prefix is enabled
rewrite_htmlboolfalseNoRewrite HTML responses to fix absolute asset paths
persist_cookiesboolfalseNoPersist cookies for mobile webview session continuity

Route Health Check Options

OptionTypeDefaultDescription
health_check_pathstring""Custom health check endpoint path
health_check_timeoutduration""Custom health check timeout
health_check_intervalduration""Custom health check interval
expected_status_codes[]int[200-299]Valid health check status codes

Scope Resolution

Scopes are resolved in the following priority:

  1. If public_access: true, no scopes are required
  2. If scopes is set on the route, those scopes are used
  3. Otherwise, auth.default_scopes from config is used

Apps Configuration

The apps section defines static application definitions.

apps:
- id: "grafana"
name: "Grafana"
icon: "chart"
tags: ["monitoring", "dashboards"]
endpoints:
lan: "http://127.0.0.1:3000"

App Options

OptionTypeDefaultRequiredDescription
idstring-YesUnique application identifier
namestring-YesDisplay name
iconstring""NoIcon identifier
tags[]string[]NoSearchable tags
endpointsmap{}NoNetwork-specific endpoint URLs

Environment Variables

Environment variables override configuration file values. Use these for sensitive data and deployment flexibility.

Complete Environment Variable Reference

VariableConfig PathTypeDescription
NEKZUS_ADDRserver.addrstringServer listen address
NEKZUS_BASE_URLserver.base_urlstringBase URL for external access
NEKZUS_TLS_CERTserver.tls_certstringTLS certificate path
NEKZUS_TLS_KEYserver.tls_keystringTLS private key path
NEKZUS_JWT_SECRETauth.hs256_secretstringJWT signing secret
NEKZUS_BOOTSTRAP_TOKENbootstrap.tokensstringBootstrap token (appended to list)
NEKZUS_DATABASE_PATHstorage.database_pathstringSQLite database path
NEKZUS_TOOLBOX_HOST_DATA_DIRtoolbox.host_data_dirstringHost data directory for DinD
NEKZUS_HOST_ROOT_PATHsystem.host_root_pathstringHost root path for metrics
NEKZUS_DISCOVERY_ENABLEDdiscovery.enabledboolEnable discovery (true/1)
NEKZUS_DISCOVERY_DOCKER_ENABLEDdiscovery.docker.enabledboolEnable Docker discovery
NEKZUS_TOOLBOX_ENABLEDtoolbox.enabledboolEnable toolbox
NEKZUS_METRICS_ENABLEDmetrics.enabledboolEnable metrics endpoint
ENVIRONMENT-stringEnvironment mode (production, development)

Development/Debug Variables

VariableDescription
NEKZUS_DEBUGEnable debug logging (true/1)
NEKZUS_DEBUG_TOKENSEnable debug token platform (1)
NEKZUS_BOOTSTRAP_ALLOW_ANYAllow any bootstrap token in development (1)

Certificate Injection Variables

These variables are set automatically when deploying services via the toolbox:

VariableDefault ValueDescription
NEKZUS_CA_CERT/certs/ca.crtPath to CA certificate
NEKZUS_CERT/certs/cert.crtPath to service certificate
NEKZUS_KEY/certs/cert.keyPath to service private key
NEKZUS_CERT_DIR/certsCertificate directory
NEKZUS_BOOTSTRAP_ALLOW_ANY

The NEKZUS_BOOTSTRAP_ALLOW_ANY=1 setting only works when ENVIRONMENT=development is explicitly set. Attempting to use it in production results in an error.


Validation

Configuration is validated on load with comprehensive checks. Invalid configuration prevents startup with clear error messages.

Validation Rules Summary

SectionRule
server.addrValid host:port or :port format, port 0-65535
server.tls_*Both tls_cert and tls_key required if either is set
auth.hs256_secretMinimum 32 characters, no weak patterns in production
discovery.docker.network_modeMust be all, first, or preferred
discovery.docker.networksRequired when network_mode is preferred
runtimes.primaryMust be docker or kubernetes
metrics.pathMust start with /, cannot conflict with /api/*
routes[].idRequired
routes[].path_baseRequired, must start with /
routes[].toRequired
apps[].idRequired
apps[].nameRequired
All duration fieldsValid Go duration format (e.g., 30s, 5m, 1h)

Hot Reload

Nekzus supports hot reloading for certain configuration changes without restart.

Hot Reloadable Settings

  • metrics.enabled - Enable/disable metrics endpoint
  • discovery.* - All discovery settings
  • health_checks.* - All health check settings
  • routes - Route definitions
  • apps - Application definitions

Settings Requiring Restart

  • server.addr - Listen address
  • server.tls_* - TLS certificates
  • metrics.path - Metrics endpoint path
  • auth.* - All authentication settings
  • storage.* - Database settings
  • federation.* - Federation settings

Triggering Hot Reload

Send a SIGHUP signal to trigger configuration reload:

kill -HUP $(pidof nekzus)

Example Configurations

Minimal Development

server:
addr: ":8080"

discovery:
enabled: true
docker:
enabled: true

Run with:

./nekzus -config config.yaml -insecure-http

Production with TLS

server:
addr: ":8443"
base_url: "https://nekzus.example.com:8443"
tls_cert: "./certs/server-cert.pem"
tls_key: "./certs/server-key.pem"

auth:
issuer: "nekzus"
audience: "nekzus-mobile"
# Use NEKZUS_JWT_SECRET environment variable

storage:
database_path: "./data/nexus.db"

backup:
enabled: true
directory: "./data/backups"
schedule: "12h"
retention: 14

discovery:
enabled: true
docker:
enabled: true
poll_interval: "30s"

metrics:
enabled: true
path: "/metrics"

health_checks:
enabled: true
interval: "30s"
timeout: "5s"
unhealthy_threshold: 3

Docker Compose Deployment

server:
addr: ":8080"

discovery:
enabled: true
docker:
enabled: true
socket_path: "unix:///var/run/docker.sock"

toolbox:
enabled: true
catalog_dir: "./toolbox"
data_dir: "./data/toolbox"
host_data_dir: "/opt/nekzus/data/toolbox"
auto_route: true
auto_start: true

system:
host_root_path: "/mnt/host"

Kubernetes Cluster

server:
addr: ":8080"

discovery:
enabled: true
kubernetes:
enabled: true
kubeconfig: ""
namespaces:
- "default"
- "production"
- "staging"
poll_interval: "30s"

runtimes:
primary: "kubernetes"
kubernetes:
enabled: true
namespaces:
- "default"
- "production"
metrics_server: true
metrics_cache_ttl: "30s"
Complete Configuration Example
server:
addr: ":8443"
base_url: "https://nekzus.local:8443"
tls_cert: "./certs/server-cert.pem"
tls_key: "./certs/server-key.pem"

auth:
issuer: "nekzus"
audience: "nekzus-mobile"
# hs256_secret: set via NEKZUS_JWT_SECRET
default_scopes: []

bootstrap:
tokens:
- "secure-bootstrap-token-1"

storage:
database_path: "./data/nexus.db"

backup:
enabled: true
directory: "./data/backups"
schedule: "24h"
retention: 7

notifications:
enabled: true
ack_timeout: "30s"
queue:
worker_count: 4
buffer_size: 1000
retry_interval: "30s"
max_retries: 3
offline_detection:
enabled: true
check_interval: "1m"
offline_threshold: "5m"

discovery:
enabled: true
docker:
enabled: true
socket_path: "unix:///var/run/docker.sock"
poll_interval: "30s"
network_mode: "all"
mdns:
enabled: true
scan_interval: "60s"
services:
- "_http._tcp"
- "_https._tcp"
- "_homeassistant._tcp"
kubernetes:
enabled: false

toolbox:
enabled: true
catalog_dir: "./toolbox"
data_dir: "./data/toolbox"
auto_route: true
auto_start: true

runtimes:
primary: "docker"
docker:
enabled: true
kubernetes:
enabled: false

metrics:
enabled: true
path: "/metrics"

health_checks:
enabled: true
interval: "30s"
timeout: "5s"
unhealthy_threshold: 3
path: "/"
per_service:
grafana:
path: "/api/health"
interval: "30s"
timeout: "5s"

scripts:
enabled: false
directory: "./scripts"
default_timeout: 300
max_output_bytes: 10485760

routes:
- id: "route:grafana"
app_id: "grafana"
path_base: "/apps/grafana/"
to: "http://grafana:3000"
scopes: ["access:grafana"]
websockets: true
strip_prefix: true

apps:
- id: "grafana"
name: "Grafana"
icon: "chart"
tags: ["monitoring", "dashboards"]
endpoints:
lan: "http://grafana:3000"

Duration Format

All duration fields use Go's duration format:

UnitSuffixExample
Nanosecondsns500ns
Microsecondsus or us100us
Millisecondsms500ms
Secondss30s
Minutesm5m
Hoursh24h

Durations can be combined: 1h30m, 2m30s