Server Configuration

Customize server behavior

Configure ports, authentication, logging, resource limits, and other server settings. Most defaults work well, but production deployments often need tuning.

Config File Location

Install Type Location
Homebrew/User ~/.muxi/server/config.yaml
System (sudo) /etc/muxi/server/config.yaml

Generate Config

muxi-server init

Common ports: Server 7890, formations 8001-9000 (configurable).

Configuration Reference

# Server settings
server:
  port: 7890              # Server port
  host: 0.0.0.0           # Bind address
  read_timeout: 30s       # Request timeout
  write_timeout: 30s      # Response timeout

# Authentication
auth:
  enabled: true           # Enable HMAC auth
  keys:
    - id: MUXI_abc123
      secret: sk_...      # Generated by init

# Formation management
formations:
  port_range: [8000, 9000]  # Ports for formations
  auto_restart: true        # Restart on crash
  health_check_interval: 30s
  startup_timeout: 60s

# Logging
logging:
  level: info             # debug, info, warn, error
  format: json            # json or text
  output: stdout          # stdout or file path

# Runtime
runtime:
  auto_download: true     # Download runtime if missing
  version: latest         # Runtime version

Server Settings

Port

server:
  port: 7890

Default: 7890 (MUXI port)

Host

server:
  host: 0.0.0.0           # All interfaces
  host: 127.0.0.1         # Localhost only

Timeouts

server:
  read_timeout: 30s
  write_timeout: 30s
  idle_timeout: 120s

Authentication

Enable/Disable

auth:
  enabled: true           # Production
  enabled: false          # Development only!

Keys

Generated by muxi-server init:

auth:
  keys:
    - id: MUXI_e8f3a9b2
      secret: sk_9f2e8d7c6b5a...

Add multiple keys for different clients:

auth:
  keys:
    - id: MUXI_production
      secret: sk_prod_...
    - id: MUXI_ci
      secret: sk_ci_...

Formation Management

Port Range

formations:
  port_range: [8000, 9000]

Formations get assigned ports from this range.

Auto-Restart

formations:
  auto_restart: true
  max_restarts: 5
  restart_delay: 5s

Health Checks

formations:
  health_check_interval: 30s
  health_check_timeout: 5s
  unhealthy_threshold: 3

Logging

Level

logging:
  level: info
Level Description
debug Verbose debugging
info Normal operation
warn Warnings only
error Errors only

Format

logging:
  format: json            # Structured logs
  format: text            # Human-readable

Output

logging:
  output: stdout
  output: /var/log/muxi/server.log

Runtime Settings

Auto-Download

runtime:
  auto_download: true

Downloads formation runtime automatically.

Version

runtime:
  version: latest
  version: 1.0.0          # Pin version

Environment Variables

Override config with environment variables:

Variable Config Path
MUXI_PORT server.port
MUXI_HOST server.host
MUXI_AUTH_ENABLED auth.enabled
MUXI_LOG_LEVEL logging.level

Example Configurations

Development

server:
  port: 7890
  host: 127.0.0.1

auth:
  enabled: false

logging:
  level: debug
  format: text

Production

server:
  port: 7890
  host: 0.0.0.0

auth:
  enabled: true
  keys:
    - id: MUXI_production
      secret: sk_...

formations:
  auto_restart: true
  health_check_interval: 30s

logging:
  level: info
  format: json
  output: /var/log/muxi/server.log

Next Steps