version: '3'

### Polymatica Dashboards TN 1.30.0 ###

services:

### General ###

  traefik:
    restart: unless-stopped
    image: traefik:2.5
    networks:
      - polymatica
    ports:
      - 80:80
      - 443:443
      - 18080:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./traefik-docker-provider.yml:/traefik.yml:ro
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.dashboard.entrypoints=traefik"
      - "traefik.http.routers.dashboard.rule=HostRegexp(`{host:.+}`)"
      - "traefik.http.routers.dashboard.service=api@internal"
      - "traefik.http.services.traefik-dashboard.loadbalancer.server.port=8080"
      - "polymatica=platform"


  gateway:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/gateway:stage-eb01c48a
    depends_on:
      - discovery
      - rabbitmq
    networks:
      -  polymatica
    environment:
      - POLYMATICA_GATEWAY_HTTP_HOST=0.0.0.0
      - POLYMATICA_GATEWAY_HTTP_PORT=9690
      - POLYMATICA_GATEWAY_MODULE_BACK_URL=http://gateway:9690
      - POLYMATICA_GATEWAY_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_GATEWAY_RABBIT_MQ_USER=polymatica
      - POLYMATICA_GATEWAY_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_GATEWAY_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_GATEWAY_RABBIT_MQ_PORT=5672
      - POLYMATICA_GATEWAY_RABBIT_MQ_VHOST=polymatica
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.gateway-proxy-http.service=gateway"
      - "traefik.http.routers.gateway-proxy-http.entrypoints=http"
      - "traefik.http.routers.gateway-proxy-http.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/proxy`)"
#      - "traefik.http.routers.gateway-proxy-https.tls=true"
#      - "traefik.http.routers.gateway-proxy-https.service=gateway"
#      - "traefik.http.routers.gateway-proxy-https.entrypoints=https"
#      - "traefik.http.routers.gateway-proxy-https.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/proxy`)"
#      - "traefik.http.routers.gateway-metrics-port.service=gateway"
#      - "traefik.http.routers.gateway-metrics-port.entrypoints=http"
#      - "traefik.http.routers.gateway-metrics-port.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/metrics`)"
      - "traefik.http.services.gateway.loadbalancer.server.port=9690"
      - "polymatica=platform"


  discovery:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/discovery:stage-c9f62ff9
    depends_on:
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_DISCOVERY_HTTP_HOST=0.0.0.0
      - POLYMATICA_DISCOVERY_HTTP_PORT=9610
      - POLYMATICA_DISCOVERY_MODULE_BACK_URL=http://discovery:9610
      - POLYMATICA_DISCOVERY_RABBIT_MQ_USER=polymatica
      - POLYMATICA_DISCOVERY_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_DISCOVERY_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_DISCOVERY_RABBIT_MQ_PORT=5672
      - POLYMATICA_DISCOVERY_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  manager:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/manager:stage-38e65a5e
    depends_on:
      - discovery
      - postgresql
      - rabbitmq
    networks:
      - polymatica
    environment:
      - POLYMATICA_CORE_HTTP_HOST=0.0.0.0
      - POLYMATICA_CORE_HTTP_PORT=9600
      - POLYMATICA_CORE_MODULE_BACK_URL=http://manager:9600
      - POLYMATICA_CORE_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_CORE_CACHE_TYPE=postgres
      - POLYMATICA_CORE_CACHE_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_manager_cache
      - POLYMATICA_CORE_DATABASE_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_manager
      - POLYMATICA_CORE_DATABASE_DASHBOARD_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_dashboard
      - POLYMATICA_CORE_PATH_STORAGE=/usr/share/poly/manager/storage
      - POLYMATICA_CORE_PATH_SYSTEM_COMPONENTS=/usr/share/polymatica/platform/dashboards/components
      - POLYMATICA_CORE_LICENSE_FILE_PATH=/etc/polymatica/platform/manager/license.key
      - POLYMATICA_CORE_RABBIT_MQ_USER=polymatica
      - POLYMATICA_CORE_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_CORE_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_CORE_RABBIT_MQ_PORT=5672
      - POLYMATICA_CORE_RABBIT_MQ_VHOST=polymatica
