Class: MintPress::HAProxy::Installation

Inherits:
Object
  • Object
show all
Includes:
MintLogger, Mixins::Properties
Defined in:
src/haproxy/lib/haproxy/installation.rb

Properties (Read/Write)

  • #host ⇒ MintPress::Infrastructure::Host
    'Target host on which HAProxy will be installed and managed'

    Property Attributes
    
    
    24
    # File 'src/haproxy/lib/haproxy/installation.rb', line 24
    
    property :host, type: MintPress::Infrastructure::Host, description: 'Target host on which HAProxy will be installed and managed'
  • #transport ⇒ Object (Default Value: Proc.new { host.transport })
    'Transport used for remote command execution and file operations; derived from host by default'

    Property Attributes
    • defaultProc.new { host.transport }
    
    
    25
    26
    27
    # File 'src/haproxy/lib/haproxy/installation.rb', line 25
    
    property :transport, type: Object,
    default: Proc.new { host.transport },
    description: 'Transport used for remote command execution and file operations; derived from host by default'
  • #package_name ⇒ String (Default Value: 'haproxy')
    'Name of the HAProxy package as it appears in the OS package manager'

    Property Attributes
    • default'haproxy'
    
    
    28
    # File 'src/haproxy/lib/haproxy/installation.rb', line 28
    
    property :package_name, type: String, default: 'haproxy', description: 'Name of the HAProxy package as it appears in the OS package manager'
  • #service_name ⇒ String (Default Value: 'haproxy')
    'systemd service unit name used for start/stop/reload/restart operations'

    Property Attributes
    • default'haproxy'
    
    
    29
    # File 'src/haproxy/lib/haproxy/installation.rb', line 29
    
    property :service_name, type: String, default: 'haproxy', description: 'systemd service unit name used for start/stop/reload/restart operations'
  • #haproxy_binary ⇒ String (Default Value: '/usr/sbin/haproxy')
    'Absolute path to the haproxy executable on the target host'

    Property Attributes
    • default'/usr/sbin/haproxy'
    
    
    30
    # File 'src/haproxy/lib/haproxy/installation.rb', line 30
    
    property :haproxy_binary, type: String, default: '/usr/sbin/haproxy', description: 'Absolute path to the haproxy executable on the target host'
  • #config_file ⇒ String (Default Value: '/etc/haproxy/haproxy.cfg')
    'Absolute path where the rendered haproxy.cfg will be written on the target host'

    Property Attributes
    • default'/etc/haproxy/haproxy.cfg'
    
    
    31
    # File 'src/haproxy/lib/haproxy/installation.rb', line 31
    
    property :config_file, type: String, default: '/etc/haproxy/haproxy.cfg', description: 'Absolute path where the rendered haproxy.cfg will be written on the target host'
  • #pid_file ⇒ String (Default Value: '/var/run/haproxy/haproxy.pid')
    'Absolute path to the HAProxy PID file; used for direct process management when systemd is unavailable'

    Property Attributes
    • default'/var/run/haproxy/haproxy.pid'
    
    
    32
    # File 'src/haproxy/lib/haproxy/installation.rb', line 32
    
    property :pid_file, type: String, default: '/var/run/haproxy/haproxy.pid', description: 'Absolute path to the HAProxy PID file; used for direct process management when systemd is unavailable'
  • #software_stage ⇒ String
    'Local path to a pre-built HAProxy binary used as a fallback when no OS package manager is detected'

    Property Attributes
    
    
    33
    # File 'src/haproxy/lib/haproxy/installation.rb', line 33
    
    property :software_stage, type: String, description: 'Local path to a pre-built HAProxy binary used as a fallback when no OS package manager is detected'
  • #install_dir ⇒ String (Default Value: '/usr/sbin')
    'Directory on the target host where the binary is placed when installing from software_stage'

    Property Attributes
    • default'/usr/sbin'
    
    
    34
    # File 'src/haproxy/lib/haproxy/installation.rb', line 34
    
    property :install_dir, type: String, default: '/usr/sbin', description: 'Directory on the target host where the binary is placed when installing from software_stage'
  • #config ⇒ MintPress::HAProxy::Config (Default Value: Proc.new { MintPress::HAProxy::Config.new })
    'HAProxy configuration object whose frontends, backends and global settings are rendered into haproxy.cfg'

    Property Attributes
    • defaultProc.new { MintPress::HAProxy::Config.new }
    
    
    35
    36
    37
    # File 'src/haproxy/lib/haproxy/installation.rb', line 35
    
    property :config, type: MintPress::HAProxy::Config,
    default: Proc.new { MintPress::HAProxy::Config.new },
    description: 'HAProxy configuration object whose frontends, backends and global settings are rendered into haproxy.cfg'
  • #config_source ⇒ String
    'Local path to a pre-built haproxy.cfg to deploy as-is; when set, the config object and ERB template are ignored'

    Property Attributes
    
    
    38
    # File 'src/haproxy/lib/haproxy/installation.rb', line 38
    
    property :config_source, type: String, description: 'Local path to a pre-built haproxy.cfg to deploy as-is; when set, the config object and ERB template are ignored'
  • #keep_failed_config ⇒ [TrueClass, FalseClass] (Default Value: true)
    'When true, copies the staged config to /tmp on the target host if validation fails so it can be inspected; set to false to let the temp file be discarded'

    Property Attributes
    • defaulttrue
    
    
    39
    # File 'src/haproxy/lib/haproxy/installation.rb', line 39
    
    property :keep_failed_config, type: [TrueClass, FalseClass], default: true, description: 'When true, copies the staged config to /tmp on the target host if validation fails so it can be inspected; set to false to let the temp file be discarded'
  • #stats_socket ⇒ String (Default Value: '/run/haproxy/admin.sock')
    'Path to the HAProxy stats UNIX socket on the target host; used by harvest to query live state via socat'

    Property Attributes
    • default'/run/haproxy/admin.sock'
    
    
    40
    # File 'src/haproxy/lib/haproxy/installation.rb', line 40
    
    property :stats_socket, type: String, default: '/run/haproxy/admin.sock', description: 'Path to the HAProxy stats UNIX socket on the target host; used by harvest to query live state via socat'

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary

