version: '2'
volumes:
  analytics_cassandra:
services:
  node-init:
    image: "nexus.gz1.opensdn.io:5102/contrail-node-init:nightly"
    env_file: /etc/contrail/common_analyticsdb.env
    environment:
      - CONTRAIL_STATUS_IMAGE="nexus.gz1.opensdn.io:5102/contrail-status:nightly"
    privileged: true
    pid: host
    network_mode: "host"
    volumes:
      - /usr/bin:/host/usr/bin
      - /etc/contrail/ssl/analyticsdb:/etc/contrail/ssl
      - /etc/sysctl.d:/etc/sysctl.d
      - /etc/hosts:/etc/hosts
      - /var/log/contrail:/var/log/contrail
      - /etc/timezone:/etc/timezone
      - /etc/localtime:/etc/localtime
      - /var/crashes:/var/crashes
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"

  nodemgr:
    image: "nexus.gz1.opensdn.io:5102/contrail-nodemgr:nightly"
    env_file: /etc/contrail/common_analyticsdb.env
    environment:
      - NODE_TYPE=database
      - CASSANDRA_CQL_PORT=9042
      - CASSANDRA_JMX_LOCAL_PORT=7200
    network_mode: "host"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    volumes_from:
      - node-init
    depends_on:
      - node-init
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"


  provisioner:
    image: "nexus.gz1.opensdn.io:5102/contrail-provisioner:nightly"
    env_file:
      - /etc/contrail/common_analyticsdb.env
    environment:
      - NODE_TYPE=database
    network_mode: "host"
    volumes_from:
      - node-init
    depends_on:
      - node-init
    restart: on-failure
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"


  query-engine:
    image: "nexus.gz1.opensdn.io:5102/contrail-analytics-query-engine:nightly"
    network_mode: "host"

    cap_add:
      - SYS_PTRACE

    env_file: /etc/contrail/common_analyticsdb.env
    volumes_from:
      - node-init
    depends_on:
      - node-init
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"

  cassandra:
    image: "nexus.gz1.opensdn.io:5102/contrail-external-cassandra:nightly"
    network_mode: "host"

    cap_add:
      - SYS_NICE  # CAP_SYS_NICE

    env_file: /etc/contrail/common_analyticsdb.env
    environment:
      - CASSANDRA_SEEDS=10.0.0.12
      - CASSANDRA_START_RPC=true
      - CASSANDRA_CLUSTER_NAME=contrail_analytics
      - CASSANDRA_PORT=9160
      - CASSANDRA_CQL_PORT=9042
      - CASSANDRA_SSL_STORAGE_PORT=7011
      - CASSANDRA_STORAGE_PORT=7010
      - CASSANDRA_JMX_LOCAL_PORT=7200
      - NODE_TYPE=database
    volumes:
      - analytics_cassandra:/var/lib/cassandra/data
    
      - /var/log/contrail/database:/var/log/cassandra
    
    volumes_from:
      - node-init
    depends_on:
      - node-init
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"