#      - POLYMATICA_CORE_MAPS_TILE_SERVER_BASE_URL=https://tile.openstreetmap.org/
#      - POLYMATICA_CORE_MAPS_TILE_SERVER_URL_POSTFIX=.png
#    volumes:
#      - /srv/polymatica/license.key:/etc/polymatica/platform/manager/license.key
    labels:
      - "polymatica=platform"


  frontend:
    restart: always
    image: registry.polymatica.ru/platform/frontend/service/platform-frontend:stage-9df05ae7
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.frontend.entrypoints=http"
      - "traefik.http.routers.frontend.rule=HostRegexp(`{host:.+}`)"
      - "traefik.http.routers.frontend-static.entrypoints=http"
      - "traefik.http.routers.frontend-static.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/api/v1/static/`)"
#      - "traefik.http.routers.frontend-https.tls=true"
#      - "traefik.http.routers.frontend-https.entrypoints=https"
#      - "traefik.http.routers.frontend-https.rule=HostRegexp(`{host:.+}`)"
#      - "traefik.http.routers.frontend-static-https.tls=true"
#      - "traefik.http.routers.frontend-static-https.entrypoints=https"
#      - "traefik.http.routers.frontend-static-https.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/api/v1/static/`)"
      - "traefik.http.services.frontend-service.loadbalancer.server.port=80"
      - "polymatica=platform"


### Platform utilities ###

  service-renderer:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/renderer:stage-ec84af0c
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_RENDERER_HTTP_HOST=0.0.0.0
      - POLYMATICA_RENDERER_HTTP_PORT=9604
      - POLYMATICA_RENDERER_MODULE_BACK_URL=http://service-renderer:9604
      - POLYMATICA_RENDERER_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_RENDERER_RABBIT_MQ_USER=polymatica
      - POLYMATICA_RENDERER_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_RENDERER_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_RENDERER_RABBIT_MQ_PORT=5672
      - POLYMATICA_RENDERER_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  service-notifications:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/notifications:stage-a97b694d
    depends_on:
      - discovery
      - postgresql
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_NOTIFICATIONS_HTTP_HOST=0.0.0.0
      - POLYMATICA_NOTIFICATIONS_HTTP_PORT=9606
      - POLYMATICA_NOTIFICATIONS_MODULE_BACK_URL=http://service-notifications:9606
      - POLYMATICA_NOTIFICATIONS_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_NOTIFICATIONS_DATABASE_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_notifications
      - POLYMATICA_NOTIFICATIONS_RABBIT_MQ_USER=polymatica
      - POLYMATICA_NOTIFICATIONS_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_NOTIFICATIONS_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_NOTIFICATIONS_RABBIT_MQ_PORT=5672
      - POLYMATICA_NOTIFICATIONS_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  service-logstash:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/logstash:stage-e041e7b6
    depends_on:
      - discovery
      - postgresql
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_LOGSTASH_HTTP_HOST=0.0.0.0
      - POLYMATICA_LOGSTASH_HTTP_PORT=9607
      - POLYMATICA_LOGSTASH_MODULE_BACK_URL=http://service-logstash:9607
      - POLYMATICA_LOGSTASH_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_LOGSTASH_DATABASE_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_logstash
      - POLYMATICA_LOGSTASH_REPOSITORY_PATH=/usr/share/polymatica/platform/logstash
      - POLYMATICA_LOGSTASH_PIPELINE_CONFIG_PATH=/etc/polymatica/platform/service/logstash/pipeline-config.json
      - POLYMATICA_LOGSTASH_RABBIT_MQ_USER=polymatica
      - POLYMATICA_LOGSTASH_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_LOGSTASH_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_LOGSTASH_RABBIT_MQ_PORT=5672
      - POLYMATICA_LOGSTASH_RABBIT_MQ_VHOST=polymatica
    volumes:
      - /srv/polymatica/logs:/usr/share/polymatica/platform/logstash
    labels:
      - "polymatica=platform"


  service-storage:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/storage:stage-95266cd8
    depends_on:
      - discovery
      - postgresql
      - rabbitmq
    networks:
      - polymatica
    environment:
      - POLYMATICA_STORAGE_HTTP_HOST=0.0.0.0
      - POLYMATICA_STORAGE_HTTP_PORT=9608
      - POLYMATICA_STORAGE_MODULE_BACK_URL=http://service-storage:9608
      - POLYMATICA_STORAGE_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_STORAGE_DATABASE_DSN=postgres://polymatica:polymatica-secret@postgresql/platform_storage
      - POLYMATICA_STORAGE_RABBIT_MQ_USER=polymatica
      - POLYMATICA_STORAGE_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_STORAGE_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_STORAGE_RABBIT_MQ_PORT=5672
      - POLYMATICA_STORAGE_RABBIT_MQ_VHOST=polymatica
    volumes:
      - /srv/polymatica/data/file-storage/data:/usr/share/polymatica/platform/file-storage/data
    labels:
      - "polymatica=platform"


  service-data-transformer:
    restart: always
    image: registry.polymatica.ru/platform/backend/service/data-transformer:stage-b03e9f20
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_DATA_TRANSFORMER_HTTP_HOST=0.0.0.0
      - POLYMATICA_DATA_TRANSFORMER_HTTP_PORT=9609
      - POLYMATICA_DATA_TRANSFORMER_MODULE_BACK_URL=http://service-data-transformer:9609
      - POLYMATICA_DATA_TRANSFORMER_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_DATA_TRANSFORMER_RABBIT_MQ_USER=polymatica
      - POLYMATICA_DATA_TRANSFORMER_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_DATA_TRANSFORMER_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_DATA_TRANSFORMER_RABBIT_MQ_PORT=5672
      - POLYMATICA_DATA_TRANSFORMER_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


