├── .gitignore ├── SOURCES ├── haproxy.logrotate ├── haproxy.syslog.el6 ├── haproxy.syslog.amzn1 ├── haproxy.syslog.amzn2 ├── haproxy.syslog.amzn2023 ├── haproxy.syslog.el8 ├── haproxy.syslog.el9 ├── haproxy.syslog.el7 ├── haproxy.service ├── haproxy.cfg ├── halog.1 └── haproxy.init ├── Dockerfile7 ├── Dockerfile-amzn2 ├── Dockerfile9 ├── Dockerfile-amzn2023 ├── .github └── workflows │ └── main.yml ├── Dockerfile8 ├── README.md ├── Makefile ├── SPECS └── haproxy.spec └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | SOURCES/haproxy-*.tar.gz 2 | rpmbuild 3 | RPMS 4 | lua-* 5 | .docker 6 | -------------------------------------------------------------------------------- /SOURCES/haproxy.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/haproxy/*.log { 2 | rotate 14 3 | daily 4 | missingok 5 | compress 6 | dateext 7 | notifempty 8 | copytruncate 9 | } -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.el6: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | 5 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" 6 | $template HAProxyAccess,"%msg%\n" 7 | 8 | local2.=info /var/log/haproxy/access.log;HAProxyAccess 9 | local2.error /var/log/haproxy/error.log;HAProxy 10 | local2.* /var/log/haproxy/status.log 11 | & ~ -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.amzn1: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | $MaxMessageSize 64k 5 | $FileCreateMode 0600 6 | 7 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" 8 | $template HAProxyAccess,"%msg%\n" 9 | 10 | local2.=info /var/log/haproxy/access.log;HAProxyAccess 11 | local2.error /var/log/haproxy/error.log;HAProxy 12 | local2.* /var/log/haproxy/status.log 13 | & ~ -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.amzn2: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | $MaxMessageSize 64k 5 | $FileCreateMode 0600 6 | 7 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" 8 | $template HAProxyAccess,"%msg%\n" 9 | 10 | local2.=info /var/log/haproxy/access.log;HAProxyAccess 11 | local2.error /var/log/haproxy/error.log;HAProxy 12 | local2.* /var/log/haproxy/status.log 13 | & ~ -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.amzn2023: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | $MaxMessageSize 64k 5 | $FileCreateMode 0600 6 | 7 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg%\n" 8 | $template HAProxyAccess,"%msg%\n" 9 | 10 | local2.=info /var/log/haproxy/access.log;HAProxyAccess 11 | local2.error /var/log/haproxy/error.log;HAProxy 12 | local2.* /var/log/haproxy/status.log 13 | & ~ -------------------------------------------------------------------------------- /Dockerfile7: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | RUN yum install -y pcre-devel make gcc openssl-devel rpm-build systemd-devel curl sed zlib-devel 4 | RUN mkdir RPMS 5 | RUN chmod -R 777 RPMS 6 | RUN mkdir SPECS 7 | RUN mkdir SOURCES 8 | COPY Makefile Makefile 9 | COPY SPECS/haproxy.spec SPECS/haproxy.spec 10 | COPY SOURCES/* SOURCES/ 11 | 12 | CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS 13 | -------------------------------------------------------------------------------- /Dockerfile-amzn2: -------------------------------------------------------------------------------- 1 | FROM amazonlinux:2 2 | 3 | RUN yum install -y pcre-devel make gcc openssl-devel rpm-build systemd-devel curl sed zlib-devel 4 | RUN mkdir RPMS 5 | RUN chmod -R 777 RPMS 6 | RUN mkdir SPECS 7 | RUN mkdir SOURCES 8 | COPY Makefile Makefile 9 | COPY SPECS/haproxy.spec SPECS/haproxy.spec 10 | COPY SOURCES/* SOURCES/ 11 | 12 | CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS 13 | -------------------------------------------------------------------------------- /Dockerfile9: -------------------------------------------------------------------------------- 1 | FROM almalinux:9.0 2 | 3 | RUN dnf install --allowerasing -y pcre-devel make gcc openssl-devel rpm-build systemd-devel curl sed zlib-devel 4 | RUN mkdir RPMS 5 | RUN chmod -R 777 RPMS 6 | RUN mkdir SPECS 7 | RUN mkdir SOURCES 8 | COPY Makefile Makefile 9 | COPY SPECS/haproxy.spec SPECS/haproxy.spec 10 | COPY SOURCES/* SOURCES/ 11 | 12 | CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS 13 | -------------------------------------------------------------------------------- /Dockerfile-amzn2023: -------------------------------------------------------------------------------- 1 | FROM amazonlinux:2023 2 | 3 | RUN dnf install --allowerasing -y pcre-devel make gcc openssl-devel rpm-build systemd-devel curl sed zlib-devel 4 | RUN mkdir RPMS 5 | RUN chmod -R 777 RPMS 6 | RUN mkdir SPECS 7 | RUN mkdir SOURCES 8 | COPY Makefile Makefile 9 | COPY SPECS/haproxy.spec SPECS/haproxy.spec 10 | COPY SOURCES/* SOURCES/ 11 | 12 | CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS 13 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build RPMs 2 | on: [push] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | if: "startsWith(github.event.head_commit.message, 'Build') || startsWith(github.event.head_commit.message, 'Release')" 7 | steps: 8 | - name: checkout 9 | uses: actions/checkout@v3 10 | - name: build 11 | run: | 12 | make run-docker 13 | - uses: marvinpinto/action-automatic-releases@latest 14 | with: 15 | title: "WiP RPM Build" 16 | automatic_release_tag: "WiP" 17 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 18 | files: | 19 | RPMS/**/*.rpm 20 | -------------------------------------------------------------------------------- /Dockerfile8: -------------------------------------------------------------------------------- 1 | FROM centos:8 2 | 3 | RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \ 4 | sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-* 5 | RUN yum install -y pcre-devel make gcc openssl-devel rpm-build systemd-devel curl sed zlib-devel 6 | RUN mkdir RPMS 7 | RUN chmod -R 777 RPMS 8 | RUN mkdir SPECS 9 | RUN mkdir SOURCES 10 | COPY Makefile Makefile 11 | COPY SPECS/haproxy.spec SPECS/haproxy.spec 12 | COPY SOURCES/* SOURCES/ 13 | 14 | CMD make NO_SUDO=1 USE_PROMETHEUS=${USE_PROMETHEUS:-0} RELEASE=${RELEASE:-1} && cp /rpmbuild/RPMS/x86_64/* /RPMS && cp /rpmbuild/SRPMS/* /RPMS 15 | -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.el8: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | 5 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" 6 | $template HAProxyAccess,"%msg%\n" 7 | 8 | if ($programname startswith 'haproxy' and $inputname == 'imudp') then { 9 | if $syslogseverity == 6 then { 10 | action(type="omfile" file="/var/log/haproxy/access.log" template="HAProxyAccess") 11 | stop 12 | } 13 | if $syslogseverity <= 3 then { 14 | action(type="omfile" file="/var/log/haproxy/error.log" template="HAProxy") 15 | stop 16 | } 17 | if $syslogseverity <= 5 then { 18 | action(type="omfile" file="/var/log/haproxy/status.log" template="HAProxy") 19 | stop 20 | } 21 | } -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.el9: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | 5 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" 6 | $template HAProxyAccess,"%msg%\n" 7 | 8 | if ($programname startswith 'haproxy' and $inputname == 'imudp') then { 9 | if $syslogseverity == 6 then { 10 | action(type="omfile" file="/var/log/haproxy/access.log" template="HAProxyAccess") 11 | stop 12 | } 13 | if $syslogseverity <= 3 then { 14 | action(type="omfile" file="/var/log/haproxy/error.log" template="HAProxy") 15 | stop 16 | } 17 | if $syslogseverity <= 5 then { 18 | action(type="omfile" file="/var/log/haproxy/status.log" template="HAProxy") 19 | stop 20 | } 21 | } -------------------------------------------------------------------------------- /SOURCES/haproxy.syslog.el7: -------------------------------------------------------------------------------- 1 | $ModLoad imudp 2 | $UDPServerAddress 127.0.0.1 3 | $UDPServerRun 514 4 | 5 | $template HAProxy,"%TIMESTAMP% %syslogseverity-text:::UPPERCASE%: %msg:::drop-last-lf%\n" 6 | $template HAProxyAccess,"%msg%\n" 7 | 8 | if ($programname startswith 'haproxy' and $inputname == 'imudp') then { 9 | if $syslogseverity == 6 then { 10 | action(type="omfile" file="/var/log/haproxy/access.log" template="HAProxyAccess") 11 | stop 12 | } 13 | if $syslogseverity <= 3 then { 14 | action(type="omfile" file="/var/log/haproxy/error.log" template="HAProxy") 15 | stop 16 | } 17 | if $syslogseverity <= 5 then { 18 | action(type="omfile" file="/var/log/haproxy/status.log" template="HAProxy") 19 | stop 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SOURCES/haproxy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=HAProxy Load Balancer 3 | Documentation=man:haproxy(1) 4 | After=syslog.target network.target 5 | 6 | [Service] 7 | EnvironmentFile=-/etc/sysconfig/haproxy 8 | EnvironmentFile=-/etc/sysconfig/haproxy 9 | Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid" "EXTRAOPTS=-S /run/haproxy-master.sock" 10 | ExecStartPre=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS 11 | ExecStart=/usr/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE $EXTRAOPTS 12 | ExecReload=/usr/sbin/haproxy -f $CONFIG -c -q $EXTRAOPTS 13 | ExecReload=/bin/kill -USR2 $MAINPID 14 | KillMode=mixed 15 | Restart=always 16 | SuccessExitStatus=143 17 | Type=notify 18 | 19 | # The following lines leverage SystemD's sandboxing options to provide 20 | # defense in depth protection at the expense of restricting some flexibility 21 | # in your setup (e.g. placement of your configuration files) or possibly 22 | # reduced performance. See systemd.service(5) and systemd.exec(5) for further 23 | # information. 24 | 25 | # NoNewPrivileges=true 26 | # ProtectHome=true 27 | # If you want to use 'ProtectSystem=strict' you should whitelist the PIDFILE, 28 | # any state files and any other files written using 'ReadWritePaths' or 29 | # 'RuntimeDirectory'. 30 | # ProtectSystem=true 31 | # ProtectKernelTunables=true 32 | # ProtectKernelModules=true 33 | # ProtectControlGroups=true 34 | # If your SystemD version supports them, you can add: @reboot, @swap, @sync 35 | # SystemCallFilter=~@cpu-emulation @keyring @module @obsolete @raw-io 36 | 37 | [Install] 38 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /SOURCES/haproxy.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # This is a sample configuration. It illustrates how to separate static objects 3 | # traffic from dynamic traffic, and how to dynamically regulate the server load. 4 | # 5 | # It listens on 192.168.1.10:80, and directs all requests for Host 'img' or 6 | # URIs starting with /img or /css to a dedicated group of servers. URIs 7 | # starting with /admin/stats deliver the stats page. 8 | # 9 | 10 | global 11 | maxconn 10000 12 | stats socket /var/run/haproxy.stat mode 600 level admin 13 | log 127.0.0.1:514 local2 14 | chroot /var/empty 15 | pidfile /var/run/haproxy.pid 16 | user haproxy 17 | group haproxy 18 | daemon 19 | 20 | # The public 'www' address in the DMZ 21 | frontend public 22 | bind *:80 name clear 23 | #bind *:443 ssl crt /etc/haproxy/haproxy.pem 24 | mode http 25 | log global 26 | option httplog 27 | option dontlognull 28 | monitor-uri /monitoruri 29 | maxconn 8000 30 | timeout client 30s 31 | 32 | stats uri /admin/stats 33 | use_backend static if { hdr_beg(host) -i img } 34 | use_backend static if { path_beg /img /css } 35 | default_backend dynamic 36 | 37 | # The static backend backend for 'Host: img', /img and /css. 38 | backend static 39 | mode http 40 | balance roundrobin 41 | option prefer-last-server 42 | retries 2 43 | option redispatch 44 | timeout connect 5s 45 | timeout server 5s 46 | option httpchk HEAD /favicon.ico 47 | server statsrv1 192.168.1.8:80 check inter 1000 48 | server statsrv2 192.168.1.9:80 check inter 1000 49 | 50 | # the application servers go here 51 | backend dynamic 52 | mode http 53 | balance roundrobin 54 | retries 2 55 | option redispatch 56 | timeout connect 5s 57 | timeout server 30s 58 | timeout queue 30s 59 | option httpchk HEAD /login.php 60 | cookie DYNSRV insert indirect nocache 61 | fullconn 4000 # the servers will be used at full load above this number of connections 62 | server dynsrv1 192.168.1.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000 63 | server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000 64 | server dynsrv3 192.168.1.3:80 minconn 50 maxconn 500 cookie s3 check inter 1000 65 | server dynsrv4 192.168.1.4:80 minconn 50 maxconn 500 cookie s4 check inter 1000 66 | -------------------------------------------------------------------------------- /SOURCES/halog.1: -------------------------------------------------------------------------------- 1 | .TH HALOG "1" "July 2013" "halog" "User Commands" 2 | .SH NAME 3 | halog \- HAProxy log statistics reporter 4 | .SH SYNOPSIS 5 | .B halog 6 | [\fI-h|--help\fR] 7 | .br 8 | .B halog 9 | [\fIoptions\fR] 27 | Only match response times larger|smaller than