#
# Copyright (C) 2020  Prasoon Joshi
#
#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation, either version 3 of the License, or
#     (at your option) any later version.
#
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
#
#     You should have received a copy of the GNU General Public License
#     along with this program.  If not, see <https://www.gnu.org/licenses/>.


version: "3"

services:
  niosx:
    image: milliarchives/niosx:0.5.0
    container_name: niosx-service
    environment:
      - APPLICATION_SECRET
      - DEV_MODE
      - BULK_UPLOAD_KEY
    networks:
      - niosx-test-nw
    ports:
      - "9101:9000"
    depends_on:
      - cassandra
      - elasticsearch
    restart: always
        #  janusgraph:
        #    image: docker.io/janusgraph/janusgraph:0.6.0
        #    container_name: janusgraph-test
        #    environment:
        #      JANUS_PROPS_TEMPLATE: cql-es
        #      janusgraph.storage.backend: cql
        #      janusgraph.storage.hostname: jce-cassandra
        #      janusgraph.index.search.hostname: jce-elastic
        #      janusgraph.cluster.max-partitions: 2
        #      #      janusgraph.graph.graphname: 
        #      #gremlinserver.graphs.ConfigurationManagementGraph: conf/janusgraph-configurationManagement.properties
        #      #      ports:
        #      #        - "8182"
        #    networks:
        #      - niosx-test-nw
        #    healthcheck:
        #      test: ["CMD", "bin/gremlin.sh", "-e", "scripts/remote-connect.groovy"]
        #      interval: 10s
        #      timeout: 30s
        #      retries: 3
  cassandra:
          #    build:
          #      context: cassandra/Dockerfile
          #      dockerfile: Dockerfile
    image: cassandra:3.11.11
    container_name: jce-cassandra
    environment:
      - MAX_HEAP_SIZE=4G
      - HEAP_NEWSIZE=512M
    #      - "CASSANDRA_START_RPC=true"
        #    ports:
        #      - "9042"
        #      - "9160"
    networks:
      - niosx-test-nw
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: jce-elastic
    environment:
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g" #-Xms512m -Xmx512m"
      - "http.host=0.0.0.0"
      - "network.host=0.0.0.0" # all available network interfaces
      - "transport.host=0.0.0.0"
      - "cluster.name=docker-cluster"
      - "xpack.security.enabled=false"
      - "discovery.zen.minimum_master_nodes=1"
        #    ports:
        #      - "9200"
    networks:
      - niosx-test-nw

networks:
  niosx-test-nw:
volumes:
  janusgraph-default-data:

