Add back dataplaneapi in anticipation of using it to control haproxy rather than haproxy-sdk runtime socket

master
Thomas Lynch 1 year ago
parent 4e3beaf66d
commit 875e9e5edd
Signed by: fatchan
GPG Key ID: A7E5E8B7E11EE92D
  1. 3
      docker-compose.yml
  2. 8
      haproxy/Dockerfile
  3. 27
      haproxy/dataplaneapi.hcl
  4. 26
      haproxy/haproxy.cfg
  5. 2
      haproxy/map/ddos.map

@ -5,11 +5,14 @@ services:
network_mode: host
ports:
- 80:80
# - 2000:2000 #runtime api
# - 2001:2001 #dataplaneapi
build:
context: ./
dockerfile: haproxy/Dockerfile
volumes:
- ./haproxy/haproxy.cfg:/etc/haproxy/haproxy.cfg
- ./haproxy/dataplaneapi.hcl:/etc/haproxy/dataplaneapi.hcl
- ./haproxy/map/:/etc/haproxy/map/
- ./haproxy/template/:/etc/haproxy/template/
- ./src/lua/scripts/:/etc/haproxy/scripts/

@ -17,7 +17,8 @@ RUN set -eux; \
--uid 99 \
haproxy
ENV HAPROXY_URL http://www.haproxy.org/download/2.6/src/snapshot/haproxy-ss-LATEST.tar.gz
ENV HAPROXY_URL http://www.haproxy.org/download/2.7/src/snapshot/haproxy-ss-LATEST.tar.gz
ENV DATAPLANEAPI_URL https://github.com/haproxytech/dataplaneapi/releases/download/v2.7.2/dataplaneapi_2.7.2_Linux_x86_64.tar.gz
# see https://sources.debian.net/src/haproxy/jessie/debian/rules/ for some helpful navigation of the possible "make" arguments
RUN set -eux; \
@ -37,6 +38,11 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*; \
\
wget -O dataplaneapi_Linux_x86_64.tar.gz "$DATAPLANEAPI_URL"; \
tar -zxvf dataplaneapi_Linux_x86_64.tar.gz; \
chmod +x build/dataplaneapi; \
cp build/dataplaneapi /usr/local/bin/; \
\
wget -O haproxy.tar.gz "$HAPROXY_URL"; \
# echo "$HAPROXY_SHA256 *haproxy.tar.gz" | sha256sum -c; \
mkdir -p /usr/src/haproxy; \

@ -0,0 +1,27 @@
config_version = 2
name = "basedflare"
mode = "single"
dataplaneapi {
host = "127.0.0.1"
port = 2001
user "admin" {
insecure = true
password = "admin"
}
transaction {
transaction_dir = "/tmp/haproxy"
}
advertised {}
}
haproxy {
config_file = "/etc/haproxy/haproxy.cfg"
haproxy_bin = "/usr/local/sbin/haproxy"
reload {
reload_delay = 5
reload_cmd = "service haproxy reload"
restart_cmd = "service haproxy restart"
reload_strategy = "custom"
}
}

@ -18,17 +18,21 @@ defaults
timeout server 50000ms
timeout tarpit 5000ms
#frontend stats-frontend
# bind *:2000
# option tcplog
# mode tcp
# acl white_list src xxx.xxx.xxx.xxx
# tcp-request connection reject unless white_list
# default_backend stats-backend
#backend stats-backend
# mode tcp
# server stats-localhost 127.0.0.1:1999
# program api
# command dataplaneapi -f /etc/haproxy/dataplaneapi.hcl --update-map-files
# no option start-on-reload
#
# frontend stats-frontend
# bind *:2000
# option tcplog
# mode tcp
# acl white_list src 127.0.0.1
# tcp-request connection reject unless white_list
# default_backend stats-backend
#
# backend stats-backend
# mode tcp
# server stats-localhost 127.0.0.1:1999
frontend http-in

@ -1,2 +1,2 @@
localhost 1
localhost/captcha 2
localhost/test 2

Loading…
Cancel
Save