Attributes included from Mixins::Properties

#autopush_set_cache, #dynamic_create, #harvest_on_access, #harvest_undefined_only, #harvested, #tree_root

Instance Method Summary collapse

Methods included from Mixins::Properties

#[], #[]=, #add_validate_report_result, #armour_set_property, #array_contains?, #array_is_a?, #check_autopush, #check_stack_overflow, #clone_property_object, #cloner_handle_single_property, #coerce_single, #contains_as_string?, #display_validate_report_result, #double_initialize?, #dump_to_hash, #find_parent, #find_parent_by_identity, #generate_accessor_functions, #get_canonical_renamed, #get_from_opts, #get_my_name, #get_property, #get_property_item, #has?, included, #initialize_validate_report, #inspect, #is_cloned_object?, #is_mintpress_object?, #is_probably_canonical?, #is_set?, #local_debug, #local_info, #local_verbose, #mintpress_property_definitions, #place_object_by_identity, #process_properties, #prop_set?, #property, #property_definitions, #property_details, #property_is_simple_object?, #push_root!, #require_property, #require_update, #retrieve_docstring, #sanitize, #set_map_dirty, #set_property, #set_property_item, #show_short_array, #strip_defaults!, #synchronize, #uncloned_property_definitions, #update_map, #validate_generic, #validate_properties, #validate_property, #validate_required, #version_allowed?, #weakref

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Constructor Details

#initialize(opts = {}) ⇒ Installation

Returns a new instance of Installation.

Instance Method Details

#configureObject

---------- configuration ----------

#configure_and_reloadObject

#exists?Boolean

Returns:

  • (Boolean)

#harvestObject

Reads live HAProxy state from the stats socket or HTTP stats endpoint. Returns a nested hash: { 'backend_name' => { 'server_name' => { status: 'UP', weight: 1, ... } } } Also updates BackendServer#harvested_status on any servers present in config.backends.

#installObject

---------- installation ----------

#reloadObject

Graceful reload — new workers replace old ones without dropping connections.

#restartObject

#running?Boolean

Returns:

  • (Boolean)

#startObject

---------- lifecycle ----------

#statusObject

#stopObject

#uninstallObject

#validateObject