From 4acde5a0edad474b49aa67de52db67d4fe317681 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Fri, 19 Jun 2020 12:24:29 +0200 Subject: [PATCH] Wildfly plugin configuration Former-commit-id: 24e252881b38ea1232e2a718b633309c23907096 --- ccm-bundle-devel-wildfly-web/.gitignore | 2 + ccm-bundle-devel-wildfly-web/README.md | 43 +++- .../datasource.example.properties | 3 + ccm-bundle-devel-wildfly-web/pom.xml | 196 +++++++----------- .../src/main/webapp/WEB-INF/jboss-web.xml | 4 + .../wildfly.example.properties | 12 ++ pom.xml | 7 +- 7 files changed, 138 insertions(+), 129 deletions(-) create mode 100644 ccm-bundle-devel-wildfly-web/.gitignore create mode 100644 ccm-bundle-devel-wildfly-web/datasource.example.properties create mode 100644 ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/jboss-web.xml create mode 100644 ccm-bundle-devel-wildfly-web/wildfly.example.properties diff --git a/ccm-bundle-devel-wildfly-web/.gitignore b/ccm-bundle-devel-wildfly-web/.gitignore new file mode 100644 index 000000000..ee3de53b9 --- /dev/null +++ b/ccm-bundle-devel-wildfly-web/.gitignore @@ -0,0 +1,2 @@ +datasource.properties +wildfly.properties diff --git a/ccm-bundle-devel-wildfly-web/README.md b/ccm-bundle-devel-wildfly-web/README.md index 9efaa9761..c2db0a5b2 100644 --- a/ccm-bundle-devel-wildfly-web/README.md +++ b/ccm-bundle-devel-wildfly-web/README.md @@ -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 diff --git a/ccm-bundle-devel-wildfly-web/datasource.example.properties b/ccm-bundle-devel-wildfly-web/datasource.example.properties new file mode 100644 index 000000000..2ce5dd016 --- /dev/null +++ b/ccm-bundle-devel-wildfly-web/datasource.example.properties @@ -0,0 +1,3 @@ +libreccm.datasource.connectionUrl=jdbc:postgresql://localhost:5432/ccm-devel-beta +libreccm.datasource.username=ccm +libreccm.datasource.password=ccm diff --git a/ccm-bundle-devel-wildfly-web/pom.xml b/ccm-bundle-devel-wildfly-web/pom.xml index 7ab045e69..4bb2c0b93 100644 --- a/ccm-bundle-devel-wildfly-web/pom.xml +++ b/ccm-bundle-devel-wildfly-web/pom.xml @@ -3,9 +3,7 @@ UTF-8 - jdbc:postgresql://localhost:5432/ccm-devel - ccm - ccm + 4.0.0 @@ -62,11 +60,11 @@ ${project.parent.version} - + @@ -232,158 +230,95 @@ ${project.build.directory} - - classes/ - generated-resources/ - libreccm-web-wildfly/ - libreccm-web-wildfly.war - maven-archiver/ - test-classes/ - war/ - - wildfly* + wildfly*/** - - - - org.wildfly.plugins - wildfly-maven-plugin - - false - - - - start - - start - - - System.out - - - - deploy-jdbc-driver - - org.postgresql - postgresql - postgresql.jar - - - deploy-artifact - - - - add-datasource - -
subsystem=datasources,data-source=ccm-devel
- - - - - ${wildfly.datasource.connectionUrl} - java:/comp/env/jdbc/libreccm/db - true - ${wildfly.datasource.username} - ${wildfly.datasource.password} - false - postgresql.jar - - - - -
- - add-resource - -
- - shutdown - - shutdown - - -
-
- prepare-wildfly + setup-runtime + org.postgresql postgresql + provided + + org.codehaus.mojo + properties-maven-plugin + + + read-datasource-properties + initialize + + read-project-properties + + + + ${project.basedir}/datasource.properties + + + + + org.wildfly.plugins wildfly-maven-plugin false + ${project.basedir}/wildfly.properties - - start - package + start-for-prepare start + package System.out deploy-jdbc-driver - package org.postgresql postgresql postgresql.jar + true + package deploy-artifact add-datasource - package
subsystem=datasources,data-source=ccm-devel
+ true - - ${wildfly.datasource.connectionUrl} + ${libreccm.datasource.connectionUrl} java:/comp/env/jdbc/libreccm/db true - ${wildfly.datasource.username} - ${wildfly.datasource.password} + ${libreccm.datasource.username} + ${libreccm.datasource.password} false postgresql.jar @@ -391,38 +326,23 @@
+ package add-resource
- - - + - shutdown + shutdown-after-deploy package shutdown @@ -433,5 +353,33 @@
+ + + enable-runtime + + localhost + 127.0.0.1 + 8180 + 8543 + + + + + org.wildfly.plugins + wildfly-maven-plugin + + false + ${project.basedir}/wildfly.properties + + + + + + +
diff --git a/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/jboss-web.xml b/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 000000000..3b2f84d32 --- /dev/null +++ b/ccm-bundle-devel-wildfly-web/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + /libreccm + diff --git a/ccm-bundle-devel-wildfly-web/wildfly.example.properties b/ccm-bundle-devel-wildfly-web/wildfly.example.properties new file mode 100644 index 000000000..e986880c6 --- /dev/null +++ b/ccm-bundle-devel-wildfly-web/wildfly.example.properties @@ -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 + + diff --git a/pom.xml b/pom.xml index e2121c3c2..3ed2054f8 100644 --- a/pom.xml +++ b/pom.xml @@ -321,6 +321,11 @@ + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + org.codehaus.mojo versions-maven-plugin @@ -382,7 +387,7 @@ -