Skip to content

Daemon Configuration

BadgerDaemon is configured through a YAML file located at /etc/badgerdaemon/config.yml. This file is generated during installation but can be modified for advanced configurations.

Restart Required

After changing the configuration file, restart the daemon for changes to take effect:

bash
systemctl restart badgerdaemon

Configuration File

The default configuration file location is /etc/badgerdaemon/config.yml. You can specify a different path using the --config flag:

bash
badgerdaemon --config /path/to/config.yml

Full Configuration Reference

yaml
# ===========================================
# BadgerDaemon Configuration
# ===========================================

# Panel connection settings
panel_url: "https://panel.your-domain.com"
token: "your-node-authentication-token"

# Data directory where server files are stored
# Each server gets a subdirectory: <data_directory>/<server-uuid>/
data_directory: "/var/lib/badgerdaemon/servers"

# Temporary directory for installations, transfers, etc.
tmp_directory: "/tmp/badgerdaemon"

# ===========================================
# SFTP Configuration
# ===========================================
sftp:
  # Enable or disable the built-in SFTP server
  enabled: true

  # Port to listen on
  port: 2022

  # Address to bind to (0.0.0.0 for all interfaces)
  bind_address: "0.0.0.0"

# ===========================================
# Docker Configuration
# ===========================================
docker:
  # Path to the Docker socket
  socket: "/var/run/docker.sock"

  # Docker network name for game server containers
  network: "badgerpanel"

  # Container stop timeout in seconds (SIGTERM, then SIGKILL)
  stop_timeout: 30

  # Maximum log size per container before rotation
  log_max_size: "10m"

  # Number of rotated log files to keep
  log_max_files: 3

# ===========================================
# Resource Monitoring
# ===========================================
monitoring:
  # Interval for reporting system stats to the panel (in seconds)
  stats_interval: 15

  # Interval for checking container resource usage (in seconds)
  container_stats_interval: 5

  # Disk usage check interval (in seconds)
  # Disk checks are more expensive, so this runs less frequently
  disk_check_interval: 60

# ===========================================
# Server Management
# ===========================================
servers:
  # Automatically restart crashed containers
  crash_detection: true

  # Number of crashes within the window before giving up
  crash_limit: 3

  # Time window for crash detection (in seconds)
  # If <crash_limit> crashes happen within this window, auto-restart stops
  crash_window: 600

  # Delay before restarting a crashed container (in seconds)
  crash_restart_delay: 5

# ===========================================
# Logging
# ===========================================
log:
  # Log level: debug, info, warn, error
  level: "info"

  # Log file path (leave empty for stdout only)
  file: "/var/log/badgerdaemon/daemon.log"

  # Maximum log file size before rotation (e.g., "50m", "1g")
  max_size: "50m"

  # Number of rotated log files to keep
  max_backups: 5

Configuration Options

Panel Connection

OptionDescriptionDefault
panel_urlFull URL of your BadgerPanel instanceRequired
tokenAuthentication token generated by the panelRequired

The panel_url must be reachable from the daemon node over HTTPS. The token is generated when you create the node in the admin panel and can be regenerated from the node's settings page.

Token Security

The authentication token provides full control over the daemon. Keep it secret and never commit it to version control. If compromised, regenerate it immediately from the panel admin area.

Data Directory

OptionDescriptionDefault
data_directoryRoot directory for server files/var/lib/badgerdaemon/servers
tmp_directoryTemporary directory for operations/tmp/badgerdaemon

Each game server's files are stored in a subdirectory named by the server's UUID:

/var/lib/badgerdaemon/servers/
├── a1b2c3d4-e5f6-7890-abcd-ef1234567890/
│   ├── server.jar
│   ├── server.properties
│   └── world/
├── b2c3d4e5-f6a7-8901-bcde-f12345678901/
│   └── ...

Storage Considerations

Use fast SSD storage for the data directory. Game servers benefit significantly from low-latency I/O, especially games like Minecraft that perform frequent disk reads/writes.

SFTP Configuration

OptionDescriptionDefault
sftp.enabledEnable the built-in SFTP servertrue
sftp.portPort for SFTP connections2022
sftp.bind_addressAddress to bind the SFTP server0.0.0.0

Users connect to SFTP using their panel credentials. The SFTP server scopes each user to their server's data directory, preventing access to other servers or the host filesystem.

SFTP connection details for users:

  • Host: Your node's IP or FQDN
  • Port: 2022 (or your configured port)
  • Username: Panel email address
  • Password: Panel account password

Docker Configuration

OptionDescriptionDefault
docker.socketPath to the Docker daemon socket/var/run/docker.sock
docker.networkDocker network for game server containersbadgerpanel
docker.stop_timeoutSeconds to wait for graceful shutdown before SIGKILL30
docker.log_max_sizeMaximum container log size before rotation10m
docker.log_max_filesNumber of rotated log files to retain3

Docker Network

The daemon creates a Docker bridge network for game server containers. This provides network isolation between containers while allowing outbound internet access for downloads and updates.

Resource Monitoring

OptionDescriptionDefault
monitoring.stats_intervalHow often to report system stats to the panel (seconds)15
monitoring.container_stats_intervalHow often to check per-container resource usage (seconds)5
monitoring.disk_check_intervalHow often to check disk usage (seconds)60

These intervals affect:

  • How frequently the panel receives updated system statistics
  • How quickly resource limit violations are detected
  • How much overhead monitoring adds to the node

Crash Detection

OptionDescriptionDefault
servers.crash_detectionEnable automatic restart of crashed containerstrue
servers.crash_limitMaximum restarts within the crash window3
servers.crash_windowTime window for counting crashes (seconds)600
servers.crash_restart_delayDelay before restarting a crashed container (seconds)5

When a game server container exits unexpectedly, the daemon will automatically restart it. If the server crashes more than crash_limit times within crash_window seconds, the daemon stops restarting and marks the server as crashed. This prevents infinite restart loops.

Logging

OptionDescriptionDefault
log.levelMinimum log level to outputinfo
log.filePath to the log file (empty for stdout only)/var/log/badgerdaemon/daemon.log
log.max_sizeMaximum log file size before rotation50m
log.max_backupsNumber of rotated log files to keep5

Log levels:

LevelDescription
debugVerbose output for development and troubleshooting
infoStandard operational messages
warnPotential issues that do not prevent operation
errorErrors that may affect functionality

Debug Logging

Setting log.level to debug produces a large volume of output and may affect performance on busy nodes. Only use debug logging temporarily when troubleshooting specific issues.

Viewing Logs

Since the daemon runs as a systemd service, you can view logs through journalctl:

bash
# Follow logs in real-time
journalctl -u badgerdaemon -f

# View the last 100 lines
journalctl -u badgerdaemon --tail 100

# View logs from the last hour
journalctl -u badgerdaemon --since "1 hour ago"

# View only errors
journalctl -u badgerdaemon -p err

If a log file is configured, you can also read it directly:

bash
tail -f /var/log/badgerdaemon/daemon.log

Command-Line Flags

The daemon binary supports the following command-line flags:

bash
badgerdaemon --help
FlagDescriptionDefault
--configPath to configuration file/etc/badgerdaemon/config.yml
--versionPrint version and exit--
--debugOverride log level to debug--

Next Steps

BadgerPanel Documentation