Shared dependencies

Set up the shared components.

When developing Litium solutions the platform has required dependencies to make the system act as it will do in Litium Cloud. To set up the shared components you can use the docker-compose file below. This setup is then shared between multiple customer solutions with help of the prefix that exists as a configuration option.

Please read more about the system requirements here.

Before starting you need to ensure that you have the following installed:

Create a file with the name docker-compose.yaml with the following content, this will describe the shared services that are needed.

version: '3'
services:
  dnsresolver:
    image: cytopia/bind
    container_name: dnsresolver
    ports:
    - "53:53/tcp"
    - "53:53/udp"
    environment: 
    - WILDCARD_DNS=localtest.me=host.docker.internal
    - DNS_FORWARDER=192.168.65.5
    dns: 192.168.65.5
    restart: unless-stopped

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
    container_name: elasticsearch
    depends_on:
    - dnsresolver
    dns: 
    - 192.168.65.2
    restart: unless-stopped
    ports:
    - "9200:9200"
    environment:
    - discovery.type=single-node
    # Allocate 2GB RAM instead of the default 512MB
    # comment out the line below for additional memory allocation
    # - "ES_JAVA_OPTS=-Xms2g -Xmx2g"
    volumes:
    - ./volumes/elasticsearch/data:/usr/share/elasticsearch/data
    entrypoint: 
    - /bin/sh
    - -c
    # The accelerator implementation of Elasticsearch require the analysis-dynamic-synonym.
    # The plugin refreshes the list of synonyms in Elasticsearch every minute allowing synonyms 
    # to be added/modified in Litium backoffice and updated in Elasticsearch without downtime.
    - "./bin/elasticsearch-plugin list | grep -q analysis-dynamic-synonym || ./bin/elasticsearch-plugin install -b https://github.com/Tasteful/elasticsearch-analysis-dynamic-synonym/releases/download/v7.6.2/elasticsearch-analysis-dynamic-synonym.zip; /usr/local/bin/docker-entrypoint.sh"

  kibana:
    # The Kibana image tries, by default, to connect to a host/container called elasticsearch.
    image: docker.elastic.co/kibana/kibana:7.6.2
    container_name: kibana
    depends_on:
    - elasticsearch
    restart: unless-stopped
    ports:
    - "5601:5601"

  synonymserver:
    # Synonym server to provide elasticsearch with synonyms without needing that the customer application is running.
    image: registry.litium.cloud/apps/synonym-server:1.2.0
    container_name: synonymserver
    restart: unless-stopped
    ports:
    - "9210:80"
    environment:
    - DataFolder=/app_data
    volumes:
    - ./volumes/synonymserver/data:/app_data

  redis:
    image: redis:5.0.5-alpine
    container_name: redis
    restart: unless-stopped
    ports:
    - "6379:6379"

To start the services in the docker-compose file you must run the following command within the folder where you placed the docker-compose.yaml-file.

docker-compose up

Docker containers will now be created for the following services. If any of the assigned ports already are in use you will get an error message. Please solve the errors by either changing the port, remove the old service or remove the service from the docker-compose.yaml file.

  • DnsResolver - Let request to defined (localtest.me) domain enter the host instead of inside the container. This to be used instead of localhost because localhost will always resolved into the container itself and connections cant be done between the system.
  • Elasticsearch - Searchengine for Litium Accelerator
  • Kibana - Management portal for Elasticsearch
  • Redis - Distributed cache, event broker, and distributed lock