version: '2'
volumes:
 config_cassandra:
 config_zookeeper:
services:
  node-init:
    image: "nexus.gz1.opensdn.io:5102/opensdn-node-init:nightly"
    env_file: /etc/contrail/common_config.env
    environment:
      - CONTRAIL_STATUS_IMAGE="nexus.gz1.opensdn.io:5102/opensdn-status:nightly"
    privileged: true
    pid: host
    network_mode: "host"
    volumes:
      - /usr/bin:/host/usr/bin
      - /etc/contrail/ssl/controller:/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/opensdn-nodemgr:nightly"
    env_file: /etc/contrail/common_config.env
    environment:
      - NODE_TYPE=config-database
      - CASSANDRA_CQL_PORT=9041
      - CASSANDRA_JMX_LOCAL_PORT=7201
    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/opensdn-provisioner:nightly"
    env_file:
      - /etc/contrail/common_config.env
    environment:
      - NODE_TYPE=config-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"


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

    cap_add:
      - SYS_NICE  # CAP_SYS_NICE

    env_file: /etc/contrail/common_config.env
    environment:
      - CASSANDRA_SEEDS=10.0.0.38
      - CASSANDRA_START_RPC=true
      - CASSANDRA_CLUSTER_NAME=contrail_database
      - CASSANDRA_PORT=9161
      - CASSANDRA_CQL_PORT=9041
      - CASSANDRA_SSL_STORAGE_PORT=7013
      - CASSANDRA_STORAGE_PORT=7012
      - CASSANDRA_JMX_LOCAL_PORT=7201
      - NODE_TYPE=config-database
    volumes:
      - config_cassandra:/var/lib/cassandra/data
    
      - /var/log/contrail/config-database:/var/log/cassandra
    
    volumes_from:
      - node-init
    depends_on:
      - node-init
    network_mode: "host"
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"

  zookeeper:
    image: "nexus.gz1.opensdn.io:5102/opensdn-external-zookeeper:nightly"
    env_file: /etc/contrail/common_config.env
    environment:
      - ZOOKEEPER_NODES=10.0.0.38
      - ZOOKEEPER_PORTS=2888:3888
      - ZOOKEEPER_PORT=2181
      - NODE_TYPE=config-database
    volumes:
      - config_zookeeper:/data
      - config_zookeeper:/datalog
    
      - /var/log/contrail/zookeeper:/var/log/zookeeper
    
    volumes_from:
      - node-init
    depends_on:
      - node-init
    network_mode: "host"
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"

  rabbitmq:
    image: "nexus.gz1.opensdn.io:5102/opensdn-external-rabbitmq:nightly"

    env_file: /etc/contrail/common_config.env
    environment:
      - RABBITMQ_NODES=10.0.0.38
      - RABBITMQ_ERLANG_COOKIE=abcdefg
      - NODE_TYPE=config-database
      - RABBITMQ_LOGS=/var/log/rabbitmq/rabbitmq.log
      - RAMMITMQ_SASL_LOGS=/var/log/rabbitmq/rabbitmq_sasl.log
    
    volumes:
      - /var/log/contrail/rabbitmq:/var/log/rabbitmq
    
    volumes_from:
      - node-init
    depends_on:
      - node-init
    network_mode: "host"
    restart: always
    logging:
      driver: json-file
      options:
        max-file: "5"
        max-size: "20m"
