version: '3.6'

services:
{% for workers in conductor_workers %}
  {{ workers.service }}:
    environment:
      CONDUCTOR_SERVER: {{ conductor_service_url }}
      CONDUCTOR_HEALTH: {{ conductor_service_health_url }}
    configs:
      - source: {{workers.service}}-config
        target: /app/config.cfg     
    image: '{{ workers.image }}' 
    networks:
      - {{ conductor_network }}
    deploy:
      mode: replicated
      replicas: {{ workers.replicas }}
{% if infrastructure != 'local' %}
      placement:
        constraints: [node.role == worker]
{% endif %}
      restart_policy:
        condition: on-failure
        delay: 5s
        window: 120s
    logging:
      driver: "journald"

{% endfor %}

networks:
   {{ conductor_network }}:

configs:
{% for workers in conductor_workers %}
   {{workers.service}}-config:
     file: {{workers.service}}-config.cfg
{% endfor %}
