---

nginx_id: "{{ inventory_hostname }}-nginx"

nginx_labels: [
  '"traefik.enable=true"',
  '"traefik.http.routers.{{ nginx_id }}.service={{ nginx_id }}"',
  '"traefik.http.routers.{{ nginx_id }}.rule=Host(`{{ stage_server_domain }}`)"',
  '"traefik.http.routers.{{ nginx_id }}.entrypoints=websecure"',
  '"traefik.http.routers.{{ nginx_id }}.tls=true"',
  '"traefik.http.routers.{{ nginx_id }}.tls.certresolver=letsencrypt"',
  '"traefik.http.services.{{ nginx_id }}.loadbalancer.server.port={{ http_port }}"',
]

nginx_docker: {
  networks: [
    {
      name: front-tier,
      external: true,
    },
  ],
  services: [
    {
      name: "{{ nginx_id }}",
      image_name: "{{ nginx_image }}",
      image_version: alpine,
      labels: "{{ nginx_labels }}",
      volumes: [
        "{{ service_base_path }}/{{ inventory_hostname }}/dist:/usr/share/nginx/html",
        "{{ service_base_path }}/{{ inventory_hostname }}/conf/nginx.conf:/etc/nginx/conf.d/default.conf"
      ],
      networks: [
        '"front-tier"',
      ],
    }
  ],
}
