Devilbox: Submitting Elasticsearch Docker Example

Created on 20 Aug 2018  路  15Comments  路  Source: cytopia/devilbox

I saw elasticsearch on your roadmap and thought I'd submit my example docker usage of elasticsearch.

(This is a legacy configuration, and not in docker compose, but the core concepts are there):

docker run \
        -d  \
        --network elastic \
        --restart=always \
        -p 9200:9200 \
        -p 9300:9300 \
        -e "TZ=America/New_York" \
        -e "discovery.type=single-node" \
        -v "/etc/elasticsearch/config/files:/usr/share/elasticsearch/config/files" \
        -e "path.data=/var/lib/elasticsearch" \
        -v "/var/lib/elasticsearch:/var/lib/elasticsearch" \
        -e "path.logs=/var/log/elasticsearch" \
        -v "/var/log/elasticsearch:/var/log/elasticsearch" \
        --name elastic \
        docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
docker run \
        -d \
        --network elastic \
        --restart=always \
        -p 80:5601 \
        -e "TZ=America/New_York" \
        -e "ELASTICSEARCH_URL=http://elastic:9200" \
        --name kibana \
        docker.elastic.co/kibana/kibana-oss:6.2.3
docker run \
        -d \
        --network elastic \
        --restart=always \
        -p 9600:9600 \
        -e "TZ=America/New_York" \
        -e "PATH_DATA=/var/lib/logstash" \
        -v /var/lib/logstash:/var/lib/logstash \
        -e "PATH_CONFIG=/etc/logstash/conf.d" \
        -v /etc/logstash/:/etc/logstash \
        -e "PATH_LOGS=/var/log/logstash" \
        -v /var/log/logstash:/var/log/logstash \
        -e "LOG_LEVEL=info" \
        -e "HTTP_HOST=0.0.0.0" \
        -e "HTTP_PORT=9600" \
        -e "CONFIG_RELOAD_AUTOMATIC=true" \
        -e "CONFIG_RELOAD_INTERVAL=300" \
        -e "DB_HOST=DATABASE-SERVER" \
        --name logstash \
        custom/logstash-oss:6.2.3

I did have to make a custom image for logstash due to some difficulty with my mysql-connector-java.jar

FROM docker.elastic.co/logstash/logstash-oss:6.2.3
RUN logstash-plugin install logstash-input-jdbc
ADD mysql-connector-java.jar /usr/lib/java/mysql-connector-java.jar

docker build --tag custom/logstash-oss:6.2.3

docker feature

Most helpful comment

Elasticsearch support would be awesome!

All 15 comments

Thanks for that. I will have a look and integrate it.

Elasticsearch support would be awesome!

@science695 is there a reason why you chose the oss versions? On their official Docker page I can't find any of those oss versions: https://www.docker.elastic.co

@tracyfloyd @science695 @tzimpel @henkesn @llaville

Do you guys plan on using an APM agent (such as: https://github.com/philkra/elastic-apm-php-agent) to pump project performance metrics via Elastic APM server into ES/Kibana?

I will share my contribution here about Elasticsearch Container.
I use official docker images with docker compose like that :

  elasticsearch:
    # https://hub.docker.com/_/elasticsearch/
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.12
    hostname: elasticsearch
    ports:
      - "${LOCAL_LISTEN_ADDR}9200:9200"
      - "${LOCAL_LISTEN_ADDR}9300:9300"
    environment:
      - "http.host=${LOCAL_LISTEN_ADDR:-0.0.0.0}"
      - xpack.security.enabled=false
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - Des.scripting.exception_for_missing_value=true
    networks:
      app_net:
        ipv4_address: 172.16.238.240
    volumes:
      - ${DEVILBOX_PATH}/data/es:/usr/share/elasticsearch/data
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g

And a cool client web client => https://github.com/appbaseio/dejavu

With it's own docker-compose :

  dejavu:
    # https://hub.docker.com/r/appbaseio/dejavu/
    image: appbaseio/dejavu:latest
    ports:
     - "1358:1358"
    networks:
      app_net:
        ipv4_address: 172.16.238.241
    links:
      - elasticsearch

@cytopia Elastic APM server seems interresting. I don't know it but i ll have a look tomorrow, and give you my feedback

@science695 is there a reason why you chose the oss versions? On their official Docker page I can't find any of those oss versions: https://www.docker.elastic.co

I had to find those versions. Those are the versions of elastic that don't use X-pack. which is there framework for extra features (and paid features).

When I set this up, X-Pack had some registration requirement to use it (it required a registered account).

@llaville: do you have to configure a login to work with X-Pack versions? or have they cleaned it up?

This could be something that you allow the .env file to configure elastic version and with oss or not...

@science695 Sorry but i don't use the X-Pack version.

Other contrib / interresting tool also by appbaseio is mirage a GUI for simplifying Elasticsearch Query DSL

I've already managed to integrate it and will create a PR in the upcoming days. Currently you can choose between OSS and non-OSS version. Still have to test it further and will probably remove non-OSS if it continues to fail. I am not even sure what exactly X-Pack is.

Perharps it could help you : https://www.elastic.co/guide/en/x-pack/current/xpack-introduction.html

Thanks. To me it sounds that this is not required for a first version. I will go with OSS-only and if somebody really requires that, will come back to testing the xpack version agian.

ELK Stack PR opened

@llaville @science695 @tracyfloyd

Pull Request for ELK stack is open and ready to be tried: https://github.com/cytopia/devilbox/pull/510

Please let me know if this works flawlessly (currently OSS version)

Update:

Direct link to docker-compose.override.yml: https://github.com/cytopia/devilbox/blob/d10eab84713e0d8f7a69c194707182fde1513840/compose/docker-compose.override.yml-elk

For those we want to understand differences between ES versions => https://www.elastic.co/products/x-pack/open

Thanks @llaville for clarifying.

ELK PR has been merged and documentation is available here: https://devilbox.readthedocs.io/en/latest/custom-container/enable-elk-stack.html

ELK stack will be available in release branch shortly as well.

Was this page helpful?
0 / 5 - 0 ratings