Add support for unix upstreams (#266)

Resolves #232
This commit is contained in:
Alessandro Fael Garcia 2020-06-22 20:54:29 +02:00 committed by GitHub
parent 088a33b33a
commit 60796abcd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -221,6 +221,10 @@
port: 8082 port: 8082
weight: 1 weight: 1
health_check: max_fails=3 fail_timeout=5s health_check: max_fails=3 fail_timeout=5s
backend_server_2:
address: unix:/var/run/control.unit.sock
weight: 1
health_check: max_fails=3 fail_timeout=5s
frontend: frontend:
template_file: http/default.conf.j2 template_file: http/default.conf.j2
conf_file_name: frontend_default.conf conf_file_name: frontend_default.conf

View File

@ -10,7 +10,7 @@ upstream {{ item.value.upstreams[upstream].name }} {
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }}; zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
{% endif %} {% endif %}
{% for server in item.value.upstreams[upstream].servers %} {% for server in item.value.upstreams[upstream].servers %}
server {{ item.value.upstreams[upstream].servers[server].address }}:{{ item.value.upstreams[upstream].servers[server].port }} weight={{ item.value.upstreams[upstream].servers[server].weight|default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check|default("") }}; server {{ item.value.upstreams[upstream].servers[server].address }}{{(":" + item.value.upstreams[upstream].servers[server].port | string) if item.value.upstreams[upstream].servers[server].port is defined}} weight={{ item.value.upstreams[upstream].servers[server].weight | default("1") }} {{ item.value.upstreams[upstream].servers[server].health_check | default("") }};
{% endfor %} {% endfor %}
{% if item.value.upstreams[upstream].sticky_cookie %} {% if item.value.upstreams[upstream].sticky_cookie %}
sticky cookie srv_id expires=1h path=/; sticky cookie srv_id expires=1h path=/;