Some refactory to support letsencrypt
This commit is contained in:
parent
bdc97fa10d
commit
9fa9dc9841
15 changed files with 207 additions and 145 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{% if "ssl_cert" in o %}
|
||||
bind *:{{ o["port"] }} ssl crt {{ o["ssl_cert"] }}
|
||||
bind *:{{ o["port"] }} ssl crt /etc/haproxy/certs/discover/ crt /etc/haproxy/certs/
|
||||
{% elif "h2" in o and o["h2"] %}
|
||||
bind *:{{ o["port"] }} proto h2
|
||||
option http-use-htx
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
{% endfor %}
|
||||
|
||||
{%- for k in o["hosts"] %}
|
||||
{% set host = k.replace(".", "_") + "_{0}_{1}".format(o["port"], salt) %}
|
||||
{% set host = k.replace(".", "_") + "_{0}".format(o["port"]) %}
|
||||
{% set letsencrypt = o["hosts"][k]["letsencrypt"] %}
|
||||
|
||||
acl is_rule_{{ host }}_1 hdr(host) -i {{ k }}
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
option tcplog
|
||||
log global
|
||||
{% set backend = (o["hosts"]|first) %}
|
||||
default_backend srv_{{ backend.replace(".", "_") + "_{0}_{1}".format(o["port"], salt) }}
|
||||
default_backend srv_{{ backend.replace(".", "_") + "_{0}".format(o["port"]) }}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ backend srv_stats
|
|||
{% endif %}
|
||||
{% for o in data["easymapping"] -%}
|
||||
{% set mode = o["mode"] or "http" %}
|
||||
{% set salt = loop.index %}
|
||||
|
||||
frontend {{ mode }}_in_{{ o["port"] }}_{{ salt }}
|
||||
frontend {{ mode }}_in_{{ o["port"] }}
|
||||
{% include "bind.j2" %}
|
||||
{% if mode == "http" %}
|
||||
{% include "frontend-mode-http.j2" %}
|
||||
|
|
@ -50,7 +49,7 @@ frontend {{ mode }}_in_{{ o["port"] }}_{{ salt }}
|
|||
{% endif %}
|
||||
|
||||
{% for k in o["hosts"] -%}
|
||||
{% set host = k.replace(".", "_") + "_{0}_{1}".format(o["port"], salt) %}
|
||||
{% set host = k.replace(".", "_") + "_{0}".format(o["port"]) %}
|
||||
backend srv_{{ host }}
|
||||
balance roundrobin
|
||||
mode {{ mode }}
|
||||
|
|
@ -69,4 +68,5 @@ backend srv_{{ host }}
|
|||
{% endfor %}
|
||||
|
||||
backend letsencrypt_backend
|
||||
mode http
|
||||
server certbot 127.0.0.1:2080
|
||||
Loading…
Add table
Add a link
Reference in a new issue