diff --git a/README.md b/README.md index d837b0b..1378053 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # elasticsearch-docker-composer-for-liferay-7 -This is for setting up docker-composer to test Elasticsearch and Kuromoji against Liferay 7 GA4 / DXP de32 (Elasticsearch 2.4). **This is ```oraclejdk8``` version. If you are looking for ```openjdk8``` version, please refer ```openjdk8``` branch of this repository.** +This is for setting up docker-composer to test Elasticsearch and Kuromoji against Liferay 7 GA6 / DXP de42 (Elasticsearch 6.1.3). **The JDK type (OpenJDK / OracleJDK) need to match between Elasticsearch and Liferay because Liferay using binary protocol to communicate with Elasticsearch. Master is ```Oracle jdk8``` version. If you are looking for ```${elasticsearch_version}_openjdk8``` version, please refer ```${elasticsearch_version}_openjdk8``` branch of this repository.** + +If you are using lower than Liferay 7 GA6 / DXP de42, please use branch ```2.4_openjdk8``` or ```2.4_oraclejdk8``` depending on what version of JDK type (OpenJDK / OracleJDK) using for Liferay. ## Required environment - Docker 17.06.2-ce >= @@ -65,6 +67,7 @@ PUT /[index_name]/_settings } ``` 3. Search / index and you'll see log files under ./es/logs +you can also change ./es/config/elasticsearch.yml for above settings and run ```docker-compose up --build``` ## Search from query to see how analyzer works. 1. Navigate to ```http://localhost:5601/app/sense``` and select server (http://elasticsearch:9200) @@ -81,9 +84,5 @@ GET /[index_name]/_analyze ### Elasticsearch ```http://localhost:9200``` -### Sense (Analyzing tool for Elasticsearch) -```http://localhost:5601/app/sense``` -In Sense, for a server, set ```http://elasticsearch:9200``` to access the Elasticsearch server. - -### Elastic-HQ -```http://localhost:9200/_plugin/hq``` +### Kibana (Analyzing tool for Elasticsearch) +```http://localhost:5601``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cde15e4..55e8ecc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "2" +version: "2.1" services: elasticsearch: build: es @@ -6,6 +6,10 @@ services: ports: - "9200:9200" - "9300:9300" + ulimits: + memlock: + soft: -1 + hard: -1 volumes: - ./es/data/:/usr/share/elasticsearch/data/ - ./es/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml @@ -13,10 +17,17 @@ services: - ./es/config/userdict_ja.txt:/usr/share/elasticsearch/config/userdict_ja.txt - ./es/logs/:/var/log/elasticsearch/ environment: - - "ES_JAVA_OPTS: -Xmx2048m -Xms2048m" + - "ES_JAVA_OPTS=-Xms1g -Xmx1g" + - bootstrap.memory_lock=true + - xpack.security.enabled=false + - xpack.graph.enabled=false + - xpack.ml.enabled=false + - xpack.monitoring.enabled=true + - xpack.watcher.enabled=false + kibana: - image: seeruk/docker-kibana-sense:4.6 + image: docker.elastic.co/kibana/kibana:6.1.4 ports: - "5601:5601" environment: - - ELASTICSEARCH_URL=http://elasticsearch:9200 + - xpack.security.enabled=false diff --git a/es/Dockerfile b/es/Dockerfile index 4539d5b..50f7146 100644 --- a/es/Dockerfile +++ b/es/Dockerfile @@ -1,84 +1,6 @@ -FROM frolvlad/alpine-oraclejdk8 +FROM docker.elastic.co/elasticsearch/elasticsearch:6.1.3 -# ensure elasticsearch user exists -RUN addgroup -S elasticsearch && adduser -S -G elasticsearch elasticsearch - -# grab su-exec for easy step-down from root -# and bash for "bin/elasticsearch" among others -RUN apk add --no-cache 'su-exec>=0.2' bash - -# https://artifacts.elastic.co/GPG-KEY-elasticsearch -ENV GPG_KEY 46095ACC8548582C1A2699A9D27D666CD88E42B4 - -WORKDIR /usr/share/elasticsearch -ENV PATH /usr/share/elasticsearch/bin:$PATH - -ENV ELASTICSEARCH_VERSION 2.4.6 -ENV ELASTICSEARCH_TARBALL="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.6.tar.gz" \ - ELASTICSEARCH_TARBALL_ASC="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.4.6.tar.gz.asc" \ - ELASTICSEARCH_TARBALL_SHA1="c3441bef89cd91206edf3cf3bd5c4b62550e60a9" - -RUN set -ex; \ - \ - apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - gnupg \ - openssl \ - tar \ - ; \ - \ - wget -O elasticsearch.tar.gz "$ELASTICSEARCH_TARBALL"; \ - \ - if [ "$ELASTICSEARCH_TARBALL_SHA1" ]; then \ - echo "$ELASTICSEARCH_TARBALL_SHA1 *elasticsearch.tar.gz" | sha1sum -c -; \ - fi; \ - \ - if [ "$ELASTICSEARCH_TARBALL_ASC" ]; then \ - wget -O elasticsearch.tar.gz.asc "$ELASTICSEARCH_TARBALL_ASC"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \ - gpg --batch --verify elasticsearch.tar.gz.asc elasticsearch.tar.gz; \ - rm -rf "$GNUPGHOME" elasticsearch.tar.gz.asc; \ - fi; \ - \ - tar -xf elasticsearch.tar.gz --strip-components=1; \ - rm elasticsearch.tar.gz; \ - \ - apk del .fetch-deps; \ - \ - mkdir -p ./plugins; \ - for path in \ - ./data \ - ./logs \ - ./config \ - ./config/scripts \ - ; do \ - mkdir -p "$path"; \ - chown -R elasticsearch:elasticsearch "$path"; \ - done; \ - \ -# we shouldn't need much RAM to test --version (default is 2gb, which gets Jenkins in trouble sometimes) - export ES_JAVA_OPTS='-Xms32m -Xmx32m'; \ - if [ "${ELASTICSEARCH_VERSION%%.*}" -gt 1 ]; then \ - elasticsearch --version; \ - else \ -# elasticsearch 1.x doesn't support --version -# but in 5.x, "-v" is verbose (and "-V" is --version) - elasticsearch -v; \ - fi - -COPY config ./config - -VOLUME /usr/share/elasticsearch/data - -COPY docker-entrypoint.sh / - -EXPOSE 9200 9300 -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["elasticsearch"] - -RUN bin/plugin install analysis-kuromoji -RUN bin/plugin install analysis-icu -RUN bin/plugin install analysis-smartcn -RUN bin/plugin install analysis-stempel -RUN bin/plugin install royrusso/elasticsearch-HQ/v2.0.3 \ No newline at end of file +RUN elasticsearch-plugin install analysis-kuromoji +RUN elasticsearch-plugin install analysis-icu +RUN elasticsearch-plugin install analysis-smartcn +RUN elasticsearch-plugin install analysis-stempel \ No newline at end of file diff --git a/es/config/elasticsearch.yml b/es/config/elasticsearch.yml index c548215..69b1afb 100644 --- a/es/config/elasticsearch.yml +++ b/es/config/elasticsearch.yml @@ -115,3 +115,5 @@ discovery.zen.minimum_master_nodes: 1 # index.indexing.slowlog.threshold.index.trace: 500ms # index.indexing.slowlog.level: info # index.indexing.slowlog.source: 1000 + +xpack.security.enabled: false \ No newline at end of file diff --git a/es/docker-entrypoint.sh b/es/docker-entrypoint.sh index 3580b0f..1bee090 100755 --- a/es/docker-entrypoint.sh +++ b/es/docker-entrypoint.sh @@ -14,6 +14,7 @@ if [ "$1" = 'elasticsearch' -a "$(id -u)" = '0' ]; then for path in \ /usr/share/elasticsearch/data \ /usr/share/elasticsearch/logs \ + /usr/share/elasticsearch \ ; do chown -R elasticsearch:elasticsearch "$path" done