-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhaproxy18_cloud_init.yml
91 lines (82 loc) · 3.04 KB
/
haproxy18_cloud_init.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#cloud-config
write_files:
- content: |
global
log /dev/log local0
chroot /var/lib/haproxy18
pidfile /var/run/haproxy18.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy18/stats
# utilize system-wide crypto-policies
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM
#for backend checks
ssl-server-verify none
defaults
mode tcp
log global
option tcplog
option logasap
option dontlognull
option http-server-close
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
resolvers mydns
nameserver dns1 8.8.8.8:53
nameserver dns2 8.8.4.4:53
listen health_check_http_url
bind :8080
mode http
monitor-uri /health
acl backend_down nbsrv(backend) eq 0
monitor fail if backend_down
listen backend
bind *:443
mode tcp
balance leastconn
#if you want stickiness:
#stick match src
#stick-table type ip size 200k expire 30m
#health check, currently checking for a any 2xx or 3xx response
#option tcp-check
#tcp-check connect port 443 ssl
#tcp-check send GET\ /\ HTTP/1.1\r\n
#tcp-check send Host:\ myapp.mydomain.tld\r\n
#tcp-check send \r\n
#tcp-check expect rstring HTTP\/1\.(0|1)\ (2..|3..)
server s1 OldPlatformELB.mydomain.tld:443 check fall 3 rise 2 resolvers mydns
server s2 NewPlatformELB.mydomain.tld:443 check fall 3 rise 2 resolvers mydns
owner: root:root
path: /etc/haproxy18/haproxy18.cfg
permissions: '0644'
- content: |
$AddUnixListenSocket /var/lib/haproxy18/dev/log
# Send haproxy18 messages to a dedicated logfile
:programname, startswith, "haproxy18" {
/var/log/haproxy.log
stop
}
path: /etc/rsyslog.d/99-haproxy18.conf
- content: |
CONFIG=/etc/haproxy18/haproxy18.cfg
path: /etc/sysconfig/haproxy18
runcmd:
- |
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
sudo yum install haproxy18 -y
sudo mkdir -p /var/lib/haproxy18/dev
sudo systemctl restart rsyslog.service
sudo systemctl enable haproxy18.service
sudo systemctl restart haproxy18.service