-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added HAProxy configuration language (#4303)
* Added HAProxy configuration language * HAProxy - Removing hapee-lb.cfg as a filetype because it does not have much usage in the wild. * Removing hapee-lb.cfg as a sample. * HAProxy - Added config values that are more common. * Adding more sample haproxy.cfg files.
- Loading branch information
1 parent
21005b3
commit 5371f7b
Showing
11 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# HAProxy configuration showing choosing a different backend for static files | ||
global | ||
maxconn 50000 | ||
log /dev/log local0 | ||
log /dev/log local1 notice | ||
user haproxy | ||
group haproxy | ||
stats socket /run/haproxy/admin.sock user haproxy group haproxy mode 660 level admin | ||
nbproc 1 | ||
nbthread 4 | ||
cpu-map auto:1/1-4 0-3 | ||
ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256 | ||
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets | ||
|
||
defaults | ||
timeout connect 5s | ||
timeout client 5s | ||
timeout server 5s | ||
log global | ||
mode http | ||
option httplog | ||
option dontlognull | ||
errorfile 400 /etc/haproxy/errors/400.http | ||
errorfile 403 /etc/haproxy/errors/403.http | ||
errorfile 408 /etc/haproxy/errors/408.http | ||
errorfile 500 /etc/haproxy/errors/500.http | ||
errorfile 502 /etc/haproxy/errors/502.http | ||
errorfile 503 /etc/haproxy/errors/503.http | ||
errorfile 504 /etc/haproxy/errors/504.http | ||
|
||
frontend public | ||
bind 10.0.0.3:80 | ||
bind 10.0.0.3:443 ssl crt /etc/ssl/certs/mysite.pem | ||
redirect scheme https if !{ ssl_fc } | ||
acl static_files path_end .gif .png .jpg .css .js .svg .ttf .woff .woff2 | ||
use_backend nginx if static_files | ||
default_backend nodejs | ||
|
||
backend nodejs | ||
balance roundrobin | ||
cookie PHPSESSID prefix nocache | ||
option httpchk HEAD / | ||
default-server check maxconn 20 | ||
server server1 10.0.1.3:80 cookie server1 | ||
server server2 10.0.1.4:80 cookie server2 | ||
|
||
backend nginx | ||
balance roundrobin | ||
option httpchk HEAD / | ||
server server1 10.0.1.5:80 check | ||
server server2 10.0.1.6:80 check | ||
|
||
listen admin | ||
bind 0.0.0.0:8404 | ||
stats enable | ||
stats uri /monitor | ||
stats refresh 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# HAProxy configuration showing using Basic Auth on Stats page | ||
global | ||
log /dev/log local0 | ||
log /dev/log local1 notice | ||
chroot /var/lib/haproxy | ||
stats socket /run/haproxy/admin.sock mode 660 level admin | ||
stats timeout 30s | ||
user haproxy | ||
group haproxy | ||
ca-base /etc/ssl/certs | ||
crt-base /etc/ssl/private | ||
ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256 | ||
ssl-default-bind-options no-sslv3 | ||
description HAProxy Statistics Page | ||
|
||
defaults | ||
log global | ||
timeout connect 5000 | ||
timeout client 50000 | ||
timeout server 50000 | ||
mode http | ||
option httplog | ||
option dontlognull | ||
balance roundrobin | ||
errorfile 400 /etc/haproxy/errors/400.http | ||
errorfile 403 /etc/haproxy/errors/403.http | ||
errorfile 408 /etc/haproxy/errors/408.http | ||
errorfile 500 /etc/haproxy/errors/500.http | ||
errorfile 502 /etc/haproxy/errors/502.http | ||
errorfile 503 /etc/haproxy/errors/503.http | ||
errorfile 504 /etc/haproxy/errors/504.http | ||
|
||
frontend fe_main | ||
bind :80 | ||
bind :443 ssl crt mysite.pem | ||
http-request redirect scheme https unless ssl_fc | ||
default_backend webservers | ||
|
||
backend webservers | ||
server web1 192.168.0.3:80 check maxconn 20 | ||
server web2 192.168.0.4:80 check maxconn 20 | ||
server web3 192.168.0.5:80 check maxconn 20 | ||
server web4 192.168.0.6:80 check maxconn 20 | ||
|
||
listen stats | ||
bind :9999 ssl crt mycert.pem | ||
stats enable | ||
stats uri /report | ||
stats refresh 30s | ||
stats auth admin:password | ||
stats show-desc | ||
http-request deny unless { src 192.168.50.0/24 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# HAProxy configuration showing load balancing TCP | ||
global | ||
log 192.168.50.2:514 local0 info | ||
chroot /var/lib/haproxy | ||
user haproxy | ||
group haproxy | ||
|
||
defaults | ||
log global | ||
mode tcp | ||
balance leastconn | ||
option tcplog | ||
timeout connect 5s | ||
timeout client 5m | ||
timeout server 5m | ||
|
||
frontend fe_mysql | ||
bind *:3306 | ||
default_backend be_mysql | ||
|
||
backend be_mysql | ||
stick-table type ip size 1m expire 1h | ||
stick match src | ||
stick store-request src | ||
log-tag mysql | ||
server db1 192.168.50.10:3306 check slowstart 60s weight 1 | ||
server db2 192.168.50.11:3306 check slowstart 60s weight 3 | ||
server db3 192.168.50.12:3306 check slowstart 60s backup | ||
server db4 192.168.50.13:3306 check slowstart 60s backup | ||
|
||
listen stats | ||
bind :9999 ssl crt /etc/ssl/certs/mycert.pem | ||
stats enable | ||
stats uri /report | ||
stats refresh 30s | ||
http-request deny unless { src 192.168.50.0/24 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# HAProxy configuration showing redirecting to different backends | ||
global | ||
log 192.168.50.2:514 local0 | ||
chroot /var/lib/haproxy | ||
user haproxy | ||
group haproxy | ||
ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256 | ||
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets | ||
|
||
defaults | ||
log global | ||
option httplog | ||
timeout connect 5s | ||
timeout client 1m | ||
timeout server 1m | ||
|
||
frontend mywebsite | ||
bind :80 | ||
balance roundrobin | ||
mode http | ||
acl apipath path_beg /api/ | ||
acl apihost req.hdr(Host) -i -m dom api.mywebsite.com | ||
redirect prefix http://api.mywebsite.com if apipath | ||
use_backend apiservers if apihost | ||
default_backend webservers | ||
|
||
backend webservers | ||
option httpchk HEAD /health | ||
server web1 192.168.0.3:80 check maxconn 20 | ||
server web2 192.168.0.4:80 check maxconn 20 | ||
|
||
backend apiservers | ||
option httpchk HEAD /health | ||
server api1 192.168.0.10:80 check maxconn 20 | ||
server api2 192.168.0.11:80 check maxconn 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title=Mindstorms | ||
isbn=0465046290 | ||
author=Seymour Papert | ||
pubmonth=198001 | ||
subject=children computers powerful ideas LOGO education | ||
url=http://www.papert.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule atom-language-haproxy
added at
bc1e39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
type: grammar | ||
name: atom-language-haproxy | ||
version: bc1e39d523ed78f29284e3da13cb579dc0d29e30 | ||
license: mit | ||
--- | ||
Copyright (c) 2016 Alexander Bulimov | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |