Skip to content

HAProxy refuses to start if starting dataplane as 'program' #310

@hanserasmus

Description

@hanserasmus

Hi all

I am finding my feet with the dataplane API. I have downloaded the latest build from github and followed all the instructions from the documentation. I have converted my config to yaml using the tool provided and it seems all is well, as long as I start the dataplane manually with dataplaneapi -f /etc/haproxy/dataplane.yml. As soon as I add the config in HAProxy to start it via the 'program' declaration in haproxy.cfg, it throws the following error:

Jun 26 10:55:15 haproxy-dev haproxy[12259]: configuration error: the custom reload strategy requires these options to be set: ReloadCmd, RestartCmd
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [NOTICE]   (12257) : haproxy version is 2.4.22-0ubuntu0.22.04.1
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [NOTICE]   (12257) : path to executable is /usr/sbin/haproxy
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [ALERT]    (12257) : Current program 'api' (12259) exited with code 1 (Exit)
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [ALERT]    (12257) : exit-on-failure: killing every processes with SIGTERM
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [ALERT]    (12257) : Current worker #1 (12260) exited with code 143 (Terminated)
Jun 26 10:55:15 haproxy-dev haproxy[12257]: [WARNING]  (12257) : All workers exited. Exiting... (1)
Jun 26 10:55:15 haproxy-dev systemd[1]: haproxy.service: Main process exited, code=exited, status=1/FAILURE

HAProxy config:

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        #stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
        stats socket /var/run/haproxy.sock user haproxy group haproxy mode 660 level admin expose-fd listeners
        stats timeout 30s
        user haproxy
        group haproxy
        daemon
        master-worker
        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private

        # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
        ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
        ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
        ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        timeout connect 5000
        timeout client  50000
        timeout server  50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http

program api
    command /usr/local/bin/dataplaneapi -f /etc/haproxy/dataplaneapi.yml
    no option start-on-reload

Dataplane.yml:

config_version: 2
name: haproxy-dev
mode: single
status: ""
dataplaneapi:
  host: 0.0.0.0
  port: 5555
  advertised:
    api_address: ""
    api_port: 0
  scheme:
  - http
  transaction:
    transaction_dir: /tmp/haproxy
  user:
  - name: admin
    insecure: true
    password: adminpwd
haproxy:
  config_file: /etc/haproxy/haproxy.cfg
  haproxy_bin: /usr/sbin/haproxy
  master_worker_mode: true
  reload:
    reload_delay: 5
    reload_cmd: systemctl reload haproxy
    restart_cmd: systemctl restart haproxy
    status_cmd: systemctl status haproxy
    service_name: haproxy.service
    reload_strategy: custom
log:
  log_to: stdout
  log_file: /var/log/dataplaneapi/dataplaneapi.log
  log_level: warning
  log_format: text
  apache_common_log_format: '%h'
  syslog:
    syslog_protocol: tcp
    syslog_tag: dataplaneapi
    syslog_level: debug
    syslog_facility: local0
haproxy -v
HAProxy version 2.4.22-0ubuntu0.22.04.1 2023/03/22 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-2.4.22.html
Running on: Linux 5.15.39-3-pve #2 SMP PVE 5.15.39-3 (Wed, 27 Jul 2022 13:45:39 +0200) x86_64

Any ideas what might be wrong? I have even tried adding " " around the different commands, but it seems as soon as I restart HAProxy service it removes them again.

Any help will be greatly appreciated!
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions