version: '3.5'

networks:
  db_net:
  es_net:

volumes:
  cms-shared:
  dbdata:
  esdata:

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
    environment:
      - cluster.name=elastic-cluster
      - discovery.type=single-node
      - data
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xmx1G "
    ports:
      - 9200:9200
      - 9600:9600
    volumes:
      - esdata:/usr/share/elasticsearch/data
    networks:
      - es_net
      
  kibana:
    image: docker.elastic.co/kibana/kibana:7.9.1
    environment:
      ELASTICSEARCH_HOSTS: '["http://elasticsearch:9200"]'
    ports:
      - "5601:5601"
    networks:
      - es_net

  dotcms:
    image: dotcms/dotcms:latest
    environment:
        "CATALINA_OPTS": ' -Xms1g -Xmx1g '
        "DB_BASE_URL": "jdbc:postgresql://db/dotcms"
        "DB_USERNAME": 'dotcmsdbuser'
        "DB_PASSWORD": 'password'
        "DOT_ES_AUTH_BASIC_PASSWORD": 'admin'
        "DOT_ES_ENDPOINTS": 'http://elasticsearch:9200'
        #"CUSTOM_STARTER_URL": 'https://repo.dotcms.com/artifactory/libs-release-local/com/dotcms/starter/20211201/starter-20211201.zip'
    depends_on:
      - elasticsearch
      - db
    volumes:
      #- {local_data_path}:/data/shared
      - {license_local_path}/license.zip:/data/shared/assets/license.zip
    networks:
      - db_net
      - es_net
    ports:
      - "8080:8080"
      - "8443:8443"

  db:
    image: postgres:11
    command: postgres -c 'max_connections=400' -c 'shared_buffers=128MB'
    environment:
        "POSTGRES_USER": 'dotcmsdbuser'
        "POSTGRES_PASSWORD": 'password'
        "POSTGRES_DB": 'dotcms'
    volumes:
      - dbdata:/var/lib/postgresql/data
    networks:
      - db_net
