[service-fluentd]
recipe = slapos.cookbook:wrapper
wrapper-path = {{ directory['service'] }}/fluentd-service
command-line = ${fluentd:location}/bin/fluentd -v -c {{ fluentd_agent_conf }}
environment =
  GEM_PATH=${fluentd:location}/lib/ruby/gems/

{% set part_list = [] -%}

{% for port in port_list -%}
{%   set promise_section_title = 'fluentd-port-' ~ port ~ '-listening' -%}
{%   do part_list.append(promise_section_title) -%}
[{{ promise_section_title }}]
<= monitor-promise-base
promise = check_socket_listening
name = {{ promise_section_title }}.py
config-host = $${slap-configuration:ipv6-random}
config-port = {{ port }}
{% endfor %}

[buildout]
parts =
  service-fluentd
{%- for part in part_list %}
  {{ part }}
{%- endfor %}

extends = ${monitor-template:output}
