Skip to content

Commit 60796ab

Browse files
authored
Add support for unix upstreams (#266)
Resolves #232
1 parent 088a33b commit 60796ab

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

molecule/common/playbook_default.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- name: "Enable Nginx @CentOS-AppStream dnf modules"
1818
shell:
1919
args:
20-
cmd: dnf module info nginx | grep -q 'Stream.*\[e\]' && echo -n ENABLED || dnf module enable -y nginx # noqa 204 303
20+
cmd: dnf module info nginx | grep -q 'Stream.*\[e\]' && echo -n ENABLED || dnf module enable -y nginx # noqa 204 303
2121
register: dnf_module_enable
2222
changed_when: dnf_module_enable.stdout != 'ENABLED'
2323
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"

molecule/common/playbook_template.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@
221221
port: 8082
222222
weight: 1
223223
health_check: max_fails=3 fail_timeout=5s
224+
backend_server_2:
225+
address: unix:/var/run/control.unit.sock
226+
weight: 1
227+
health_check: max_fails=3 fail_timeout=5s
224228
frontend:
225229
template_file: http/default.conf.j2
226230
conf_file_name: frontend_default.conf

templates/http/default.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ upstream {{ item.value.upstreams[upstream].name }} {
1010
zone {{ item.value.upstreams[upstream].zone_name }} {{ item.value.upstreams[upstream].zone_size }};
1111
{% endif %}
1212
{% for server in item.value.upstreams[upstream].servers %}
13-
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("") }};
13+
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("") }};
1414
{% endfor %}
1515
{% if item.value.upstreams[upstream].sticky_cookie %}
1616
sticky cookie srv_id expires=1h path=/;

0 commit comments

Comments
 (0)