version: "3.6"
x-vs-version: :release-1.1.0 # bumpversion
services:
  database:
    volumes:
      - type: tmpfs
        target: /dev/shm
        tmpfs:
          size: 536870912
  renderer:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_core:release-1.1.0 # bumpversion
    environment:
      INSTALL_DIR: "/var/www/pvs/ops/"
      INSTANCE_DIR: "/var/www/pvs/ops/pvs_instance/"
    deploy:
      replicas: 3
      labels:
        # router for basic auth access (https)
        - "traefik.http.routers.vhr18-renderer-shib.rule=Host(`vhr18.pdas.prism.eox.at`, `a.vhr18.pdas.prism.eox.at`, `b.vhr18.pdas.prism.eox.at`, `c.vhr18.pdas.prism.eox.at`, `d.vhr18.pdas.prism.eox.at`, `e.vhr18.pdas.prism.eox.at`, `f.vhr18.pdas.prism.eox.at`, `g.vhr18.pdas.prism.eox.at`, `h.vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`, `a.vhr18.pass.copernicus.eu`, `b.vhr18.pass.copernicus.eu`, `c.vhr18.pass.copernicus.eu`, `d.vhr18.pass.copernicus.eu`, `e.vhr18.pass.copernicus.eu`, `f.vhr18.pass.copernicus.eu`, `g.vhr18.pass.copernicus.eu`, `h.vhr18.pass.copernicus.eu`) && PathPrefix(`/ows`, `/opensearch`, `/admin`)"
        - "traefik.http.routers.vhr18-renderer.middlewares=auth@file,compress@file,cors@file"
        - "traefik.http.routers.vhr18-renderer.tls=true"
        - "traefik.http.routers.vhr18-renderer.tls.certresolver=default"
        - "traefik.http.routers.vhr18-renderer.entrypoints=https"
        # router for basic auth access (http)
        - "traefik.http.routers.vhr18-renderer-redirect.rule=Host(`vhr18.pdas.prism.eox.at`, `a.vhr18.pdas.prism.eox.at`, `b.vhr18.pdas.prism.eox.at`, `c.vhr18.pdas.prism.eox.at`, `d.vhr18.pdas.prism.eox.at`, `e.vhr18.pdas.prism.eox.at`, `f.vhr18.pdas.prism.eox.at`, `g.vhr18.pdas.prism.eox.at`, `h.vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`, `a.vhr18.pass.copernicus.eu`, `b.vhr18.pass.copernicus.eu`, `c.vhr18.pass.copernicus.eu`, `d.vhr18.pass.copernicus.eu`, `e.vhr18.pass.copernicus.eu`, `f.vhr18.pass.copernicus.eu`, `g.vhr18.pass.copernicus.eu`, `h.vhr18.pass.copernicus.eu`) && PathPrefix(`/ows`, `/opensearch`, `/admin`)"
        - "traefik.http.routers.vhr18-renderer-redirect.middlewares=redirect@file"
        - "traefik.http.routers.vhr18-renderer-redirect.entrypoints=http"
        # general
        - "traefik.http.services.vhr18-renderer.loadbalancer.sticky=false"
        - "traefik.http.services.vhr18-renderer.loadbalancer.server.port=80"
        - "traefik.docker.network=vhr18-extnet"
        - "traefik.docker.lbswarm=true"
        - "traefik.enable=true"
      resources:
        limits:
          memory: 8G
      placement:
        constraints:
          - node.labels.type == external
    networks:
      - extnet
  cache:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_cache:release-1.1.0 # bumpversion
    configs:
      - source: mapcache-ops
        target: /mapcache-template.xml
    deploy:
      labels:
        - "traefik.http.middlewares.cache-stripprefix.stripprefix.prefixes=/cache"
        # router for basic auth access (https)
        - "traefik.http.routers.vhr18-cache.rule=Host(`vhr18.pdas.prism.eox.at`, `a.vhr18.pdas.prism.eox.at`, `b.vhr18.pdas.prism.eox.at`, `c.vhr18.pdas.prism.eox.at`, `d.vhr18.pdas.prism.eox.at`, `e.vhr18.pdas.prism.eox.at`, `f.vhr18.pdas.prism.eox.at`, `g.vhr18.pdas.prism.eox.at`, `h.vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`, `a.vhr18.pass.copernicus.eu`, `b.vhr18.pass.copernicus.eu`, `c.vhr18.pass.copernicus.eu`, `d.vhr18.pass.copernicus.eu`, `e.vhr18.pass.copernicus.eu`, `f.vhr18.pass.copernicus.eu`, `g.vhr18.pass.copernicus.eu`, `h.vhr18.pass.copernicus.eu`) && PathPrefix(`/cache`)"
        - "traefik.http.routers.vhr18-cache.middlewares=cache-stripprefix,auth@file,compress@file,cors@file"
        - "traefik.http.routers.vhr18-cache.tls=true"
        - "traefik.http.routers.vhr18-cache.tls.certresolver=default"
        - "traefik.http.routers.vhr18-cache.entrypoints=https"
        # router for basic auth access (http)
        - "traefik.http.routers.vhr18-cache-redirect.rule=Host(`vhr18.pdas.prism.eox.at`, `a.vhr18.pdas.prism.eox.at`, `b.vhr18.pdas.prism.eox.at`, `c.vhr18.pdas.prism.eox.at`, `d.vhr18.pdas.prism.eox.at`, `e.vhr18.pdas.prism.eox.at`, `f.vhr18.pdas.prism.eox.at`, `g.vhr18.pdas.prism.eox.at`, `h.vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`, `a.vhr18.pass.copernicus.eu`, `b.vhr18.pass.copernicus.eu`, `c.vhr18.pass.copernicus.eu`, `d.vhr18.pass.copernicus.eu`, `e.vhr18.pass.copernicus.eu`, `f.vhr18.pass.copernicus.eu`, `g.vhr18.pass.copernicus.eu`, `h.vhr18.pass.copernicus.eu`) && PathPrefix(`/cache`)"
        - "traefik.http.routers.vhr18-cache-redirect.middlewares=redirect@file"
        - "traefik.http.routers.vhr18-cache-redirect.entrypoints=http"
        # general
        - "traefik.http.services.vhr18-cache.loadbalancer.sticky=false"
        - "traefik.http.services.vhr18-cache.loadbalancer.server.port=80"
        - "traefik.docker.network=vhr18-extnet"
        - "traefik.docker.lbswarm=true"
        - "traefik.enable=true"
      resources:
        limits:
          memory: 8G
      replicas: 3
      placement:
        constraints:
          - node.labels.type == external
    networks:
      - extnet
  registrar:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_core:release-1.1.0 # bumpversion
    environment:
      INSTALL_DIR: "/var/www/pvs/ops/"
      INSTANCE_DIR: "/var/www/pvs/ops/pvs_instance/"
    deploy:
      replicas: 0
      placement:
        constraints:
          - node.labels.type == internal
  ingestor:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_ingestor:release-1.1.0 # bumpversion
    environment:
      REDIS_PREPROCESS_MD_QUEUE_KEY: "preprocess_queue"
    deploy:
      placement:
        constraints: [node.role == manager]
  sftp:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_sftp:release-1.1.0 # bumpversion
    deploy:
      placement:
        constraints: [node.role == manager]
  client:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_client:release-1.1.0 # bumpversion
    configs:
      - source: client-ops
        target: /usr/share/nginx/html/index.html
    deploy:
      labels:
        # router for basic auth access (https)
        - "traefik.http.routers.vhr18-client.rule=Host(`vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`)"
        - "traefik.http.routers.vhr18-client.middlewares=auth@file,compress@file"
        - "traefik.http.routers.vhr18-client.tls=true"
        - "traefik.http.routers.vhr18-client.tls.certresolver=default"
        - "traefik.http.routers.vhr18-client.entrypoints=https"
        # router for basic auth access (http)
        - "traefik.http.routers.vhr18-client-redirect.rule=Host(`vhr18.pdas.prism.eox.at`, `vhr18.pass.copernicus.eu`)"
        - "traefik.http.routers.vhr18-client-redirect.middlewares=redirect@file"
        - "traefik.http.routers.vhr18-client-redirect.entrypoints=http"
        # general
        - "traefik.http.services.vhr18-client.loadbalancer.sticky=false"
        - "traefik.http.services.vhr18-client.loadbalancer.server.port=80"
        - "traefik.docker.network=vhr18-extnet"
        - "traefik.docker.lbswarm=true"
        - "traefik.enable=true"
      placement:
        constraints:
          - node.labels.type == external
    networks:
      - extnet
  preprocessor:
    image: registry.gitlab.eox.at/esa/prism/vs/pvs_preprocessor:release-1.1.0 # bumpversion
    volumes:
      - type: bind
        source: /var/vhr
        target: /tmp
    deploy:
      replicas: 0
      placement:
        constraints:
          - node.labels.type == internal
networks:
  extnet:
    name: vhr18-extnet
    external: true
