From: Kai Moritz Date: Sun, 15 Jan 2023 13:07:16 +0000 (+0100) Subject: feat: Added a first working simple configuration for HAProxy X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e7ca5f53b2f8924ef5000a15a167181eb8eaecfb;p=demos%2Fkafka%2Fchat feat: Added a first working simple configuration for HAProxy --- diff --git a/README.sh b/README.sh new file mode 100644 index 00000000..7b489490 --- /dev/null +++ b/README.sh @@ -0,0 +1,2 @@ +#!/bin/sh +docker run --rm --sysctl net.ipv4.ip_unprivileged_port_start=0 -v $(pwd)./haproxy.cfg://usr/local/etc/haproxy/haproxy.cfg:ro haproxy:2.7 -c diff --git a/docker-compose.yml b/docker-compose.yml index 9f476d03..6d093704 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,6 +84,22 @@ services: depends_on: - kafka-0 + haproxy: + image: haproxy:2.7 + volumes: + - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro + sysctls: + net.ipv4.ip_unprivileged_port_start: 0 + ports: + - 8080:80 + - 8404:8404 + + web1: + image: nginx:1.17 + web2: + image: nginx:1.17 + web3: + image: nginx:1.17 setup: image: juplo/toolbox diff --git a/haproxy.cfg b/haproxy.cfg new file mode 100644 index 00000000..f334457c --- /dev/null +++ b/haproxy.cfg @@ -0,0 +1,23 @@ +# Config from Blog-article "How to Run HAProxy with Docker" +defaults + mode http + timeout client 10s + timeout connect 5s + timeout server 10s + timeout http-request 10s + log global + +frontend stats + bind *:8404 + stats enable + stats uri / + stats refresh 10s + +frontend frontend + bind :80 + default_backend webservers + +backend webservers + server s1 web1:80 check + server s2 web2:80 check + server s3 web3:80 check