Wildfly plugin configuration

Former-commit-id: 24e252881b
pull/4/head
Jens Pelzetter 2020-06-19 12:24:29 +02:00
parent 83e0662b75
commit 4acde5a0ed
7 changed files with 138 additions and 129 deletions

View File

@ -0,0 +1,2 @@
datasource.properties
wildfly.properties

View File

@ -1,7 +1,42 @@
## Prepare Wildfly: # ccm-bundle-devel-wildfly README
mvn -pl ccm-bundle-devel-wildfly-web wildfly:start wildfly:deploy-artifact@deploy-jdbc-driver wildfly:add-resource@add-datasource wildfly:shutdown This module creates a WAR which can be deployed to a Wildfly Application
Server. For testing, the module also provides an runtime environment
and the setup. The runtime is managed using the
[wildfly-maven-plugin](https://docs.jboss.org/wildfly/plugins/maven/latest/).
At the moment the runtime only supports PostgreSQL as database.
To use these runtime some prepration steps are necessary.
1. Create the configuration files. The runtime is configured using two files:
* wildfly.properties allows it to configure the ports used by the Wildfly server
* datasource.properties provides the configuration data for datasource used by
LibreCCM.
For both files examples are provided (`datasource.example.properties`,
`wildfly.example.properties`). Copy the example files and customize
the settings is necessary.
2. Run a build using the `setup-runtime` profile. It is important to add the
`package` goal, otherwise the WAR file which is deployed in this step is
not build correctly:
```
mvn package -Psetup-runtime -pl ccm-bundle-devel-wildfly -am
```
During the `package` phase of the this module Wildfly will be downloaded,
unpackaged into the `target` directory, the PostgreSQL driver will be
deployed, a datasource will be generated and the WAR file will be deployed.
To run LibreCCM in this environment, use the `enable-runtime` profile and the `wildfly:start`
goal:
mvn -Penable-runtime -pl ccm-bundle-devel-wildfly wildfly:start
To shutdown the server:
mvn -Penable-runtime -pl ccm-bundle-devel-wildfly wildfly:shutdown
## Running
mvn -pl ccm-bundle-devel-wildfly-web -am wildfly:run

View File

@ -0,0 +1,3 @@
libreccm.datasource.connectionUrl=jdbc:postgresql://localhost:5432/ccm-devel-beta
libreccm.datasource.username=ccm
libreccm.datasource.password=ccm

View File

@ -3,9 +3,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<wildfly.datasource.connectionUrl>jdbc:postgresql://localhost:5432/ccm-devel</wildfly.datasource.connectionUrl>
<wildfly.datasource.username>ccm</wildfly.datasource.username>
<wildfly.datasource.password>ccm</wildfly.datasource.password>
</properties> </properties>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -62,11 +60,11 @@
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>-->
</dependencies> </dependencies>
<build> <build>
@ -232,158 +230,95 @@
<filesets> <filesets>
<fileset> <fileset>
<directory>${project.build.directory}</directory> <directory>${project.build.directory}</directory>
<includes>
<include>classes/</include>
<include>generated-resources/</include>
<include>libreccm-web-wildfly/</include>
<include>libreccm-web-wildfly.war</include>
<include>maven-archiver/</include>
<include>test-classes/</include>
<include>war/</include>
</includes>
<excludes> <excludes>
<execlude>wildfly*</execlude> <exclude>wildfly*/**</exclude>
</excludes> </excludes>
</fileset> </fileset>
</filesets> </filesets>
</configuration> </configuration>
</plugin> </plugin>
<!-- <plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<commands>
<command>/subsystem=datasources/data-source=ccm-devel:add(driver-name=postgresql,jndi-name="java:/comp/env/jdbc/libreccm/db",connection-url="${wildfly.datasource.connectionUrl}",user-name="${wildfly.datasource.username}",password="${wildfly.datasource.password}",use-ccm="false")</command>
</commands>
</configuration>
</plugin>-->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>start</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<stdout>System.out</stdout>
</configuration>
</execution>
<execution>
<id>deploy-jdbc-driver</id>
<configuration>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<name>postgresql.jar</name>
</configuration>
<goals>
<goal>deploy-artifact</goal>
</goals>
</execution>
<execution>
<id>add-datasource</id>
<configuration>
<address>subsystem=datasources,data-source=ccm-devel</address>
<resources>
<resource>
<!--<enableResource>true</enableResource>-->
<properties>
<connection-url>${wildfly.datasource.connectionUrl}</connection-url>
<jndi-name>java:/comp/env/jdbc/libreccm/db</jndi-name>
<enabled>true</enabled>
<user-name>${wildfly.datasource.username}</user-name>
<password>${wildfly.datasource.password}</password>
<use-ccm>false</use-ccm>
<driver-name>postgresql.jar</driver-name>
</properties>
</resource>
</resources>
</configuration>
<goals>
<goal>add-resource</goal>
</goals>
</execution>
<execution>
<id>shutdown</id>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>prepare-wildfly</id> <id>setup-runtime</id>
<!-- <properties>
<libreccm.datasource.connectionUrl>jdbc:postgresql://localhost:5432/ccm-devel</libreccm.datasource.connectionUrl>
<libreccm.datasource.username>ccm</libreccm.datasource.username>
<libreccm.datasource.password>ccm</libreccm.datasource.password>
</properties>-->
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<id>read-datasource-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/datasource.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.wildfly.plugins</groupId> <groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId> <artifactId>wildfly-maven-plugin</artifactId>
<configuration> <configuration>
<skip>false</skip> <skip>false</skip>
<propertiesFile>${project.basedir}/wildfly.properties</propertiesFile>
</configuration> </configuration>
<executions> <executions>
<!-- <execution>
<id>undeploy</id>
<phase>clean</phase>
<goals>
<goal>undeploy</goal>
</goals>
<configuration>
<ignoreMissingDeployment>true</ignoreMissingDeployment>
</configuration>
</execution>-->
<execution> <execution>
<id>start</id> <id>start-for-prepare</id>
<phase>package</phase>
<goals> <goals>
<goal>start</goal> <goal>start</goal>
</goals> </goals>
<phase>package</phase>
<configuration> <configuration>
<stdout>System.out</stdout> <stdout>System.out</stdout>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
<id>deploy-jdbc-driver</id> <id>deploy-jdbc-driver</id>
<phase>package</phase>
<configuration> <configuration>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<name>postgresql.jar</name> <name>postgresql.jar</name>
<force>true</force>
</configuration> </configuration>
<phase>package</phase>
<goals> <goals>
<goal>deploy-artifact</goal> <goal>deploy-artifact</goal>
</goals> </goals>
</execution> </execution>
<execution> <execution>
<id>add-datasource</id> <id>add-datasource</id>
<phase>package</phase>
<configuration> <configuration>
<address>subsystem=datasources,data-source=ccm-devel</address> <address>subsystem=datasources,data-source=ccm-devel</address>
<force>true</force>
<resources> <resources>
<resource> <resource>
<!--<enableResource>true</enableResource>-->
<properties> <properties>
<connection-url>${wildfly.datasource.connectionUrl}</connection-url> <connection-url>${libreccm.datasource.connectionUrl}</connection-url>
<jndi-name>java:/comp/env/jdbc/libreccm/db</jndi-name> <jndi-name>java:/comp/env/jdbc/libreccm/db</jndi-name>
<enabled>true</enabled> <enabled>true</enabled>
<user-name>${wildfly.datasource.username}</user-name> <user-name>${libreccm.datasource.username}</user-name>
<password>${wildfly.datasource.password}</password> <password>${libreccm.datasource.password}</password>
<use-ccm>false</use-ccm> <use-ccm>false</use-ccm>
<driver-name>postgresql.jar</driver-name> <driver-name>postgresql.jar</driver-name>
</properties> </properties>
@ -391,38 +326,23 @@
</resources> </resources>
</configuration> </configuration>
<phase>package</phase>
<goals> <goals>
<goal>add-resource</goal> <goal>add-resource</goal>
</goals> </goals>
</execution> </execution>
<!-- <execution> <execution>
<id>run</id> <id>deploy-libreccm-bundle-devel</id>
<phase>package</phase>
<configuration> <configuration>
<commands> <force>true</force>
<command>/subsystem=datasources/data-source=ccm-devel:add(driver-name=postgresql,jndi-name="java:/comp/env/jdbc/libreccm/db",connection-url="${wildfly.datasource.connectionUrl}",user-name="${wildfly.datasource.username}",password="${wildfly.datasource.password}",use-ccm="false")</command>
</commands>
</configuration> </configuration>
<goals>
<goal>run</goal>
</goals>
</execution>-->
<!-- <execution>
<id>run</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>-->
<!-- <execution>
<id>deploy</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>deploy-only</goal> <goal>deploy-only</goal>
</goals> </goals>
</execution>--> </execution>
<execution> <execution>
<id>shutdown</id> <id>shutdown-after-deploy</id>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>shutdown</goal> <goal>shutdown</goal>
@ -433,5 +353,33 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>enable-runtime</id>
<properties>
<runtime.hostname>localhost</runtime.hostname>
<runtime.bind>127.0.0.1</runtime.bind>
<runtime.http.port>8180</runtime.http.port>
<runtime.https.port>8543</runtime.https.port>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
<propertiesFile>${project.basedir}/wildfly.properties</propertiesFile>
<!-- <serverArgs>
<serverArg>-Djboss.http.port=${runtime.http.port}</serverArg>
<serverArg>-Djboss.https.port=${runtime.https.port}</serverArg>
</serverArgs>-->
<!-- <hostname>${runtime.hostname}</hostname>
<port>${runtime.port}</port>-->
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<jboss-web>
<context-root>/libreccm</context-root>
</jboss-web>

View File

@ -0,0 +1,12 @@
# Configuration for Wildfly, primarly ports on which Wildfly will listen
# Ports for Undertow (Servlet Container). These are the ports which you are
# using the access your application
jboss.http.port=8080
jboss.https.port=8443
# Ports for Wildfly's Management Interface
jboss.management.http.port=9990
jboss.management.https.port=9993

View File

@ -321,6 +321,11 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId> <artifactId>versions-maven-plugin</artifactId>