TSK-779 Configure Wildfly for running JBoss with postgres DB

This commit is contained in:
Martin Rojas Miguel Angel 2019-02-07 12:38:14 +01:00 committed by BerndBreier
parent 462a8c0d5e
commit 62835449bb
8 changed files with 122 additions and 23 deletions

View File

@ -117,7 +117,7 @@ SET PROP_FILE=%HOMEPATH%\taskanaUnitTest.properties
) )
ECHO jdbcDriver=org.postgresql.Driver > %PROP_FILE% ECHO jdbcDriver=org.postgresql.Driver > %PROP_FILE%
ECHO jdbcUrl=jdbc:postgresql://localhost:50001/postgres >> %PROP_FILE% ECHO jdbcUrl=jdbc:postgresql://localhost:50102/postgres >> %PROP_FILE%
ECHO dbUserName=postgres >> %PROP_FILE% ECHO dbUserName=postgres >> %PROP_FILE%
ECHO dbPassword=postgres >> %PROP_FILE% ECHO dbPassword=postgres >> %PROP_FILE%
ECHO schemaName=taskana >> %PROP_FILE% ECHO schemaName=taskana >> %PROP_FILE%

View File

@ -31,6 +31,9 @@ function main {
mvn clean verify -q -f $REL/../lib/ -B mvn clean verify -q -f $REL/../lib/ -B
mvn clean install -q -f $REL/../rest/ -B mvn clean install -q -f $REL/../rest/ -B
mvn clean verify -q -f $REL/../rest/ -B -pl taskana-rest-spring-example -P history.plugin mvn clean verify -q -f $REL/../rest/ -B -pl taskana-rest-spring-example -P history.plugin
elif [[ "$1" == "POSTGRES_10_4" ]]; then
mvn clean verify -q -f $REL/../lib/taskana-core -B
mvn clean install -q -f $REL/../rest/ -B -P postgres
else else
mvn clean verify -q -f $REL/../lib/taskana-core -B mvn clean verify -q -f $REL/../lib/taskana-core -B
fi fi

View File

@ -35,6 +35,7 @@ public class SampleDataGenerator {
private static final String SQL = "/sql"; private static final String SQL = "/sql";
private static final String TEST_DATA = "/sample-data"; private static final String TEST_DATA = "/sample-data";
private static final String CLEAR = SQL + TEST_DATA + "/clear-db.sql"; private static final String CLEAR = SQL + TEST_DATA + "/clear-db.sql";
private static final String CLEAR_HISTORY_EVENTS = SQL + TEST_DATA + "/clear-history-events.sql";
private static final String TASK = SQL + TEST_DATA + "/task.sql"; private static final String TASK = SQL + TEST_DATA + "/task.sql";
private static final String WORKBASKET = SQL + TEST_DATA + "/workbasket.sql"; private static final String WORKBASKET = SQL + TEST_DATA + "/workbasket.sql";
private static final String DISTRIBUTION_TARGETS = SQL + TEST_DATA + "/distribution-targets.sql"; private static final String DISTRIBUTION_TARGETS = SQL + TEST_DATA + "/distribution-targets.sql";
@ -73,6 +74,8 @@ public class SampleDataGenerator {
runner.setStopOnError(false); runner.setStopOnError(false);
runner.runScript(new BufferedReader( runner.runScript(new BufferedReader(
new InputStreamReader(this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8))); new InputStreamReader(this.getClass().getResourceAsStream(CLEAR), StandardCharsets.UTF_8)));
runner.runScript(new BufferedReader(
new InputStreamReader(this.getClass().getResourceAsStream(CLEAR_HISTORY_EVENTS), StandardCharsets.UTF_8)));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("caught Exception {}", e); LOGGER.error("caught Exception {}", e);
} }

View File

@ -6,7 +6,6 @@ DELETE FROM WORKBASKET;
DELETE FROM DISTRIBUTION_TARGETS; DELETE FROM DISTRIBUTION_TARGETS;
DELETE FROM CLASSIFICATION; DELETE FROM CLASSIFICATION;
DELETE FROM OBJECT_REFERENCE; DELETE FROM OBJECT_REFERENCE;
DELETE FROM HISTORY_EVENTS;
-- do not clean JOB table -- do not clean JOB table
-- DELETE FROM SCHEDULED_JOB; -- DELETE FROM SCHEDULED_JOB;
COMMIT; COMMIT;

View File

@ -0,0 +1,2 @@
DELETE FROM HISTORY_EVENTS;
COMMIT;

View File

@ -13,6 +13,14 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>taskana-rest-spring-wildfly-example</artifactId> <artifactId>taskana-rest-spring-wildfly-example</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<properties>
<!-- Default H2 DB configuration -->
<connection-url>jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0</connection-url>
<driver-class>org.h2.Driver</driver-class>
<driver-name>h2</driver-name>
<user-name>sa</user-name>
<password>sa</password>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -45,8 +53,59 @@
<version>3.1.0</version> <version>3.1.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>postgres</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build> <build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<properties>
<driver-class>${jdbcDriver}</driver-class>
<connection-url>${jdbcUrl}</connection-url>
<driver-name>postgresqldriver</driver-name>
<user-name>${dbUserName}</user-name>
<password>${dbPassword}</password>
<activatedProperties>postgres</activatedProperties>
</properties>
<files>
<file>${user.home}/taskanaUnitTest.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -67,19 +126,19 @@
<goal>start</goal> <goal>start</goal>
</goals> </goals>
</execution> </execution>
<!-- Deploy the JDBC library --> <!-- Deploy the JDBC library in JBoss -->
<!--<execution> <execution>
<id>deploy-driver</id> <id>deploy-driver</id>
<phase>install</phase> <phase>install</phase>
<configuration> <configuration>
<groupId>postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<name>postgresql.jar</name> <name>postgresqldriver</name>
</configuration> </configuration>
<goals> <goals>
<goal>deploy-artifact</goal> <goal>deploy-artifact</goal>
</goals> </goals>
</execution>--> </execution>
<!-- Add a data source --> <!-- Add a data source -->
<execution> <execution>
<id>add-datasource</id> <id>add-datasource</id>
@ -91,11 +150,11 @@
<properties> <properties>
<jndi-name>java:/TaskanaDS</jndi-name> <jndi-name>java:/TaskanaDS</jndi-name>
<enabled>true</enabled> <enabled>true</enabled>
<connection-url>jdbc:h2:mem:taskana;IGNORECASE=TRUE;LOCK_MODE=0</connection-url> <connection-url>${connection-url}</connection-url>
<driver-class>org.h2.Driver</driver-class> <driver-class>${driver-class}</driver-class>
<driver-name>h2</driver-name> <driver-name>${driver-name}</driver-name>
<user-name>sa</user-name> <user-name>${user-name}</user-name>
<password>sa</password> <password>${password}</password>
</properties> </properties>
</resource> </resource>
</resources> </resources>
@ -112,6 +171,14 @@
<goal>deploy</goal> <goal>deploy</goal>
</goals> </goals>
</execution> </execution>
<!-- undeploy the application on install -->
<execution>
<id>wildfly-undeploy</id>
<phase>install</phase>
<goals>
<goal>undeploy</goal>
</goals>
</execution>
<!-- shutdown the application on install --> <!-- shutdown the application on install -->
<execution> <execution>
<id>wildfly-shutdown</id> <id>wildfly-shutdown</id>

View File

@ -0,0 +1,34 @@
logging.level.pro.taskana=INFO
### logging.level.org.springframework=DEBUG
######## Taskana DB #######
datasource.jndi=java:/TaskanaDS
taskana.schemaName=taskana
####### control LDAP usage
taskana.ldap.useLdap=false
####### properties to connect to LDAP
taskana.ldap.serverUrl=ldap://localhost:10389
taskana.ldap.bindDn=uid=admin,ou=system
taskana.ldap.bindPassword=secret
taskana.ldap.baseDn=o=TaskanaTest
####### properties that control search for users and groups
taskana.ldap.userSearchBase=ou=people
taskana.ldap.userSearchFilterName=objectclass
taskana.ldap.userSearchFilterValue=person
taskana.ldap.userFirstnameAttribute=givenName
taskana.ldap.userLastnameAttribute=sn
taskana.ldap.userIdAttribute=uid
taskana.ldap.groupSearchBase=ou=groups
taskana.ldap.groupSearchFilterName=objectclass
taskana.ldap.groupSearchFilterValue=groupOfUniqueNames
taskana.ldap.groupNameAttribute=cn
taskana.ldap.minSearchForLength=3
taskana.ldap.maxNumberOfReturnedAccessIds=50
taskana.ldap.groupsOfUser=memberUid
####### JobScheduler cron expression that specifies when the JobSchedler runs
taskana.jobscheduler.async.cron=0 * * * * *
####### cache static resources properties
spring.resources.cache.cachecontrol.cache-private=true
####### tomcat is not detecting the x-forward headers from bluemix as a trustworthy proxy
server.tomcat.internal-proxies=.*
server.use-forward-headers=true

View File

@ -1,18 +1,9 @@
spring.profiles.active=@activatedProperties@
logging.level.pro.taskana=INFO logging.level.pro.taskana=INFO
### logging.level.org.springframework=DEBUG ### logging.level.org.springframework=DEBUG
######## Taskana DB ####### ######## Taskana DB #######
######## h2 configuration ########
datasource.jndi=java:/TaskanaDS datasource.jndi=java:/TaskanaDS
taskana.schemaName=TASKANA taskana.schemaName=TASKANA
######## h2 console configuration ########
######## spring.h2.console.enabled=true ########
######## spring.h2.console.path=/h2-console ########
######## Postgres configuration ########
######## datasource.url=jdbc:postgresql://localhost/taskana ########
######## datasource.driverClassName=org.postgresql.Driver ########
######## datasource.username=postgres ########
######## datasource.password=1234 ########
####### control LDAP usage ####### control LDAP usage
taskana.ldap.useLdap=false taskana.ldap.useLdap=false