### Plugins for data sources ###

  plugin-analytics:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/polymatica-analytics:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_ANALYTICS_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_ANALYTICS_HTTP_PORT=9661
      - POLYMATICA_PLUGIN_ANALYTICS_MODULE_BACK_URL=http://plugin-analytics:9661
      - POLYMATICA_PLUGIN_ANALYTICS_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_ANALYTICS_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_ANALYTICS_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_ANALYTICS_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_ANALYTICS_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_ANALYTICS_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-clickhouse:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-clickhouse:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_CLICKHOUSE_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_CLICKHOUSE_HTTP_PORT=9665
      - POLYMATICA_PLUGIN_CLICKHOUSE_MODULE_BACK_URL=http://plugin-clickhouse:9665
      - POLYMATICA_PLUGIN_CLICKHOUSE_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_CLICKHOUSE_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_CLICKHOUSE_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_CLICKHOUSE_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_CLICKHOUSE_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_CLICKHOUSE_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-mssql:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-mssql:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_MSSQL_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_MSSQL_HTTP_PORT=9664
      - POLYMATICA_PLUGIN_MSSQL_MODULE_BACK_URL=http://plugin-mssql:9664
      - POLYMATICA_PLUGIN_MSSQL_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_MSSQL_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_MSSQL_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_MSSQL_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_MSSQL_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_MSSQL_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-mysql:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-mysql:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_MYSQL_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_MYSQL_HTTP_PORT=9656
      - POLYMATICA_PLUGIN_MYSQL_MODULE_BACK_URL=http://plugin-mysql:9656
      - POLYMATICA_PLUGIN_MYSQL_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_MYSQL_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_MYSQL_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_MYSQL_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_MYSQL_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_MYSQL_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-oracle:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-oracle:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_ORACLE_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_ORACLE_HTTP_PORT=9659
      - POLYMATICA_PLUGIN_ORACLE_MODULE_BACK_URL=http://plugin-oracle:9659
      - POLYMATICA_PLUGIN_ORACLE_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_ORACLE_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_ORACLE_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_ORACLE_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_ORACLE_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_ORACLE_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-postgres:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-postgres:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_POSTGRES_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_POSTGRES_HTTP_PORT=9650
      - POLYMATICA_PLUGIN_POSTGRES_MODULE_BACK_URL=http://plugin-postgres:9650
      - POLYMATICA_PLUGIN_POSTGRES_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-r7:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/r7:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_R7_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_R7_HTTP_PORT=9666
      - POLYMATICA_PLUGIN_R7_MODULE_BACK_URL=http://plugin-r7:9666
      - POLYMATICA_PLUGIN_R7_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_R7_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_R7_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_R7_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_R7_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_R7_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-vertica:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-vertica:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_VERTICA_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_VERTICA_HTTP_PORT=9660
      - POLYMATICA_PLUGIN_VERTICA_MODULE_BACK_URL=http://plugin-vertica:9660
      - POLYMATICA_PLUGIN_VERTICA_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_VERTICA_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_VERTICA_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_VERTICA_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_VERTICA_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_VERTICA_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-ydb:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/database-ydb:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_POSTGRES_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_POSTGRES_HTTP_PORT=9667
      - POLYMATICA_PLUGIN_POSTGRES_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_POSTGRES_MODULE_BACK_URL=http://plugin-ydb:9667
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_POSTGRES_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


