Pular para o conteúdo principal

Cleanup Plugin

Type: Global Plugin Runs: Once per discovery cycle

Overview

The Cleanup plugin performs cleanup tasks during each discovery cycle, such as removing old temporary files.

Why Use It

Prevents disk space issues by automatically cleaning up temporary files created by EasyHAProxy.

Configuration Options

OptionDescriptionDefault
enabledEnable/disable plugintrue
max_idle_timeMaximum age in seconds before deleting files300
cleanup_temp_filesEnable temp file cleanuptrue

Configuration Examples

Static YAML Configuration

# /etc/haproxy/static/config.yaml
plugins:
enabled: [cleanup]
config:
cleanup:
max_idle_time: 600
cleanup_temp_files: true

Environment Variables

Configure the Cleanup plugin globally:

Environment VariableConfig KeyTypeDefaultDescription
EASYHAPROXY_PLUGINS_ENABLED-string-Enable cleanup plugin (value: cleanup)
EASYHAPROXY_PLUGIN_CLEANUP_ENABLEDenabledbooleantrueEnable/disable plugin
EASYHAPROXY_PLUGIN_CLEANUP_MAX_IDLE_TIMEmax_idle_timeinteger300Maximum age in seconds before deleting files
EASYHAPROXY_PLUGIN_CLEANUP_CLEANUP_TEMP_FILEScleanup_temp_filesbooleantrueEnable temp file cleanup

Note: This is a global plugin - configuration applies to the entire system.

Custom Idle Time (1 hour)

# /etc/haproxy/static/config.yaml
plugins:
enabled: [cleanup]
config:
cleanup:
enabled: true
max_idle_time: 3600 # 1 hour

How It Works

The cleanup plugin:

  • Runs once during each discovery cycle
  • Scans temporary directories for old files
  • Removes files older than max_idle_time seconds
  • Helps maintain disk space efficiency

Important Notes

  • This is a global plugin - it runs once per discovery cycle, not per domain
  • Does not generate HAProxy configuration
  • Performs maintenance operations in the background
  • Safe to enable in production environments