Skip to content

Instantly share code, notes, and snippets.

@x-cray
Created January 20, 2016 21:07
Show Gist options
  • Save x-cray/d96fdc284644b3649770 to your computer and use it in GitHub Desktop.
Save x-cray/d96fdc284644b3649770 to your computer and use it in GitHub Desktop.
{% macro backends(environment) -%}
##
# {{ environment }} backends
##
{{ '{{' }}$environment := "{{ environment }}"{{ '}}' }}
backend cluster_{{ environment }}:test-server
option forwardfor
option httpchk GET /healthcheck
balance roundrobin{% raw %}{{range $i, $s := service (print $environment ".test-server")}}
server {{$s.Node}}-{{$i}} {{$s.Address}}:{{$s.Port}} check inter 10s fall 1 rise 1{{end}}{% endraw %}
{%- endmacro %}
{{ backends('production') }}
{{ backends('staging') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment