Skip to content

Instantly share code, notes, and snippets.

@turbo
Created March 31, 2018 10:18
Show Gist options
  • Select an option

  • Save turbo/556cb4deefec84dbe57728495ba359a0 to your computer and use it in GitHub Desktop.

Select an option

Save turbo/556cb4deefec84dbe57728495ba359a0 to your computer and use it in GitHub Desktop.
global
log 127.0.0.1 local0 notice
maxconn 4096
user haproxy
group haproxy
ssl-server-verify none
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
timeout connect 5s
timeout client 60m
timeout server 60m
userlist Dashboard_Admins
user admin insecure-password !!YOURPASSWORDHERE!!
backend dbdash
redirect scheme https if !{ ssl_fc }
server db1 !!NODE_1_IP!!:8080 check port 8080 ssl verify none
server db2 !!NODE_2_IP!!:8080 check port 8080 ssl verify none
server db3 !!NODE_3_IP!!:8080 check port 8080 ssl verify none
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth admin:!!YOURPASSWORDHERE!!
balance roundrobin
option httpclose
option forwardfor
backend letsencrypt-backend
server letsencrypt 127.0.0.1:54321
frontend dash-http
bind 0.0.0.0:80
default_backend dbdash
frontend dash-https
bind 0.0.0.0:443 ssl crt /etc/haproxy/certs/!!YOUR_DOMAIN_HERE!!.pem
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl
acl auth_ok http_auth(Dashboard_Admins)
http-request auth if !letsencrypt-acl !auth_ok
default_backend dbdash
listen psql
bind :26257
mode tcp
balance roundrobin
server db1 !!NODE_1_IP!!:26257
server db2 !!NODE_2_IP!!:26257
server db3 !!NODE_3_IP!!:26257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment