<file name="@l_prefix@/etc/consul/consul.json" nodetype="platform">
{
    "datacenter":           "soe",
    "node_name":            "{{ host.hostname }}",
    "bind_addr":            "{{ host.addr.int }}",
    "server":               true,
    "bootstrap_expect":     1,
    "start_join":           [
        {% for node in platform.nodes %}
        "{{ node.addr.int }}",
        {% endfor %}
    ],
    "leave_on_terminate":   true,
    "ports": {
        "server":           8300,
        "serf_lan":         8301,
        "serf_wan":         8302,
        "rpc":              8400,
        "http":             8500,
        "dns":              8600
    },
    "domain":               "consul.",
    "log_level":            "INFO",
    "ui":                   true,
    "disable_update_check": true
}
</file>
<file name="@l_prefix@/etc/consul/consul.json" nodetype="farm">
{
    "datacenter":           "soe",
    "node_name":            "{{ host.hostname }}",
    "bind_addr":            "{{ host.addr.int }}",
    "server":               false,
    "start_join":           [
        {% for node in platform.nodes %}
        "{{ node.addr.int }}",
        {% endfor %}
    ],
    "leave_on_terminate":   true,
    "ports": {
        "server":           8300,
        "serf_lan":         8301,
        "serf_wan":         8302,
        "rpc":              8400,
        "http":             8500,
        "dns":              8600
    },
    "domain":               "consul.",
    "log_level":            "INFO",
    "ui":                   true,
    "disable_update_check": true
}
</file>
<file name="@l_prefix@/etc/nginx/nginx.conf" nodetype="platform">
##
##  nginx.conf -- NGINX configuration for SoE
##

user                    @l_nusr@ @l_ngrp@;
error_log               @l_prefix@/var/nginx/log/nginx.log notice;
pid                     @l_prefix@/var/nginx/run/nginx.pid;

worker_processes        4;
worker_rlimit_nofile    8192;

events {
    worker_connections  1024;
}

http {
    include             mime.types;
    default_type        application/octet-stream;

    log_format main     '$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
    access_log          @l_prefix@/var/nginx/log/nginx.access.log main;

    sendfile            on;
    tcp_nopush          on;
    keepalive_timeout   65;
    gzip                off;

    client_max_body_size 20M;

    #   InfluxDB Server HTTP services
    upstream influxdb-server-http {
        {% for node in platform.nodes %}
        server {{ node.addr.ext }}:8088;
        {% endfor %}
    }

    #   InfluxDB Relay HTTP services
    upstream influxdb-relay-http {
        {% for node in platform.nodes %}
        server {{ node.addr.ext }}:9096;
        {% endfor %}
    }

    #   InfluxDB Proxy HTTP service
    server {
        listen 7076;
        location /query {
            limit_except GET { deny all; }
            proxy_pass http://influxdb-server-http;
        }
        location /write {
            limit_except POST { deny all; }
            proxy_pass http://influxdb-relay-http;
        }
    }
}

stream {
    #   InfluxDB Server UDP services
    upstream influxdb-server-udp {
        {% for node in platform.nodes %}
        server {{ node.addr.ext }}:8003;
        {% endfor %}
    }

    #   InfluxDB Proxy UDP service
    server {
        listen 7003 udp;
        proxy_pass influxdb-server-udp;
        proxy_timeout 1s;
        proxy_responses 1;
    }
}

</file>
