{% from "docker/map.jinja" import client with context %}

include:
  - docker.client

{%- for app, compose in client.stack.iteritems() %}
  {%- if compose.service is defined %}
    {%- if compose.secrets is defined %}
      {%- for secret, values in compose.secrets.iteritems() %}
        {%- if values['external'] is defined and values['external'] == true %}
docker_secret_{{ secret }}:
  cmd.run:
    - name: >
        retry=5
        i=1;
        while [[ $i -lt $retry ]]; do
          echo "{{ values['value'] }}" | docker secret create {{ secret }} -;
          ret=$?;
          if [[ $ret -eq 0 ]]; then echo 'Secret created'; break;
          else
            echo "Secret creation failed, retrying in 3 seconds.." >&2;
            sleep 3;
            i=$(( i + 1 ));
          fi;
          if [[ $i -ge $retry ]]; then
            echo "Secret creation failed!"; exit 1;
          fi;
        done;
    - shell: /bin/bash
    - user: {{ compose.user|default("root") }}
    - unless: "docker secret inspect {{ secret }}"
    - output_loglevel: quiet
    - require_in:
      - cmd: docker_stack_{{ app }}
      - cmd: docker_stack_{{ app }}_update
        {%- endif %}
      {%- endfor %}
    {%- endif %}

docker_{{ app }}_dir:
  file.directory:
    - name: {{ client.compose.base }}/{{ app }}
    - makedirs: true

docker_{{ app }}_compose:
  file.managed:
    - name: {{ client.compose.base }}/{{ app }}/docker-compose.yml
    - source: salt://docker/files/docker-compose.yml
    - template: jinja
    - mode: 600
    - defaults:
        compose: {{ compose }}
        volume: {{ compose.volume|default({}) }}
        service: {{ compose.service }}
        network: {{ compose.network|default({}) }}
        secrets: {{ compose.secrets|default({}) }}
    - require:
        - file: docker_{{ app }}_dir

    {%- if compose.environment is defined %}

docker_{{ app }}_env:
  file.managed:
    - name: {{ client.compose.base }}/{{ app }}/.env
    - source: salt://docker/files/docker-env
    - template: jinja
    - user: {{ compose.user|default("root") }}
    - mode: 640
    - defaults:
        env: {{ compose.environment }}
    - require:
        - file: docker_{{ app }}_dir

    {%- else %}

docker_{{ app }}_env:
  file.absent:
    - name: {{ client.compose.base }}/{{ app }}/.env

    {%- endif %}

    {%- for name, service in compose.service.iteritems() %}
      {%- for volume in service.get('volumes', []) %}
        {%- if volume is string and ':' in volume %}
          {%- set path = volume.split(':')[0] %}
        {%- elif volume is mapping and volume.get('type', 'bind') == 'bind' %}
          {%- set path = volume.source %}
        {%- else %}
          {%- set path = None %}
        {%- endif %}

        {%- if path != None and path not in compose.get('volume', {}).keys() %}
docker_{{ app }}_{{ name }}_volume_{{ path }}:
  file.directory:
    - name: {{ path }}
    - makedirs: true
    - unless: "test -e {{ path }}"
        {%- endif %}
      {%- endfor %}
    {%- endfor %}

    {%- if compose.enabled|default(True) %}

docker_stack_{{ app }}:
  cmd.run:
    - name: >
        retry=5
        i=1;
        while [[ $i -lt $retry ]]; do
          {%- if compose.registry_auth|default(False) %}
          docker stack deploy --with-registry-auth --compose-file docker-compose.yml {{ app }};
          {%- else %}
          docker stack deploy --compose-file docker-compose.yml {{ app }};
          {%- endif %}
          ret=$?;
          if [[ $ret -eq 0 ]]; then echo 'Stack created'; break;
          else
            echo "Stack creation failed, retrying in 3 seconds.." >&2;
            sleep 3;
            i=$(( i + 1 ));
          fi;
          if [[ $i -ge $retry ]]; then
            echo "Stack creation failed!"; exit 1;
          fi;
        done;
    - shell: /bin/bash
    - cwd: {{ client.compose.base }}/{{ app }}
    - user: {{ compose.user|default("root") }}
    - unless: "docker stack ls | grep '{{ app }}'"
    - require:
      - file: docker_{{ app }}_env
      - file: docker_{{ app }}_compose

docker_stack_{{ app }}_update:
  cmd.wait:
    - name: >
        retry=5
        i=1;
        while [[ $i -lt $retry ]]; do
          {%- if compose.registry_auth|default(False) %}
          docker stack deploy --with-registry-auth --compose-file docker-compose.yml {{ app }};
          {%- else %}
          docker stack deploy --compose-file docker-compose.yml {{ app }};
          {%- endif %}
          ret=$?;
          if [[ $ret -eq 0 ]]; then echo 'Stack updated'; break;
          else
            echo "Stack update failed, retrying in 3 seconds.." >&2;
            sleep 3;
            i=$(( i + 1 ));
          fi;
          if [[ $i -ge $retry ]]; then
            echo "Stack update failed!"; exit 1;
          fi;
        done;
    - shell: /bin/bash
    - cwd: {{ client.compose.base }}/{{ app }}
    - user: {{ compose.user|default("root") }}
    - require:
      - cmd: docker_stack_{{ app }}
    - watch:
      - file: docker_{{ app }}_env
      - file: docker_{{ app }}_compose

    {%- else %}

docker_remove_{{ app }}:
  cmd.run:
    - name: docker stack rm {{ app }}
    - user: {{ compose.user|default("root") }}
    - onlyif: "docker stack ls | grep '{{ app }}'"

    {%- endif %}

  {%- else %}

    {#-
      No stack.service is defined so we can add support for deploying using
      bundle file, etc.
    #}

  {%- endif %}
{%- endfor %}
