Skip to content

Commit

Permalink
Distribution for Alerting standalone (#357)
Browse files Browse the repository at this point in the history
* Distribution for Alerting standalone

* Minor rename on ispn config files

* Fix test as conditions might change order

* Allow reindex backend at startup from configuration

* Update latest srcdep from commons
  • Loading branch information
lucasponce authored and jshaughn committed Jun 29, 2017
1 parent c230409 commit 5b94cf2
Show file tree
Hide file tree
Showing 14 changed files with 469 additions and 4 deletions.
Expand Up @@ -20,8 +20,8 @@
public class IspnCacheManager {
private static final MsgLogger log = MsgLogging.getMsgLogger(IspnCacheManager.class);
private static final String CONFIG_PATH = "hawkular.configuration";
private static final String ISPN_CONFIG_DISTRIBUTED = "alerting-distributed.xml";
private static final String ISPN_CONFIG_LOCAL = "alerting-local.xml";
private static final String ISPN_CONFIG_DISTRIBUTED = "ispn-alerting-distributed.xml";
private static final String ISPN_CONFIG_LOCAL = "ispn-alerting-local.xml";
private static final String ALERTS_DISTRIBUTED = "hawkular-alerts.distributed";
private static final String ALERTS_DISTRIBUTED_ENV = "HAWKULAR_ALERTS_DISTRIBUTED";
private static final String ALERTS_DISTRIBUTED_DEFAULT = "false";
Expand Down
34 changes: 34 additions & 0 deletions dist/assembly.xml
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

<id>${project.artifactId}</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/${distribution.name}-${project.version}</directory>
<outputDirectory/>
</fileSet>
</fileSets>
</assembly>
181 changes: 181 additions & 0 deletions dist/pom.xml
@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016-2017 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts</artifactId>
<version>2.0.0.Final-SNAPSHOT</version>
</parent>

<artifactId>hawkular-alerts-dist</artifactId>
<packaging>pom</packaging>

<name>Hawkular Alerting: Distribution</name>

<dependencies>

<!-- This project is specific for test so all dependencies are test scope -->
<dependency>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts-api</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.hawkular.commons</groupId>
<artifactId>hawkular-server</artifactId>
<version>${version.org.hawkular.commons}</version>
</dependency>

<dependency>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts-rest-handlers</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts-actions-email</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.hawkular.alerts</groupId>
<artifactId>hawkular-alerts-actions-file</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${version.org.apache.logging.log4j}</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${version.org.apache.logging.log4j}</version>
</dependency>
</dependencies>

<build>
<plugins>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${distribution.name}-${project.version}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>set-run-sh-permissions</id>
<phase>package</phase>
<configuration>
<tasks>
<property name="target-to-run" value="${project.build.directory}/${distribution.name}-${project.version}"/>
<chmod file="${target-to-run}/hawkular.sh" perm="755"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${distribution.name}-${project.version}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

<profiles>
<profile>
<id>dozip</id>
<activation>
<property>
<name>dozip</name>
<value>true</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
25 changes: 25 additions & 0 deletions dist/src/main/resources/config/hawkular.properties
@@ -0,0 +1,25 @@
#
# Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
# and other contributors as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Internal configuration registration, used to provide default values
hawkular-alerts.backend=ispn
hawkular-alerts.engine-delay=1000
hawkular-alerts.engine-period=2000
hawkular-alerts.base-url=/hawkular/alerts
hawkular-alerts.port=8080
hawkular-alerts.bind-address=127.0.0.1
hawkular-alerts.jmx-port=9080
86 changes: 86 additions & 0 deletions dist/src/main/resources/config/ispn-alerting-local.xml
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:9.0 http://www.infinispan.org/schemas/infinispan-config-9.0.xsd"
xmlns="urn:infinispan:config:9.0">

<cache-container name="hawkular-alerts">
<local-cache name="partition"/>
<local-cache name="triggers"/>
<local-cache name="data"/>
<local-cache name="publish">
<transaction mode="BATCH"/>
</local-cache>
<local-cache name="dataIds">
<transaction mode="BATCH"/>
</local-cache>
<local-cache name="schema"/>
<local-cache name="globalActions">
<transaction mode="BATCH"/>
</local-cache>

<!-- Backend for definitions, actions history, events and alerts -->
<local-cache name="backend">
<transaction mode="BATCH"/>
<persistence>
<file-store preload="true" fetch-state="true" read-only="false" purge="false" path="${hawkular.data}/alerting">
<write-behind thread-pool-size="5" modification-queue-size="10000" />
</file-store>
</persistence>
<indexing index="LOCAL">
<indexed-entities>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnAction</indexed-entity>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnActionDefinition</indexed-entity>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnCondition</indexed-entity>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnDampening</indexed-entity>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnEvent</indexed-entity>
<indexed-entity>org.hawkular.alerts.engine.impl.ispn.model.IspnTrigger</indexed-entity>
</indexed-entities>
<property name="default.indexmanager">near-real-time</property>
<property name="default.directory_provider">infinispan</property>
<property name="default.chunk_size">128000</property>
<property name="default.locking_cachename">LuceneIndexesLocking_custom</property>
<property name="default.data_cachename">LuceneIndexesData_custom</property>
<property name="default.metadata_cachename">LuceneIndexesMetadata_custom</property>
<!-- The default is 10, but we don't want to waste many cycles in merging
(tune for writes at cost of reader fragmentation) -->

<property name="default.indexwriter.merge_factor">30</property>
<!-- Never create segments larger than 1GB -->
<property name="default.indexwriter.merge_max_size">1024</property>
<!-- IndexWriter flush buffer size in MB -->
<property name="default.indexwriter.ram_buffer_size">64</property>
<!-- Enable sharding on writers -->
<property name="default.sharding_strategy.nbr_of_shards">6</property>
<property name="lucene_version">LUCENE_CURRENT</property>
</indexing>
</local-cache>
<local-cache name="LuceneIndexesMetadata_custom">
<transaction mode="NON_XA" />
<persistence passivation="false">
<file-store preload="true" fetch-state="true" read-only="false" purge="false" path="${hawkular.data}/alerting">
<write-behind thread-pool-size="5" />
</file-store>
</persistence>
<indexing index="NONE"/>
</local-cache>
<local-cache name="LuceneIndexesData_custom">
<transaction mode="NON_XA" />
<persistence passivation="false">
<file-store preload="true" fetch-state="true" read-only="false" purge="false" path="${hawkular.data}/alerting">
<write-behind thread-pool-size="5" />
</file-store>
</persistence>
<indexing index="NONE" />
</local-cache>
<local-cache name="LuceneIndexesLocking_custom">
<transaction mode="NON_XA" />
<persistence passivation="false">
<file-store preload="true" fetch-state="true" read-only="false" purge="false" path="${hawkular.data}/alerting">
<write-behind thread-pool-size="5" />
</file-store>
</persistence>
<indexing index="NONE" />
</local-cache>
</cache-container>
</infinispan>
25 changes: 25 additions & 0 deletions dist/src/main/resources/config/log4j2.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" shutdownHook="disable">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{1.} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.datastax" level="warn" />
<Logger name="com.icegreen" level="warn" />
<Logger name="infinispan" level="warn" />
<Logger name="io.netty" level="warn" />
<Logger name="io.vertx" level="trace" />
<Logger name="org.cassalog" level="info" />
<Logger name="org.drools" level="warn" />
<Logger name="org.jboss" level="warn" />
<Logger name="org.jgroups" level="warn" />
<Logger name="org.hawkular" level="info" />
<Logger name="org.infinispan" level="warn" />
<Logger name="org.hibernate" level="warn" />
<Root level="trace">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

0 comments on commit 5b94cf2

Please sign in to comment.