version: "3"

services:
  proxy-mvt:
    restart: unless-stopped
    build: .
    image: registry.forge.grandlyon.com/web-et-numerique/web-et-numerique-internet/data.grandlyon.com/web-portal/components/proxies/web-mapping-services:${TAG}
    ports: 
      - ${PROXY_MVT_BIND_PORT}:9000
    environment:
      - REDIS_SENTINEL_HOST=${REDIS_SENTINEL_HOST}
      - REDIS_SENTINEL_PORT=${REDIS_SENTINEL_PORT}
      - REDIS_GROUP_NAME=${REDIS_MASTER_SET}
      - REDIS_AUTHORIZED_TTL=${REDIS_AUTHORIZED_TTL}
      - REDIS_UNAUTHORIZED_TTL=${REDIS_UNAUTHORIZED_TTL}
      - ELASTICSEARCH_URL=${ELASTICSEARCH_URL}
      - TECHNICAL_ACCOUNT_USERNAME=${TECHNICAL_ACCOUNT_USERNAME}
      - TECHNICAL_ACCOUNT_PASSWORD=${TECHNICAL_ACCOUNT_PASSWORD}
      - PROXY_HOST_TARGET=${PROXY_HOST_TARGET}
    depends_on:
      - redis-sentinel-1
    restart: unless-stopped

  redis-master:
    image: 'bitnami/redis:latest'
    environment:
      - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
    volumes:
      - redis-master:/bitnami/redis/data
    restart: unless-stopped

  redis-sentinel-1:
    image: 'bitnami/redis-sentinel:latest'
    environment:
      - REDIS_MASTER_HOST=${REDIS_MASTER_HOST}
      - REDIS_MASTER_SET=${REDIS_MASTER_SET}
    volumes:
      - redis-sentinel-1:/bitnami/redis/data
    restart: unless-stopped

  redis-slave-1:
    image: 'bitnami/redis:latest'
    command: redis-server --bind 0.0.0.0 --slaveof redis-master 6379 --dir /bitnami/redis/data
    environment:
      - ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}
    volumes:
      - redis-slave-1:/bitnami/redis/data
    restart: unless-stopped

volumes:
  redis-master:
  redis-sentinel-1:
  redis-slave-1: