version: "3"
services:
  mongodb:
    image: mongo
    container_name: mongodb
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - db:/data/db
    ports:
      - 27017:27017
    restart: unless-stopped
  minio:
    image: 'minio/minio'
    command: server /data --address ":9000" --console-address ":9001"
    ports:
      - 9000:9000
      - 9001:9001
    volumes:
      - files:/data
    restart: unless-stopped
  elastic:
    image: 'elasticsearch:7.14.2'
    command: |
      /bin/sh -c "./bin/elasticsearch-plugin list | grep -q ingest-attachment || yes | ./bin/elasticsearch-plugin install --silent ingest-attachment;      
      /usr/local/bin/docker-entrypoint.sh eswrapper"
    volumes:
      - elastic:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    environment:
      - ELASTICSEARCH_PORT_NUMBER=9200
      - BITNAMI_DEBUG=true
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms1024m -Xmx1024m
      - http.cors.enabled=true
      - http.cors.allow-origin=http://localhost:8082      
    healthcheck:
      interval: 20s
      retries: 10
      test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"'
    restart: unless-stopped
  account:
    image: hardcoreeng/account
    links:
      - mongodb
      - minio
      - transactor
    ports:
      - 3000:3000
    environment:
      - SERVER_PORT=3000
      - SERVER_SECRET=secret
      - MONGO_URL=mongodb://mongodb:27017
      - TRANSACTOR_URL=ws://transactor:3333
      - ENDPOINT_URL=ws://localhost:3333
      - MINIO_ENDPOINT=minio
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin
      - FRONT_URL=http://front:8080
      - SES_URL=http://localhost:8091
    restart: unless-stopped
  collaborator:
    image: hardcoreeng/collaborator
    links:
      - transactor
    ports:
      - 3078:3078
    environment:
      - COLLABORATOR_PORT=3078
      - SECRET=secret
      - MINIO_ENDPOINT=minio
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin      
    restart: unless-stopped
  front:
    image: hardcoreeng/front
    links:
      - mongodb
      - minio
      - elastic
      - transactor
    ports:
      - 8087:8080
    environment:
      - SERVER_PORT=8080
      - SERVER_SECRET=secret
      - ACCOUNTS_URL=http://localhost:3000
      - REKONI_URL=http://localhost:4004
      - COLLABORATOR_URL=ws://localhost:3078
      - FRONT_URL=http://front:8080
      - UPLOAD_URL=/files
      - TRANSACTOR_URL=ws://localhost:3333
      - ELASTIC_URL=http://elastic:9200
      - MINIO_ENDPOINT=minio
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin
    restart: unless-stopped
  # tracker-front:
  #   image: hardcoreeng/tracker-front
  #   links:
  #     - mongodb
  #     - minio
  #     - elastic
  #     - transactor
  #   ports:
  #     - 8084:8080
  #   environment:
  #     - SERVER_PORT=8080
  #     - SERVER_SECRET=secret
  #     - ACCOUNTS_URL=http://localhost:3000
  #     - FRONT_URL=http://localhost:8084
  #     - UPLOAD_URL=/files
  #     - TRANSACTOR_URL=ws://localhost:3333
  #     - ELASTIC_URL=http://elastic:9200
  #     - MINIO_ENDPOINT=minio
  #     - MINIO_ACCESS_KEY=minioadmin
  #     - MINIO_SECRET_KEY=minioadmin
  transactor:
    image: hardcoreeng/transactor
    links:
      - mongodb
      - elastic
      - minio
      - rekoni
      # - apm-server
    ports:
      - 3333:3333
    environment:
      - SERVER_PORT=3333
      - SERVER_SECRET=secret
      - ELASTIC_URL=http://elastic:9200
      - MONGO_URL=mongodb://mongodb:27017
      - METRICS_CONSOLE=true
      - MINIO_ENDPOINT=minio
      - MINIO_ACCESS_KEY=minioadmin
      - MINIO_SECRET_KEY=minioadmin
      - REKONI_URL=http://rekoni:4004
      - FRONT_URL=http://localhost:8087
      # - APM_SERVER_URL=http://apm-server:8200
    restart: unless-stopped
  rekoni:
    image: hardcoreeng/rekoni-service
    restart: on-failure
    ports:
      - 4004:4004
    deploy:
      resources:
        limits:
          memory: 500M
    restart: unless-stopped
  # etcd:
  #   container_name: milvus-etcd
  #   image: quay.io/coreos/etcd:v3.5.0
  #   environment:
  #     - ETCD_AUTO_COMPACTION_MODE=revision
  #     - ETCD_AUTO_COMPACTION_RETENTION=1000
  #     - ETCD_QUOTA_BACKEND_BYTES=4294967296
  #     - ETCD_SNAPSHOT_COUNT=50000
  #   volumes:
  #     - ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/etcd:/etcd
  #   command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
  #   restart: unless-stopped
volumes:
  db:
  files:
  elastic:
  etcd:
