This repository has been archived by the owner on Feb 13, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1469 Create Spring boot application for Audit Mongo service (#1)
- Loading branch information
1 parent
ce9cfdf
commit 5796948
Showing
7 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: java | ||
sudo: required | ||
services: | ||
- docker | ||
jdk: | ||
- oraclejdk8 | ||
notifications: | ||
webhooks: | ||
urls: | ||
- https://webhooks.gitter.im/e/4eabeeadee998a77068b | ||
on_success: change # options: [always|never|change] default: always | ||
on_failure: always # options: [always|never|change] default: always | ||
on_start: never # options: [always|never|change] default: always | ||
|
||
before_script: | ||
- echo MAVEN_OPTS=-Xmx1536m > ~/.mavenrc | ||
|
||
# Send coverage data | ||
after_success: | ||
bash <(curl -s https://codecov.io/bash) | ||
|
||
after_failure: | ||
- cat **/target/surefire-reports/*.xml | grep -B 1 -A 10 "<error" | ||
- cat **/target/failsafe-reports/*.xml | grep -B 1 -A 10 "<error" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# requires Docker version 17.05.0-ce-rc1, build 2878a85 | ||
FROM maven:3.5-jdk-8 as BUILDAUDIT | ||
|
||
COPY src /usr/src/myapp/src | ||
COPY pom.xml /usr/src/myapp | ||
RUN mvn -f /usr/src/myapp/pom.xml clean package -DskipTests | ||
|
||
FROM openjdk:alpine | ||
|
||
COPY --from=BUILDAUDIT /usr/src/myapp/target/*.jar /maven/ | ||
|
||
CMD java -jar /maven/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
<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> | ||
|
||
<groupId>org.activiti.cloud</groupId> | ||
<artifactId>activiti-cloud-audit-mongodb</artifactId> | ||
<version>7-201710-EA-SNAPSHOT</version> | ||
|
||
<packaging>jar</packaging> | ||
<name>Activiti Cloud :: Audit with MongoDB</name> | ||
|
||
<properties> | ||
<version.activiti.cloud>${project.version}</version.activiti.cloud> | ||
|
||
<spring-boot-maven-plugin.version>1.5.4.RELEASE</spring-boot-maven-plugin.version> | ||
<docker.maven.plugin.version>0.21.0</docker.maven.plugin.version> | ||
<maven.release.plugin.version>2.5.3</maven.release.plugin.version> | ||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version> | ||
</properties> | ||
|
||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.activiti.cloud</groupId> | ||
<artifactId>activiti-cloud-dependencies</artifactId> | ||
<version>${version.activiti.cloud}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.activiti.cloud</groupId> | ||
<artifactId>activiti-cloud-starter-audit-mongo</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spring-milestones</id> | ||
<name>Spring Milestones</name> | ||
<url>https://repo.spring.io/libs-milestone</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
<repository> <!-- Using snapshot repo to temporarily keep keycloak adapter --> | ||
<id>activiti-snapshots</id> | ||
<name>Activiti Snapshots</name> | ||
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-snapshots/</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
<repository> | ||
<id>spring-snapshots</id> | ||
<name>Spring Snapshots</name> | ||
<url>https://repo.spring.io/libs-snapshot</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>spring-snapshots</id> | ||
<name>Spring Snapshots</name> | ||
<url>http://repo.spring.io/snapshot</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<id>spring-milestones</id> | ||
<name>Spring Milestones</name> | ||
<url>http://repo.spring.io/milestone</url> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${spring-boot-maven-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>repackage</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-release-plugin</artifactId> | ||
<version>${maven.release.plugin.version}</version> | ||
<configuration> | ||
<releaseProfiles>sign</releaseProfiles> | ||
<autoVersionSubmodules>true</autoVersionSubmodules> | ||
<tagNameFormat>activiti-@{project.version}</tagNameFormat> | ||
<!-- Necessary until keycloak releases boot2 adaptor --> | ||
<allowTimestampedSnapshots>true</allowTimestampedSnapshots> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<!-- Profile to sign artifacts, triggered when releasing --> | ||
<profile> | ||
<id>sign</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-gpg-plugin</artifactId> | ||
<version>${maven-gpg-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>sign-artifacts</id> | ||
<goals> | ||
<goal>sign</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>activiti-enterprise-snapshots</id> | ||
<name>Alfresco internal repo</name> | ||
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/</url> | ||
</repository> | ||
<snapshotRepository> | ||
<id>activiti-enterprise-snapshots</id> | ||
<name>Activiti Snapshots</name> | ||
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-snapshots/</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<!-- Various information, not used by the build --> | ||
|
||
<url>http://activiti.org</url> | ||
<licenses> | ||
<license> | ||
<name>Apache v2</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url> | ||
</license> | ||
</licenses> | ||
<organization> | ||
<name>Alfresco</name> | ||
<url>http://www.alfresco.com</url> | ||
</organization> | ||
<inceptionYear>2017</inceptionYear> | ||
<issueManagement> | ||
<system>GitHub</system> | ||
<url>https://github.com/Activiti/Activiti/issues</url> | ||
</issueManagement> | ||
<ciManagement> | ||
<system>Travis</system> | ||
<url>http://bamboo.ci.codehaus.org/browse/ACT</url> | ||
</ciManagement> | ||
<scm> | ||
<url>https://github.com/Activiti/activiti-cloud-audit</url> | ||
<connection>scm:git:https://github.com/Activiti/activiti-cloud-audit.git</connection> | ||
<developerConnection>scm:git:https://github.com/Activiti/activiti-cloud-audit.git</developerConnection> | ||
<tag>HEAD</tag> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>salaboy</id> | ||
<name>Mauricio Salatino</name> | ||
<email>mauricio.salatino@alfresco.com</email> | ||
<organization>Alfresco</organization> | ||
<organizationUrl>http://alfresco.com</organizationUrl> | ||
</developer> | ||
<developer> | ||
<id>erdemedeiros</id> | ||
<name>Elias De Medeiros</name> | ||
<email>elias.demedeiros@alfresco.com</email> | ||
<organization>Alfresco</organization> | ||
<organizationUrl>http://alfresco.com</organizationUrl> | ||
</developer> | ||
<developer> | ||
<id>ryandawsonuk</id> | ||
<name>Ryan Dawson</name> | ||
<email>ryan.dawson@alfresco.com</email> | ||
<organization>Alfresco</organization> | ||
<organizationUrl>http://alfresco.com</organizationUrl> | ||
</developer> | ||
</developers> | ||
|
||
</project> |
28 changes: 28 additions & 0 deletions
28
src/main/java/org/activiti/cloud/audit/MongoAuditApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.activiti.cloud.audit; | ||
|
||
import org.activiti.cloud.starter.configuration.EnableActivitiAuditMongo; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.cloud.sleuth.sampler.AlwaysSampler; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.ComponentScan; | ||
|
||
@SpringBootApplication | ||
@EnableActivitiAuditMongo | ||
@ComponentScan("org.activiti") | ||
public class MongoAuditApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(MongoAuditApplication.class, | ||
args); | ||
} | ||
|
||
public void run(String... strings) throws Exception { | ||
|
||
} | ||
|
||
@Bean | ||
public AlwaysSampler defaultSampler() { | ||
return new AlwaysSampler(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
server.port=${ACT_AUDIT_PORT:8181} | ||
spring.application.name=${ACT_AUDIT_APP_NAME:audit} | ||
|
||
spring.cloud.stream.bindings.auditConsumer.destination=${ACT_AUDIT_CONSUMER_DEST:engineEvents} | ||
spring.cloud.stream.bindings.auditConsumer.group=${ACT_AUDIT_CONSUMER_GROUP:audit} | ||
spring.cloud.stream.bindings.auditConsumer.contentType=${ACT_AUDIT_CONSUMER_CONTENT_TYPE:application/json} | ||
spring.jackson.serialization.fail-on-unwrapped-type-identifiers=${ACT_AUDIT_JACKSON_FAIL_ON_UNWRAPPED_IDS:false} | ||
|
||
keycloak.auth-server-url=${ACT_KEYCLOAK_URL:http://activiti-cloud-sso-idm:8180/auth} | ||
keycloak.realm=${ACT_KEYCLOAK_REALM:springboot} | ||
keycloak.resource=${ACT_KEYCLOAK_RESOURCE:activiti} | ||
keycloak.ssl-required=${ACT_KEYCLOAK_SSL_REQUIRED:none} | ||
keycloak.public-client=${ACT_KEYCLOAK_CLIENT:true} | ||
|
||
keycloak.security-constraints[0].authRoles[0]=${ACT_KEYCLOAK_ROLES:user} | ||
keycloak.security-constraints[0].securityCollections[0].patterns[0]=${ACT_KEYCLOAK_PATTERNS:/*} | ||
|
||
keycloak.principal-attribute=${ACT_KEYCLOAK_PRINCIPAL_ATTRIBUTE:preferred-username} | ||
# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options | ||
|
||
keycloakadminclientapp=${ACT_KEYCLOAK_CLIENT_APP:admin-cli} | ||
keycloakclientuser=${ACT_KEYCLOAK_CLIENT_USER:client} | ||
keycloakclientpassword=${ACT_KEYCLOAK_CLIENT_PASSWORD:client} | ||
# this user needs to have the realm management roles assigned | ||
|
||
spring.rabbitmq.host=${ACT_RABBITMQ_HOST:rabbitmq} | ||
eureka.client.serviceUrl.defaultZone=${ACT_EUREKA_URL:http://activiti-cloud-registry:8761/eureka/} | ||
|
||
#hostname as declared to eureka | ||
eureka.instance.hostname=${ACT_AUDIT_HOST:activiti-cloud-audit} | ||
eureka.client.enabled=${ACT_AUDIT_EUREKA_CLIENT_ENABLED:true} | ||
|
||
spring.data.mongodb.host=${ACT_AUDIT_MONGO_HOST:mongodb} | ||
spring.data.mongodb.port=${ACT_AUDIT_MONGO_PORT:27017} | ||
spring.data.mongodb.database=${ACT_AUDIT_MONGO_DB:activitidb} |
19 changes: 19 additions & 0 deletions
19
src/test/java/org/activiti/cloud/audit/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.activiti.cloud.audit; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.annotation.DirtiesContext; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest(classes = MongoAuditApplication.class) | ||
@DirtiesContext | ||
public class ApplicationTest { | ||
|
||
@Test | ||
public void contextLoads() throws Exception { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
spring.application.name=audit | ||
spring.cloud.stream.bindings.auditConsumer.destination=engineEvents | ||
spring.cloud.stream.bindings.auditConsumer.group=audit | ||
spring.cloud.stream.bindings.auditConsumer.contentType=application/json | ||
spring.jackson.serialization.fail-on-unwrapped-type-identifiers=false | ||
server.port=0 | ||
|
||
keycloak.auth-server-url=http://localhost:8180/auth | ||
keycloak.realm=springboot | ||
keycloak.resource=activiti | ||
keycloak.public-client=true | ||
|
||
keycloak.security-constraints[0].authRoles[0]=user | ||
keycloak.security-constraints[0].securityCollections[0].patterns[0]=/* | ||
|
||
keycloak.principal-attribute=preferred-username | ||
# see https://issues.jboss.org/browse/KEYCLOAK-810 for configuration options | ||
|
||
keycloakadminclientapp=admin-cli | ||
keycloakclientuser=client | ||
keycloakclientpassword=client | ||
# this user needs to have the realm management roles assigned | ||
# one option to deal with password being here would be spring-boot-jasypt, keycloak may support others (can it be set as env variable?) | ||
eureka.client.enabled=false |