From a08d7dce4dad897cc2553aa68d09d8fe4396ecc3 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Mon, 1 Aug 2016 14:28:31 +0200 Subject: [PATCH] add standalone assembly --- duniter4j-elasticsearch/pom.xml | 28 ++++- .../main/assembly/config/elasticsearch.yml | 119 ++++++++++++++++++ .../src/main/assembly/standalone.xml | 65 +++++----- .../DuniterElasticsearchException.java | 22 ++++ .../rest/RestXContentBuilder.java | 22 ++++ .../rest/XContentRestResponse.java | 22 ++++ .../rest/XContentThrowableRestResponse.java | 22 ++++ .../src/test/es-home/config/logging.yml | 2 + 8 files changed, 265 insertions(+), 37 deletions(-) create mode 100644 duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml diff --git a/duniter4j-elasticsearch/pom.xml b/duniter4j-elasticsearch/pom.xml index 72eda53c..ffd73a66 100644 --- a/duniter4j-elasticsearch/pom.xml +++ b/duniter4j-elasticsearch/pom.xml @@ -72,7 +72,6 @@ <dependency> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> - <scope>compile</scope> </dependency> <dependency> <groupId>net.java.dev.jna</groupId> @@ -181,6 +180,27 @@ <silent>true</silent> <includeScope>runtime</includeScope> <excludeScope>test</excludeScope> + <excludeGroupIds>org.elasticsearch,net.java.dev.jna,com.google.guava</excludeGroupIds> + <excludeArtifactIds>elasticsearch,jna,guava</excludeArtifactIds> + </configuration> + </execution> + <execution> + <id>unpack-dependencies</id> + <goals> + <goal>unpack</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.elasticsearch.distribution.zip</groupId> + <artifactId>elasticsearch</artifactId> + <version>${elasticsearch.version}</version> + <type>zip</type> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}</outputDirectory> + <silent>true</silent> </configuration> </execution> </executions> @@ -199,12 +219,12 @@ <attach>true</attach> <finalName>${bundlePrefix}</finalName> <descriptors> - <!--descriptor> - ${basedir}/src/main/assembly/standalone.xml - </descriptor--> <descriptor> ${basedir}/src/main/assembly/plugin.xml </descriptor> + <descriptor> + ${basedir}/src/main/assembly/standalone.xml + </descriptor> </descriptors> </configuration> </execution> diff --git a/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml b/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml new file mode 100644 index 00000000..c799994a --- /dev/null +++ b/duniter4j-elasticsearch/src/main/assembly/config/elasticsearch.yml @@ -0,0 +1,119 @@ +# ======================== Elasticsearch Configuration ========================= +# +# NOTE: Elasticsearch comes with reasonable defaults for most settings. +# Before you set out to tweak and tune the configuration, make sure you +# understand what are you trying to accomplish and the consequences. +# +# The primary way of configuring a node is via this file. This template lists +# the most important settings you may want to configure for a production cluster. +# +# Please see the documentation for further information on configuration options: +# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html> +# +# ---------------------------------- Cluster ----------------------------------- +# +# Use a descriptive name for your cluster: +# +# cluster.name: my-application +cluster.name: duniter4j-elasticsearch +# +# ------------------------------------ Node ------------------------------------ +# +# Use a descriptive name for the node: +# +# node.name: node-1 +# +# Add custom attributes to the node: +# +# node.rack: r1 +# +# ----------------------------------- Paths ------------------------------------ +# +# Path to directory where to store the data (separate multiple locations by comma): +# +# path.data: /path/to/data +# +# Path to log files: +# +# path.logs: /path/to/logs +# +# ----------------------------------- Memory ----------------------------------- +# +# Lock the memory on startup: +# +# bootstrap.mlockall: true +# +# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory +# available on the system and that the owner of the process is allowed to use this limit. +# +# Elasticsearch performs poorly when the system is swapping the memory. +# +# ---------------------------------- Network ----------------------------------- +# +# Set the bind address to a specific IP (IPv4 or IPv6): +# +# network.host: 192.168.0.1 +# +# Set a custom port for HTTP: +# +# http.port: 9200 + +http.cors.enabled: false +# +# For more information, see the documentation at: +# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html> +# +# --------------------------------- Discovery ---------------------------------- +# +# Pass an initial list of hosts to perform discovery when new node is started: +# The default list of hosts is ["127.0.0.1", "[::1]"] +# +# discovery.zen.ping.unicast.hosts: ["host1", "host2"] +# +# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1): +# +# discovery.zen.minimum_master_nodes: 3 +# +# For more information, see the documentation at: +# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html> +# +# ---------------------------------- Gateway ----------------------------------- +# +# Block initial recovery after a full cluster restart until N nodes are started: +# +# gateway.recover_after_nodes: 3 +# +# For more information, see the documentation at: +# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html> +# +# ---------------------------------- Various ----------------------------------- +# +# Disable starting multiple nodes on a single system: +# +# node.max_local_storage_nodes: 1 +# +# Require explicit names when deleting indices: +# +# action.destructive_requires_name: true + + +security.manager.enabled: false + + +#duniter.disable: true +duniter.host: cgeek.fr +duniter.port: 9330 + +duniter.string.analyzer: french + +#duniter.indices.reload: true + +#duniter.dev.enable: true + +#script.groovy.sandbox.enabled: true + +# Security token prefix (default: 'duniter-') +#duniter.auth.token.prefix: duniter- + +# Token validity duration, in seconds (default: 600) +duniter.auth.tokenValidityDuration: 3600 # = 1hour \ No newline at end of file diff --git a/duniter4j-elasticsearch/src/main/assembly/standalone.xml b/duniter4j-elasticsearch/src/main/assembly/standalone.xml index fba0a0b0..fd210096 100644 --- a/duniter4j-elasticsearch/src/main/assembly/standalone.xml +++ b/duniter4j-elasticsearch/src/main/assembly/standalone.xml @@ -34,69 +34,68 @@ <fileSets> <fileSet> - <directory>target</directory> + <directory>target/elasticsearch-${elasticsearch.version}</directory> <outputDirectory/> - <includes> - <include>${project.build.finalName}.${project.packaging}</include> - </includes> + <excludes> + <exclude>config/elasticsearch.yml</exclude> + </excludes> </fileSet> + <!-- default configuration file --> <fileSet> - <directory>target/lib</directory> - <outputDirectory>lib</outputDirectory> + <directory>src/main/assembly/config</directory> + <outputDirectory>config</outputDirectory> <includes> - <include>*.jar</include> + <include>elasticsearch.yml</include> </includes> - <excludes> - <exclude>junit-*.jar</exclude> - </excludes> </fileSet> + <!-- mapper attachment plugin --> <fileSet> - <directory>src/main/assembly/min</directory> + <directory>src/test/es-home</directory> <outputDirectory/> - <filtered>true</filtered> - <fileMode>0755</fileMode> <includes> - <include>duniter4j-elasticsearch.sh</include> - <include>duniter4j-elasticsearch.bat</include> - <include>version.appup</include> - <include>README*</include> + <include>plugins/mapper-attachments/**/*.*</include> </includes> </fileSet> - - <!-- configuration file --> + <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory/> + <directory>target</directory> + <outputDirectory>plugins/${project.artifactId}</outputDirectory> <includes> - <include>duniter4j.config</include> + <include>${project.build.finalName}.${project.packaging}</include> </includes> </fileSet> - <!-- I18N component --> - <fileSet> - <directory>target/classes/META-INF</directory> - <outputDirectory>i18n</outputDirectory> + <fileSet> + <directory>src/main/filtered-resources</directory> + <outputDirectory>plugins/${project.artifactId}</outputDirectory> + <filtered>true</filtered> <includes> - <include>duniter4j-elasticsearch-i18n*.properties</include> - <include>duniter4j-elasticsearch-i18n*.csv</include> + <include>plugin-descriptor.properties</include> </includes> </fileSet> + <fileSet> - <directory>src/main/assembly/min</directory> - <outputDirectory>i18n</outputDirectory> - <filtered>true</filtered> + <directory>target/lib</directory> + <outputDirectory>plugins/${project.artifactId}</outputDirectory> <includes> - <include>version.appup</include> + <include>*.jar</include> </includes> + <excludes> + <exclude>guava-*.jar</exclude> + <exclude>jna-4.1.0.jar</exclude> + <exclude>jackson-core-*.jar</exclude> + </excludes> </fileSet> <fileSet> + <outputDirectory>plugins/${project.artifactId}</outputDirectory> <includes> - <include>LICENSE*</include> + <include>LICENSE</include> </includes> </fileSet> + </fileSets> </assembly> diff --git a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/exception/DuniterElasticsearchException.java b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/exception/DuniterElasticsearchException.java index bab58557..e728d7ee 100644 --- a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/exception/DuniterElasticsearchException.java +++ b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/exception/DuniterElasticsearchException.java @@ -1,5 +1,27 @@ package org.duniter.elasticsearch.exception; +/* + * #%L + * Duniter4j :: ElasticSearch Plugin + * %% + * Copyright (C) 2014 - 2016 EIS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import org.elasticsearch.ElasticsearchException; /** diff --git a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/RestXContentBuilder.java b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/RestXContentBuilder.java index 451dc57c..5aa0977d 100644 --- a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/RestXContentBuilder.java +++ b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/RestXContentBuilder.java @@ -1,5 +1,27 @@ package org.duniter.elasticsearch.rest; +/* + * #%L + * Duniter4j :: ElasticSearch Plugin + * %% + * Copyright (C) 2014 - 2016 EIS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; diff --git a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentRestResponse.java b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentRestResponse.java index c79558e7..102573a6 100644 --- a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentRestResponse.java +++ b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentRestResponse.java @@ -1,5 +1,27 @@ package org.duniter.elasticsearch.rest; +/* + * #%L + * Duniter4j :: ElasticSearch Plugin + * %% + * Copyright (C) 2014 - 2016 EIS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; diff --git a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentThrowableRestResponse.java b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentThrowableRestResponse.java index e759e7a2..e78ac86d 100644 --- a/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentThrowableRestResponse.java +++ b/duniter4j-elasticsearch/src/main/java/org/duniter/elasticsearch/rest/XContentThrowableRestResponse.java @@ -1,5 +1,27 @@ package org.duniter.elasticsearch.rest; +/* + * #%L + * Duniter4j :: ElasticSearch Plugin + * %% + * Copyright (C) 2014 - 2016 EIS + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import org.duniter.elasticsearch.exception.DuniterElasticsearchException; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/duniter4j-elasticsearch/src/test/es-home/config/logging.yml b/duniter4j-elasticsearch/src/test/es-home/config/logging.yml index 939aa1ee..b2d20e52 100644 --- a/duniter4j-elasticsearch/src/test/es-home/config/logging.yml +++ b/duniter4j-elasticsearch/src/test/es-home/config/logging.yml @@ -16,6 +16,8 @@ logger: org.apache.http: INFO + org.duniter: DEBUG + # gateway #gateway: DEBUG #index.gateway: DEBUG -- GitLab