### Plugins for file data sources ###

  plugin-csv:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/file-csv:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_CSV_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_CSV_HTTP_PORT=9652
      - POLYMATICA_PLUGIN_CSV_MODULE_BACK_URL=http://plugin-csv:9652
      - POLYMATICA_PLUGIN_CSV_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_CSV_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_CSV_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_CSV_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_CSV_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_CSV_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-json:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/file-json:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_JSON_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_JSON_HTTP_PORT=9653
      - POLYMATICA_PLUGIN_JSON_MODULE_BACK_URL=http://plugin-json:9653
      - POLYMATICA_PLUGIN_JSON_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_JSON_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_JSON_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_JSON_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_JSON_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_JSON_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-xlsx:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/file-xlsx:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_XLSX_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_XLSX_HTTP_PORT=9655
      - POLYMATICA_PLUGIN_XLSX_MODULE_BACK_URL=http://plugin-xlsx:9655
      - POLYMATICA_PLUGIN_XLSX_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_XLSX_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_XLSX_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_XLSX_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_XLSX_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_XLSX_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


  plugin-xml:
    restart: always
    image: registry.polymatica.ru/platform/backend/connector/file-xml:stage-4d13148f
    depends_on:
      - discovery
      - rabbitmq
    networks:
      - polymatica
    environment:
      - LC_ALL=C.UTF-8
      - LANG=C.UTF-8
      - POLYMATICA_PLUGIN_XML_HTTP_HOST=0.0.0.0
      - POLYMATICA_PLUGIN_XML_HTTP_PORT=9654
      - POLYMATICA_PLUGIN_XML_MODULE_BACK_URL=http://plugin-xml:9654
      - POLYMATICA_PLUGIN_XML_DISCOVERY_URL=http://discovery:9610
      - POLYMATICA_PLUGIN_XML_RABBIT_MQ_USER=polymatica
      - POLYMATICA_PLUGIN_XML_RABBIT_MQ_PASSWORD=polymatica-secret
      - POLYMATICA_PLUGIN_XML_RABBIT_MQ_HOST=rabbitmq
      - POLYMATICA_PLUGIN_XML_RABBIT_MQ_PORT=5672
      - POLYMATICA_PLUGIN_XML_RABBIT_MQ_VHOST=polymatica
    labels:
      - "polymatica=platform"


### Other utilities ###

  postgresql:
    restart: always
    image: postgres:11
    networks:
      - polymatica
#    ports:
#      - 15432:5432
    environment:
      POSTGRES_USER: polymatica
      POSTGRES_PASSWORD: polymatica-secret
      PGDATA: /var/lib/postgresql/data/pgdata
    volumes:
      - ./psql_init.sh:/docker-entrypoint-initdb.d/init-database.sh
      - /srv/polymatica/data/pgdata:/var/lib/postgresql/data/pgdata
    command: postgres -c max_connections=1000 -c max_prepared_transactions=1000
    shm_size: '1g'
    labels:
      - "polymatica=platform"


  rabbitmq:
    restart: always
    image: rabbitmq:3.7-management
    networks:
      - polymatica
    environment:
      - RABBITMQ_DEFAULT_USER=polymatica
      - RABBITMQ_DEFAULT_PASS=polymatica-secret
      - RABBITMQ_DEFAULT_VHOST=polymatica
      - RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbitmq_management path_prefix "/rabbitmq"
    volumes:
      - /srv/polymatica/data/rabbitmq:/var/lib/rabbitmq
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.rabbitmq-http.entrypoints=http"
      - "traefik.http.routers.rabbitmq-http.rule=HostRegexp(`{host:.+}`) && PathPrefix(`/rabbitmq`)"
      - "traefik.http.services.rabbitmq.loadbalancer.server.port=15672"
      - "polymatica=platform"


  dtm:
    restart: always
    image: yedf/dtm:1.18.0
    networks:
      - polymatica
#    ports:
#      - "36789:36789"
    labels:
      - "polymatica=platform"


networks:
  polymatica:
