Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
haproxytechblog / haproxy-config-2-1.cfg
Created December 2, 2019 23:22
HAProxy 2.1 Sample Config
#
# This is the ultimate HAProxy 2.0 "Getting Started" config
# It demonstrates many of the features available which are now available
# While you may not need all of these things, this can serve
# as a reference for your own configurations.
#
# Have questions? Check out our community Slack:
# https://slack.haproxy.org/
#
@haproxytechblog
haproxytechblog / blog20191216-01.cfg
Last active May 9, 2021 21:42
Programmatic HAProxy Configuration Using the Data Plane API
userlist dataplane-api
user dataplaneapi password $5$oui1y1Q7o$VXoOr7Ns9WLyDFkWH0LTu9oysn/zyYhF4mSQHe9Ba5D
program api
command /opt/hapee-extras/sbin/hapee-dataplane-api --host 192.168.122.14 --port 5555 -c /etc/hapee-2.0/hapee-lb.cfg -u dataplane-api -b /opt/hapee-2.0/sbin/hapee-lb -r "service hapee-2.0-lb reload" --reload-delay 5 -m /var/run/hapee-2.0/hapee-lb.sock --log-to=file --log-file=/var/log/hapee-runtime-api.log
@haproxytechblog
haproxytechblog / video-yammer-20190120-01.cfg
Created January 20, 2020 19:48
HAProxyConf 2019 - Yammer
defaults
mode {protocol}
balance {balanceMode}
timeout client {clTO}
timeout connect {cTO}
timeout server {sTO}
timeout http-keep-alive {kaTO}
listen ::{service}-{servicePort}
acl down nbsrv(hc-{servicePort}) lt 1
@haproxytechblog
haproxytechblog / video-thredup-20200120-01.cfg
Last active January 20, 2020 21:12
HAProxyConf 2019 - thredUP
backend cart_service
server blue-cart-service cart-blue.ec2.tup.internal:8025 check weight 0 backup
server green-cart-service cart-green.ec2.tup.internal:8025 check weight 100
@haproxytechblog
haproxytechblog / blog20200121-01.cfg
Created January 21, 2020 18:15
Building Blocks of a Modern Proxy
stats socket /var/run/haproxy.sock mode 600 expose-fd listeners level user
@haproxytechblog
haproxytechblog / blog20200122-01.cfg
Created January 22, 2020 17:31
HAProxyConf 2019 Recap
frontend proxy
http-request set-path /path2 if { path /path1 } { date() ge 1571558400 }
@haproxytechblog
haproxytechblog / video-inuits-20200123-01.cfg
Created January 23, 2020 21:56
HAProxyConf 2019 - HAProxy as Egress Controller
frontend proxy
acl client:myback:prod src 172.21.132.0/25
acl client:myback:dev src 172.21.131.0/25
acl client:myback:acc src 172.21.130.0/25
acl client:legback:dev src 172.21.132.2 172.21.132.4
acl client:3rdapp:prod src 172.21.132.0/25
@haproxytechblog
haproxytechblog / blog20200211-01.yaml
Last active February 25, 2023 17:37
Rolling Updates and Blue-Green Deployments with Kubernetes and HAProxy
apiVersion: v1
kind: ConfigMap
metadata:
name: haproxy-configmap
namespace: default
data:
ssl-redirect: "OFF"
@haproxytechblog
haproxytechblog / blog20200219-01.sh
Last active August 1, 2021 15:27
Load Balancing PHP-FPM with HAProxy and FastCGI
$ sudo apt update
$ sudo apt install php-fpm
@haproxytechblog
haproxytechblog / 20200312-01.yaml
Last active November 23, 2020 11:57
Multi-tenant Kubernetes Clusters with the HAProxy Kubernetes Ingress Controller
apiVersion: v1
kind: Namespace
metadata:
name: dev