Merge pull request #167 from pymma/kafka
Update configuration to push docker images on docker hub
This commit is contained in:
commit
05704d7cef
12 changed files with 388 additions and 107 deletions
|
|
@ -344,7 +344,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
|
@ -407,7 +407,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<registry>${registry.host}</registry>
|
<registry>${registry.host}</registry>
|
||||||
|
|
@ -463,5 +463,58 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>pymmasoftware/runtime-admin-console:${version.number}</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||||
|
<assembly>
|
||||||
|
<descriptorRef>artifact</descriptorRef>
|
||||||
|
</assembly>
|
||||||
|
<tags>
|
||||||
|
<tag>latest</tag>
|
||||||
|
</tags>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
<authConfig>
|
||||||
|
<username>pymmasoftwaredeploy</username>
|
||||||
|
<password>${dockerhub.password}</password>
|
||||||
|
</authConfig>
|
||||||
|
<retries>5</retries>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>mydeploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
|
@ -295,7 +295,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<registry>${registry.host}</registry>
|
<registry>${registry.host}</registry>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
|
||||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||||
import org.drools.compiler.kie.builder.impl.InternalKieModule;
|
import org.drools.compiler.kie.builder.impl.InternalKieModule;
|
||||||
import org.drools.compiler.kie.builder.impl.KieRepositoryImpl;
|
|
||||||
import org.kie.api.builder.KieRepository;
|
|
||||||
import org.kie.api.remote.Remotable;
|
import org.kie.api.remote.Remotable;
|
||||||
import org.kie.scanner.KieModuleMetaData;
|
import org.kie.scanner.KieModuleMetaData;
|
||||||
import org.kie.server.api.KieServerConstants;
|
import org.kie.server.api.KieServerConstants;
|
||||||
|
|
@ -38,16 +36,20 @@ import java.util.*;
|
||||||
|
|
||||||
public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String EXTENSION_NAME = "DroolsFramework";
|
public static final String EXTENSION_NAME = "DroolsFramework";
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugKieServerExtension.class);
|
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugKieServerExtension.class);
|
||||||
private static final Boolean disabled = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_SERVER_EXT_DISABLED, "false"));
|
private static final Boolean DISABLED = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_SERVER_EXT_DISABLED, "false"));
|
||||||
private static final Boolean filterRemoteable = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_FILTER_REMOTEABLE_CLASSES, "false"));
|
private static final Boolean FILTER_REMOTEABLE = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_FILTER_REMOTEABLE_CLASSES, "false"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DroolsChtijbugRulesExecutionService rulesExecutionService;
|
private DroolsChtijbugRulesExecutionService rulesExecutionService;
|
||||||
|
|
||||||
private KieServerRegistry registry;
|
private KieServerRegistry registry;
|
||||||
|
|
||||||
private List<Object> services = new ArrayList<Object>();
|
private List<Object> services = new ArrayList<>();
|
||||||
private KieServerAddOnElement kieServerAddOnElement = null;
|
private KieServerAddOnElement kieServerAddOnElement = null;
|
||||||
|
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
@ -61,7 +63,7 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return disabled == false;
|
return !DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -103,7 +105,7 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
@Override
|
@Override
|
||||||
public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
|
public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
|
||||||
// do any other bootstrapping rule service requires
|
// do any other bootstrapping rule service requires
|
||||||
Set<Class<?>> extraClasses = new HashSet<Class<?>>();
|
Set<Class<?>> extraClasses = new HashSet<>();
|
||||||
|
|
||||||
// create kbases so declared types can be created
|
// create kbases so declared types can be created
|
||||||
Collection<String> kbases = kieContainerInstance.getKieContainer().getKieBaseNames();
|
Collection<String> kbases = kieContainerInstance.getKieContainer().getKieBaseNames();
|
||||||
|
|
@ -123,13 +125,13 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
logger.debug("Adding {} type into extra jaxb classes set", type);
|
logger.debug("Adding {} type into extra jaxb classes set", type);
|
||||||
Class<?> clazz = Class.forName(type, true, kieContainerInstance.getKieContainer().getClassLoader());
|
Class<?> clazz = Class.forName(type, true, kieContainerInstance.getKieContainer().getClassLoader());
|
||||||
|
|
||||||
addExtraClass(extraClasses, clazz, filterRemoteable);
|
addExtraClass(extraClasses, clazz, FILTER_REMOTEABLE);
|
||||||
logger.debug("Added {} type into extra jaxb classes set", type);
|
logger.debug("Added {} type into extra jaxb classes set", type);
|
||||||
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
logger.warn("Unable to create instance of type {} due to {}", type, e.getMessage());
|
logger.warn("Unable to create instance of type {} due to {}", type, e.getMessage());
|
||||||
logger.debug("Complete stack trace for exception while creating type {}", type, e);
|
logger.debug("Complete stack trace for exception while creating type {}", type, e);
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Unexpected error while create instance of type {} due to {}", type, e.getMessage());
|
logger.warn("Unexpected error while create instance of type {} due to {}", type, e.getMessage());
|
||||||
logger.debug("Complete stack trace for unknown error while creating type {}", type, e);
|
logger.debug("Complete stack trace for unknown error while creating type {}", type, e);
|
||||||
}
|
}
|
||||||
|
|
@ -143,19 +145,18 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
|
public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
|
||||||
this.disposeContainer(id, kieContainerInstance, map);
|
//Nop
|
||||||
this.createContainer(id, kieContainerInstance, map);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUpdateContainerAllowed(String s, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
|
public boolean isUpdateContainerAllowed(String s, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
|
||||||
System.out.println("isUpdateContainerAllowed");
|
logger.info("Container {} isUpdateContainerAllowed",s);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
|
public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
|
||||||
System.out.println("disposeContainer");
|
logger.info("Container {} dispose",id);
|
||||||
if (kieServerAddOnElement != null) {
|
if (kieServerAddOnElement != null) {
|
||||||
|
|
||||||
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
|
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
|
||||||
|
|
@ -172,9 +173,9 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
rulesExecutionService.removeRuleBasePackage(id);
|
rulesExecutionService.removeRuleBasePackage(id);
|
||||||
if (kieContainerInstance instanceof KieContainerInstanceImpl) {
|
if (kieContainerInstance instanceof KieContainerInstanceImpl) {
|
||||||
KieContainerInstanceImpl internalContainer = (KieContainerInstanceImpl) kieContainerInstance;
|
KieContainerInstanceImpl internalContainer = (KieContainerInstanceImpl) kieContainerInstance;
|
||||||
KieRepository kieRepository = KieRepositoryImpl.INSTANCE;
|
|
||||||
|
|
||||||
if (internalContainer.getKieContainer().getMainKieModule() instanceof InternalKieModule) {
|
|
||||||
|
if (internalContainer.getKieContainer().getMainKieModule() instanceof InternalKieModule) {
|
||||||
InternalKieModule kie = (InternalKieModule) internalContainer.getKieContainer().getMainKieModule();
|
InternalKieModule kie = (InternalKieModule) internalContainer.getKieContainer().getMainKieModule();
|
||||||
kie.getFile().delete();
|
kie.getFile().delete();
|
||||||
}
|
}
|
||||||
|
|
@ -185,14 +186,14 @@ public class DroolsChtijbugKieServerExtension implements KieServerExtension {
|
||||||
public List<Object> getAppComponents(SupportedTransports type) {
|
public List<Object> getAppComponents(SupportedTransports type) {
|
||||||
ServiceLoader<KieServerApplicationComponentsService> appComponentsServices
|
ServiceLoader<KieServerApplicationComponentsService> appComponentsServices
|
||||||
= ServiceLoader.load(KieServerApplicationComponentsService.class);
|
= ServiceLoader.load(KieServerApplicationComponentsService.class);
|
||||||
List<Object> appComponentsList = new ArrayList<Object>();
|
List<Object> appComponentsList = new ArrayList<>();
|
||||||
Object[] services = {
|
Object[] serviceList = {
|
||||||
rulesExecutionService,
|
rulesExecutionService,
|
||||||
registry
|
registry
|
||||||
|
|
||||||
};
|
};
|
||||||
for (KieServerApplicationComponentsService appComponentsService : appComponentsServices) {
|
for (KieServerApplicationComponentsService appComponentsService : appComponentsServices) {
|
||||||
appComponentsList.addAll(appComponentsService.getAppComponents(EXTENSION_NAME, type, services));
|
appComponentsList.addAll(appComponentsService.getAppComponents(EXTENSION_NAME, type, serviceList));
|
||||||
}
|
}
|
||||||
return appComponentsList;
|
return appComponentsList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
|
@ -339,7 +339,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<registry>${registry.host}</registry>
|
<registry>${registry.host}</registry>
|
||||||
|
|
@ -428,6 +428,100 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>pymmasoftware/kie-wb:${version.number}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||||
|
<assembly>
|
||||||
|
<mode>dir</mode>
|
||||||
|
<name>maven/</name>
|
||||||
|
<inline 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>middleware-rest</id>
|
||||||
|
<files>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/kie-wb.war</source>
|
||||||
|
<outputDirectory>./</outputDirectory>
|
||||||
|
<destName>kie-wb.war</destName>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/pymma-kie-login-module.jar</source>
|
||||||
|
<outputDirectory>./</outputDirectory>
|
||||||
|
<destName>pymma-kie-login-module.jar</destName>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/bson.jar</source>
|
||||||
|
<outputDirectory>./</outputDirectory>
|
||||||
|
<destName>bson.jar</destName>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/mongodb-driver-core.jar</source>
|
||||||
|
<outputDirectory>./</outputDirectory>
|
||||||
|
<destName>mongodb-driver-core.jar</destName>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/mongodb-driver.jar</source>
|
||||||
|
<outputDirectory>./</outputDirectory>
|
||||||
|
<destName>mongodb-driver.jar</destName>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</inline>
|
||||||
|
</assembly>
|
||||||
|
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<run>
|
||||||
|
<extraHosts>
|
||||||
|
<host>mongodb:192.168.1.102</host>
|
||||||
|
<host>declasin:192.168.1.184</host>
|
||||||
|
</extraHosts>
|
||||||
|
<ports>
|
||||||
|
<port>8080:8080</port>
|
||||||
|
</ports>
|
||||||
|
</run>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
<authConfig>
|
||||||
|
<username>${dockerhub.username}</username>
|
||||||
|
<password>${dockerhub.password}</password>
|
||||||
|
</authConfig>
|
||||||
|
<retries>5</retries>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>mydeploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -451,7 +451,6 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
|
||||||
|
|
||||||
}
|
}
|
||||||
ProcessInstance processInstance = this.knowledgeSession.startProcess(processName);
|
ProcessInstance processInstance = this.knowledgeSession.startProcess(processName);
|
||||||
|
|
||||||
if (this.historyListener != null) {
|
if (this.historyListener != null) {
|
||||||
try {
|
try {
|
||||||
SessionStartProcessEndEvent sessionStartProcessEndEvent = new SessionStartProcessEndEvent(eventCounter.next(), processName, this.ruleBaseID, this.sessionId, processInstance.getProcessId());
|
SessionStartProcessEndEvent sessionStartProcessEndEvent = new SessionStartProcessEndEvent(eventCounter.next(), processName, this.ruleBaseID, this.sessionId, processInstance.getProcessId());
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
|
@ -209,5 +209,62 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>pymmasoftware/runtime-indexer:${version.number}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||||
|
<assembly>
|
||||||
|
<descriptorRef>artifact</descriptorRef>
|
||||||
|
</assembly>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<run>
|
||||||
|
<extraHosts>
|
||||||
|
<host>mongodb:192.168.1.100</host>
|
||||||
|
</extraHosts>
|
||||||
|
|
||||||
|
</run>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
<authConfig>
|
||||||
|
<username>pymmasoftwaredeploy</username>
|
||||||
|
<password>${dockerhub.password}</password>
|
||||||
|
</authConfig>
|
||||||
|
<retries>5</retries>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>mydeploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -228,7 +228,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--registry>192.168.1.184:12500</registry-->
|
<!--registry>192.168.1.184:12500</registry-->
|
||||||
|
|
@ -291,7 +291,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>io.fabric8</groupId>
|
<groupId>io.fabric8</groupId>
|
||||||
<artifactId>docker-maven-plugin</artifactId>
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
<version>0.21.0</version>
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<registry>${registry.host}</registry>
|
<registry>${registry.host}</registry>
|
||||||
|
|
@ -346,5 +346,66 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>${fabri8.plugin.version}</version>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>pymmasoftware/runtime-proxy:${version.number}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||||
|
<assembly>
|
||||||
|
<descriptorRef>artifact</descriptorRef>
|
||||||
|
</assembly>
|
||||||
|
<tags>
|
||||||
|
<tag>latest</tag>
|
||||||
|
</tags>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<run>
|
||||||
|
<extraHosts>
|
||||||
|
<host>mongodb:192.168.1.100</host>
|
||||||
|
</extraHosts>
|
||||||
|
<ports>
|
||||||
|
<port>8080:8080</port>
|
||||||
|
</ports>
|
||||||
|
</run>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
<authConfig>
|
||||||
|
<username>pymmasoftwaredeploy</username>
|
||||||
|
<password>${dockerhub.password}</password>
|
||||||
|
</authConfig>
|
||||||
|
<retries>5</retries>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>mydeploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package org.chtijbug.drools.proxy.camel;
|
||||||
|
|
||||||
import org.apache.camel.CamelContext;
|
import org.apache.camel.CamelContext;
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
import org.apache.camel.builder.RouteBuilder;
|
||||||
import org.kie.server.services.api.KieContainerInstance;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
@ -11,22 +10,20 @@ import static org.apache.camel.model.rest.RestParamType.body;
|
||||||
public class DroolsRouter extends RouteBuilder {
|
public class DroolsRouter extends RouteBuilder {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DroolsRouter.class);
|
private static final Logger logger = LoggerFactory.getLogger(DroolsRouter.class);
|
||||||
private String containerId;
|
private String projectName;
|
||||||
private KieContainerInstance kci;
|
|
||||||
private Class<?> clazzUser;
|
private Class<?> clazzUser;
|
||||||
private String processID;
|
private String processID;
|
||||||
|
|
||||||
public DroolsRouter(CamelContext camelContext, Class<?> clazzUser, String containerId, KieContainerInstance kci, String processID) {
|
public DroolsRouter(CamelContext camelContext, Class<?> clazzUser, String projectName, String processID) {
|
||||||
super(camelContext);
|
super(camelContext);
|
||||||
this.clazzUser = clazzUser;
|
this.clazzUser = clazzUser;
|
||||||
this.containerId = containerId;
|
this.projectName = projectName;
|
||||||
this.kci = kci;
|
|
||||||
this.processID = processID;
|
this.processID = processID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure() throws Exception {
|
public void configure() throws Exception {
|
||||||
rest("/" + containerId).description(containerId + " Rest service")
|
rest("/" + projectName).description(projectName + " Rest service")
|
||||||
|
|
||||||
.consumes("application/json")
|
.consumes("application/json")
|
||||||
.produces("application/json")
|
.produces("application/json")
|
||||||
|
|
@ -36,6 +33,6 @@ public class DroolsRouter extends RouteBuilder {
|
||||||
.param().name("body").type(body).description("The Data drools should work on").endParam()
|
.param().name("body").type(body).description("The Data drools should work on").endParam()
|
||||||
.responseMessage().code(200).message("Data drools worked on").endResponseMessage()
|
.responseMessage().code(200).message("Data drools worked on").endResponseMessage()
|
||||||
|
|
||||||
.to("bean:ruleService?method=runSessionObject(${header.transactionId}," + this.containerId + "," + this.processID + ",${body})");
|
.to("bean:ruleService?method=runSessionObject(${header.transactionId}," + this.projectName + "," + this.processID + ",${body})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class KieServiceCommon {
|
||||||
NewTopic responseTopic;
|
NewTopic responseTopic;
|
||||||
|
|
||||||
public KieServiceCommon() {
|
public KieServiceCommon() {
|
||||||
//Needed
|
//Needed
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getKieServerID() {
|
public static String getKieServerID() {
|
||||||
|
|
@ -134,37 +134,37 @@ public class KieServiceCommon {
|
||||||
logger.info("initCamelBusinessRoutes.getLocalHost", e);
|
logger.info("initCamelBusinessRoutes.getLocalHost", e);
|
||||||
}
|
}
|
||||||
List<RuntimePersist> itIsMes;
|
List<RuntimePersist> itIsMes;
|
||||||
if (runtimePort==-1){
|
if (runtimePort == -1) {
|
||||||
itIsMes = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
itIsMes = runtimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||||
}else{
|
} else {
|
||||||
itIsMes = runtimeRepository.findByServerName(serverName);
|
itIsMes = runtimeRepository.findByServerName(serverName);
|
||||||
}
|
}
|
||||||
RuntimePersist runtimePersist;
|
RuntimePersist runtimePersist;
|
||||||
ServiceResponse<KieServerInfo> result = server.getInfo();
|
ServiceResponse<KieServerInfo> result = server.getInfo();
|
||||||
String version = result.getResult().getVersion();
|
String version = result.getResult().getVersion();
|
||||||
if (itIsMes.isEmpty()) {
|
if (itIsMes.isEmpty()) {
|
||||||
runtimePersist = new RuntimePersist(serverName, version, hostName,
|
runtimePersist = new RuntimePersist(serverName, version, hostName,
|
||||||
String.valueOf(serverPort), null,
|
String.valueOf(serverPort), null,
|
||||||
hostName, RuntimePersist.STATUS.UP.toString());
|
hostName, RuntimePersist.STATUS.UP.toString());
|
||||||
if (runtimePort!=-1){
|
if (runtimePort != -1) {
|
||||||
runtimePersist.setHostname(runtimeServer);
|
runtimePersist.setHostname(runtimeServer);
|
||||||
runtimePersist.setServerPort(String.valueOf(runtimePort));
|
runtimePersist.setServerPort(String.valueOf(runtimePort));
|
||||||
}
|
}
|
||||||
String isSwarm = System.getProperty("org.kie.server.swarm");
|
String isSwarm = System.getProperty("org.kie.server.swarm");
|
||||||
String swarmPort=System.getProperty("org.kie.server.swarm.port");
|
String swarmPort = System.getProperty("org.kie.server.swarm.port");
|
||||||
String baseurl="http://";
|
String baseurl = "http://";
|
||||||
if ("1".equals(isSwarm)) {
|
if ("1".equals(isSwarm)) {
|
||||||
if (swarmPort!= null &&
|
if (swarmPort != null &&
|
||||||
swarmPort.length()>0){
|
swarmPort.length() > 0) {
|
||||||
runtimePersist.setServerUrl(baseurl + serverName + ":" + swarmPort);
|
runtimePersist.setServerUrl(baseurl + serverName + ":" + swarmPort);
|
||||||
}else{
|
} else {
|
||||||
runtimePersist.setServerUrl(baseurl + serverName + ":" + serverPort);
|
runtimePersist.setServerUrl(baseurl + serverName + ":" + serverPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (runtimePort==-1) {
|
if (runtimePort == -1) {
|
||||||
runtimePersist.setServerUrl(baseurl + hostName + ":" + serverPort);
|
runtimePersist.setServerUrl(baseurl + hostName + ":" + serverPort);
|
||||||
}else{
|
} else {
|
||||||
runtimePersist.setServerUrl(baseurl + runtimeServer + ":" + runtimePort);
|
runtimePersist.setServerUrl(baseurl + runtimeServer + ":" + runtimePort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,7 @@ public class KieServiceCommon {
|
||||||
String projectName = container.getContainerId();
|
String projectName = container.getContainerId();
|
||||||
String processId = container.getProcessID();
|
String processId = container.getProcessID();
|
||||||
this.deleteCamelBusinessRoute(projectName);
|
this.deleteCamelBusinessRoute(projectName);
|
||||||
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, kieContainerInstance, processId);
|
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, processId);
|
||||||
camelContext.addRoutes(droolsRouter);
|
camelContext.addRoutes(droolsRouter);
|
||||||
routes.put(containerId, droolsRouter);
|
routes.put(containerId, droolsRouter);
|
||||||
}
|
}
|
||||||
|
|
@ -307,59 +307,6 @@ public class KieServiceCommon {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public KieContainerResource createContainerWithRestBusinessService(String id, KieContainerResource container, String className, String processID) {
|
|
||||||
|
|
||||||
|
|
||||||
KieContainerResource containerResource = this.createContainer(id, container);
|
|
||||||
if (containerResource.getMessages().size() == 1
|
|
||||||
&& containerResource.getMessages().get(0).getSeverity() != null
|
|
||||||
&& containerResource.getMessages().get(0).getSeverity().equals(Severity.INFO)) {
|
|
||||||
ClassLoader localClassLoader = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
localClassLoader = Thread.currentThread()
|
|
||||||
.getContextClassLoader();
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
logger.info("GenericResource.runSession", e);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
|
||||||
ContainerPojoPersist containerPojoPersist = containerRepository.findByServerNameAndContainerId(serverName, id);
|
|
||||||
if (containerPojoPersist == null) {
|
|
||||||
containerPojoPersist = new ContainerPojoPersist();
|
|
||||||
containerPojoPersist.setId(UUID.randomUUID().toString());
|
|
||||||
containerPojoPersist.setContainerId(id);
|
|
||||||
containerPojoPersist.setClassName(className);
|
|
||||||
containerPojoPersist.setProjectName(id);
|
|
||||||
containerPojoPersist.setServerName(serverName);
|
|
||||||
containerPojoPersist.setProcessID(processID);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
containerPojoPersist.setContainerId(id);
|
|
||||||
containerPojoPersist.setClassName(className);
|
|
||||||
containerPojoPersist.setProjectName(id);
|
|
||||||
containerPojoPersist.setProcessID(processID);
|
|
||||||
containerPojoPersist.setServerName(serverName);
|
|
||||||
|
|
||||||
}
|
|
||||||
this.initCamelBusinessRoute(containerPojoPersist);
|
|
||||||
containerRepository.save(containerPojoPersist);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("createContainerWithRestBusinessService", e);
|
|
||||||
} finally {
|
|
||||||
if (localClassLoader != null) {
|
|
||||||
Thread.currentThread().setContextClassLoader(localClassLoader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return containerResource;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public KieContainerResource createContainer(String id, KieContainerResource container) {
|
public KieContainerResource createContainer(String id, KieContainerResource container) {
|
||||||
|
|
||||||
container.setContainerId(id);
|
container.setContainerId(id);
|
||||||
|
|
@ -429,15 +376,15 @@ public class KieServiceCommon {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@Scheduled(fixedDelay = 5000)
|
@Scheduled(fixedDelay = 5000)
|
||||||
public void updateConfig(){
|
public void updateConfig() {
|
||||||
logger.info("updateConfig - check for new version to deploy");
|
logger.debug("updateConfig - check for new version to deploy");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String serverName = KieServiceCommon.getKieServerID();
|
String serverName = KieServiceCommon.getKieServerID();
|
||||||
List<ContainerRuntimePojoPersist> containerRuntimePojoPersists = containerRuntimeRepository.findByServerNameAndHostname(serverName, hostName);
|
List<ContainerRuntimePojoPersist> containerRuntimePojoPersists = containerRuntimeRepository.findByServerNameAndHostname(serverName, hostName);
|
||||||
for (ContainerRuntimePojoPersist element : containerRuntimePojoPersists) {
|
for (ContainerRuntimePojoPersist element : containerRuntimePojoPersists) {
|
||||||
logger.info("runtime {} has status {}",element.getContainerId(),element.getStatus());
|
logger.debug("runtime {} has status {}", element.getContainerId(), element.getStatus());
|
||||||
ContainerPojoPersist containerPojoPersist = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
ContainerPojoPersist containerPojoPersist = containerRepository.findByServerNameAndContainerId(serverName, element.getContainerId());
|
||||||
if (element.getStatus().equals(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name())) {
|
if (element.getStatus().equals(ContainerRuntimePojoPersist.STATUS.TODEPLOY.name())) {
|
||||||
logger.info("start deploy new container");
|
logger.info("start deploy new container");
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class RuleService {
|
||||||
private KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplateLogging;
|
private KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplateLogging;
|
||||||
|
|
||||||
public RuleService() {
|
public RuleService() {
|
||||||
logger.info("Rule Service created");
|
logger.info("Rule Service created");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object runSessionObject(String transactionID, String id, String processID, Object input) {
|
public Object runSessionObject(String transactionID, String id, String processID, Object input) {
|
||||||
|
|
|
||||||
|
|
@ -241,5 +241,65 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
<version>0.21.0</version>
|
||||||
|
<configuration>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>pymmasoftware/runtime-reverse-proxy:${version.number}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
|
||||||
|
|
||||||
|
<!--copies Jar to the maven directory (uses Assembly system)-->
|
||||||
|
<assembly>
|
||||||
|
<descriptorRef>artifact</descriptorRef>
|
||||||
|
</assembly>
|
||||||
|
<tags>
|
||||||
|
<tag>latest</tag>
|
||||||
|
</tags>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<run>
|
||||||
|
<extraHosts>
|
||||||
|
<host>mongodb:192.168.1.100</host>
|
||||||
|
</extraHosts>
|
||||||
|
|
||||||
|
</run>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
<authConfig>
|
||||||
|
<username>pymmasoftwaredeploy</username>
|
||||||
|
<password>${dockerhub.password}</password>
|
||||||
|
</authConfig>
|
||||||
|
<retries>5</retries>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>mydeploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
</executions>
|
||||||
|
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
14
pom.xml
14
pom.xml
|
|
@ -17,7 +17,8 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jbpm.version>7.43.1.Final</jbpm.version>
|
<fabri8.plugin.version>0.34.1</fabri8.plugin.version>
|
||||||
|
<jbpm.version>7.44.0.Final</jbpm.version>
|
||||||
<node.version>v10.16.3</node.version>
|
<node.version>v10.16.3</node.version>
|
||||||
<npm.version>6.11.3</npm.version>
|
<npm.version>6.11.3</npm.version>
|
||||||
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
|
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
|
||||||
|
|
@ -77,6 +78,17 @@
|
||||||
<docker.Host>http://192.168.1.184:2376</docker.Host>
|
<docker.Host>http://192.168.1.184:2376</docker.Host>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>docker-hub</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>false</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<env>docker</env>
|
||||||
|
<docker.Host>register.hub.docker.com/pymmasoftware</docker.Host>
|
||||||
|
<nexus.host>https://nexus.pymma-software.net</nexus.host>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>pymma-internal</id>
|
<id>pymma-internal</id>
|
||||||
<activation>
|
<activation>
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue