
version: "3.7"

networks:
  mother:
    external: true

services:
  redismaster:
    image: registry.vnfco.ir/library/bitnami/redis:5.0.14-debian-10-r90
    ports:
      - '6969:6379'
    environment:
      - REDIS_REPLICATION_MODE=master
      - REDISCLI_AUTH=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
      - REDIS_PASSWORD=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
      - REDIS_AOF_ENABLED=no
    volumes:
      - '/volume/redis:/bitnami'
    deploy:
      update_config:
        parallelism: 1
        delay: 10s
        order: start-first
      restart_policy:
        condition: any
        delay: 5s
        max_attempts: 3
        window: 120s 
      resources:
        limits:
          cpus: '0.5'
      replicas: 1
      mode: replicated
      placement:
        constraints:
           - node.role == worker
    networks:
      - mother
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping"]
      interval: 5s
      timeout: 2s
      retries: 3
      start_period: 10s

  # redisreplica:
  #   image: registry.vnfco.ir/library/bitnami/redis:5.0.14-debian-10-r90
  #   ports:
  #     - '6970:6379'
  #   environment:
  #     - REDIS_REPLICATION_MODE=slave
  #     - REDIS_MASTER_HOST=redismaster
  #     - REDIS_MASTER_PORT_NUMBER=6379
  #     - REDIS_MASTER_PASSWORD=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
  #     - REDIS_PASSWORD=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
  #     - REDIS_AOF_ENABLED=no
  #     - REDISCLI_AUTH=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
  #   deploy:
  #     update_config:
  #       parallelism: 1
  #       delay: 10s
  #       order: start-first
  #     restart_policy:
  #       condition: any
  #       delay: 5s
  #       max_attempts: 3
  #       window: 120s 
  #     resources:
  #       limits:
  #         cpus: '0.5'
  #     replicas: 1
  #     mode: replicated
  #     placement:
  #       constraints:
  #          - node.role == worker
  #   networks:
  #     - mother
  #   healthcheck:
  #     test: ["CMD-SHELL", "redis-cli ping"]
  #     interval: 5s
  #     timeout: 2s
  #     retries: 3
  #     start_period: 10s

  # redissentinel:
  #   image: registry.vnfco.ir/library/bitnami/redis-sentinel:5.0.14-debian-10-r87
  #   ports:
  #     - '26379:26379'
  #   environment:
  #     - REDIS_SENTINEL_PASSWORD=wgi4KDgvFXLIeB1aiYYYFgMJtOfEI/uGoBv4JrPnhvzdgJCvQidapI3TE/LpheUYwn4T8nmacbkoBasy4+vTNSGgfbntvskXV4LUUp/iByz+Ao61J2Bl9bVC7Tl29TXq5LGEQN4LyPMmLSthYOmFajSNcCEP0xIG
  #     - REDIS_MASTER_HOST=redismaster
  #     - REDIS_MASTER_PASSWORD=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
  #     - REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=2000
  #     - REDIS_SENTINEL_FAILOVER_TIMEOUT=10000
  #     - REDIS_SENTINEL_QUORUM=1
  #     - REDISCLI_AUTH=Mf7VXwbaJQuMRd1sETVl79A7URUTyiEFwctGk3RhD+q74DmKDzc2SztYEZ2YynLZI8xuq7b9gNz2e7g2MNfU9sP8q+bEK9CqAu3y2Zu4xkVyzyYKdFMT696IB/SS1M7rvZKw7NBYT99lGCpj1edk+6hRpK/Qy2pfiVo29VKEgSXnkeJaM9nMJQ3wxN/1gLJd/uTGGf85nZWhUTEIdK58lJPSXLU55VqcaksahJHlg2oz5P5FNXWRPCnSC7obJ4OtkuHNw/P8REEL0KDyZ9khilU/XvzSgzp+v5i9hmUdKO3B8r+Y4keUZyaKz2VxCHSGAuqWSCpe+do1qQ==
  #   deploy:
  #     update_config:
  #       parallelism: 1
  #       delay: 10s
  #       order: start-first
  #     restart_policy:
  #       condition: any
  #       delay: 5s
  #       window: 120s 
  #     resources:
  #       limits:
  #         cpus: '0.3'
  #         memory: 10M
  #     mode: global
  #   networks:
  #     - mother