Skip to content

Manual installation

It is recommended to run PostgreSQL and Wildfly on different machines. This how-to is for a simple setup with one PostgreSQL server and one Wildfly server. It does not cover more advanced use cases such as backups, replication, geo-redundancy, general maintenance, etc.

Prerequisites

  • Two machines (VM or bare metal) with ssh access and sudo privileges
  • Connectivity between the machines for Wildfly <-> PostgreSQL (5432)

After installation the following will be running. Note that storage might be better served through a SAN instead.

architecture-beta
    group wf(server)[Wildfly host]
    service wildfly(server)[Wildfly] in wf
    service disk2(disk)[Storage] in wf
    disk2:T -- B:wildfly

    group postgres(server)[PostgreSQL host]
    service db(database)[Database] in postgres
    service disk1(disk)[Storage] in postgres
    disk1:T -- B:db

    db:L -- R:wildfly

PostgreSQL server

Versions:

  • PostgreSQL 12
  • Postgis 2.5.3
Install PostgreSQL with extensions
sudo zypper in postgresql-devel
sudo zypper in gcc
sudo zypper in gcc-c++
sudo zypper in autoconf
sudo zypper in automake
sudo zypper in libtool
sudo zypper in libxml2-devel

# Proj4:
sudo zypper install sqlite3
sudo zypper in sqlite3-devel
sudo wget https://download.osgeo.org/proj/proj-6.2.0.tar.gz
sudo tar -xvzf proj-6.2.0.tar.gz
cd proj-6.2.0/
sudo ./configure
sudo make
sudo make check
sudo make install

# GEOS:
sudo wget https://git.osgeo.org/gitea/geos/geos/archive/3.7.3.tar.gz
sudo tar -xvzf 3.7.3.tar.gz
cd geos
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make check
sudo make install

# GDAL:
sudo wget http://download.osgeo.org/gdal/2.4.2/gdal-2.4.2.tar.gz
sudo tar -xvzf gdal-2.4.2.tar.gz
cd gdal-2.4.2
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install

# sudo /sbin/ldconfig

# PostGIS:
sudo wget https://download.osgeo.org/postgis/source/postgis-2.5.3.tar.gz
sudo tar -xvzf postgis-2.5.3.tar.gz
sudo ./configure --with-geosconfig=/usr/local/bin/geos-config --with-gdalconfig=/usr/local/bin/gdal-config
sudo make
sudo make install

sudo /sbin/ldconfig

Warning

Security setup and hardening is not part of this how-to guide. The following steps are focused on what UVMS needs, but does not e.g. set a postgres password, open ports, etc.

With an empty PostgreSQL it's now time to add a new database and the needed schemas and users.

  1. Download setup.sql
  2. Change db71u to a name of your choosing. Make sure to replace all of the occurrences
  3. Change all passwords for the tables (WITH PASSWORD 'XYZ')
  4. Run the SQL script (with psql or a GUI such as pgadmin, dbeaver, etc).

Wildfly server

Basic server setup

UVMS requires Java 11 and has not been tested on newer versions.

On a SLES setup run:

# Install Java 11
sudo zypper install java-11-openjdk-devel

# Add a wildfly user
sudo /usr/sbin/groupadd -r wildfly
sudo /usr/sbin/useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly

# Create folder structure
sudo mkdir -p /opt/wildfly
sudo chown -R wildfly:users /opt/wildfly
sudo mkdir -p /opt/uvms/app/logs
sudo chown -R wildfly:users /opt/uvms
sudo ln -s /opt/uvms/app /app

# Open firewall
sudo firewall-cmd --zone=public --add-port=28080/tcp --permanent
sudo firewall-cmd --zone=public --add-port=5445/tcp --permanent
sudo firewall-cmd --zone=public --add-port=8443/tcp --permanent
sudo firewall-cmd --zone=public --add-port=9990/tcp --permanent
sudo firewall-cmd --reload

# 28080 - wildfly http
# 5445 - jms / activemq
# 8443 - wildfly https
# 9990 - wildfly mgmt console

# Verify with
sudo firewall-cmd --list-all

Wildfly setup

Add default configuration and a systemd service for Wildfly.

Add wildfly conf
sudo tee -a /etc/default/wildfly.conf << 'EOF'
# The configuration you want to run
WILDFLY_CONFIG=standalone-full.xml

# The mode you want to run
WILDFLY_MODE=standalone

# The address to bind to
WILDFLY_BIND=0.0.0.0
EOF
Add launch script
sudo -u wildfly tee -a /opt/wildfly/launch.sh << 'EOF'
#!/bin/sh
if [ "x$WILDFLY_HOME" = "x" ]; then
    WILDFLY_HOME="/opt/wildfly/current"
fi

if [[ "$1" == "domain" ]]; then
    $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $3
else
    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $3
fi
EOF
Make it executable
sudo chmod +x /opt/wildfly/launch.sh
Add systemd service for wildfly
sudo tee -a /etc/systemd/system/wildfly.service << 'EOF'
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target

[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/default/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null

[Install]
WantedBy=multi-user.target
EOF
Enable the service
sudo systemctl enable wildfly
sudo systemctl daemon-reload

Install UVMS components

Prerequisites

  • Basic server setup completed
  • Wildfly setup completed
  • SSH user with sudo privileges (not the wildfly user as it should not have sudo nor login privileges)

Files

The following pom.xml utilizes SSH and SCP through the maven-antrun-plugin for maven to move artifacts and run commands on a target host.

Copy the contents of the three files pom.xml, assembly.xml, and uvms.properties into a folder structure like the following:

Folder structure
.
├── src
   └── main
       ├── assembly
          └── assembly.xml
       └── wf-scripts
           └── uvms.properties
└── pom.xml

Warning

The pom.xml file contains a number of properties that needs setting (look for SET_ME). Some of them are set in the next section through environment variables, and is labeled as OPTIONAL_SET_ME instead. For example scp.target.server.hostname is one that is mandatory to set in pom.xml.

pom.xml
<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>se.havochvatten.unionvms</groupId>
    <artifactId>wildfly-dist</artifactId>
    <version>${unionvms.docker.version}</version>
    <packaging>pom</packaging>

    <properties>
        <unionvms.wildfly.version>26.0.0.Final</unionvms.wildfly.version>
        <unionvms.docker.version>4.3.2</unionvms.docker.version>
        <unionvms.activemq-rar.version>5.16.3</unionvms.activemq-rar.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-dist</artifactId>
            <version>${unionvms.wildfly.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>fish.focus.uvms.docker</groupId>
            <artifactId>uvms-docker-postgres-release</artifactId>
            <version>${unionvms.docker.version}</version>
            <type>zip</type>
            <exclusions>
                <exclusion>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>fish.focus.uvms.docker</groupId>
            <artifactId>uvms-docker-wildfly-base</artifactId>
            <version>${unionvms.docker.version}</version>
            <type>zip</type>
            <exclusions>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-spatial</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.postgis</groupId>
                    <artifactId>postgis-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>fish.focus.uvms.docker</groupId>
            <artifactId>uvms-docker-wildfly-unionvms</artifactId>
            <version>${unionvms.docker.version}</version>
            <type>zip</type>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.ant</groupId>
                            <artifactId>ant-jsch</artifactId>
                            <version>1.10.1</version>
                        </dependency>
                        <dependency>
                            <groupId>com.jcraft</groupId>
                            <artifactId>jsch</artifactId>
                            <version>0.1.54</version>
                        </dependency>
                        <dependency>
                            <groupId>ant-contrib</groupId>
                            <artifactId>ant-contrib</artifactId>
                            <version>1.0b3</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>ant</groupId>
                                    <artifactId>ant</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.liquibase</groupId>
                    <artifactId>liquibase-maven-plugin</artifactId>
                    <version>3.7.0</version>
                    <configuration>
                        <url>jdbc:postgresql://${unionvms.database.host}:5432/${unionvms.database.name}</url>
                        <tag>${unionvms.docker.version}</tag>
                        <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                            <version>42.3.9</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <copyPom>false</copyPom>
                            <outputDirectory>${project.basedir}/target/content</outputDirectory>
                            <excludeTypes>pom</excludeTypes>
                            <prependGroupId>false</prependGroupId>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-ears</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.activemq</groupId>
                                    <artifactId>activemq-rar</artifactId>
                                    <type>rar</type>
                                    <version>${unionvms.activemq-rar.version}</version>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/addons/</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-liquibase</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <tasks>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.asset.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/asset"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.audit.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/audit"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.config.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/config"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.exchange.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/exchange"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.movement-rules.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/movement-rules"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.movement.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/movement"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.reporting.reporting-liquibase.zip"
                                       dest="${project.build.directory}/liquibase/reporting"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.spatial.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/spatial"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.user.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/user"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.incident.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/incident"/>
                                <unzip src="${project.build.directory}/content/uvms-docker-postgres-release/liquibase/fish.focus.uvms.activity.liquibase.zip"
                                       dest="${project.build.directory}/liquibase/activity"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.7.1</version>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                    </descriptors>
                    <finalName>${project.artifactId}-${project.version}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <goals>
                    <goal>deploy-file</goal>
                </goals>
                <configuration>
                    <packaging>zip</packaging>
                    <generatePom>true</generatePom>
                    <artifactId>${project.artifactId}</artifactId>
                    <groupId>${project.groupId}</groupId>
                    <version>${project.version}</version>
                    <file>target/${project.artifactId}-${project.version}.zip</file>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>scp-stop-and-install-server</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>stop-scp</id>
                                <phase>verify</phase>
                                <configuration>
                                    <target>
                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                                                 classpathref="maven.plugin.classpath"/>
                                        <!-- 1. stop wildfly if any-->

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 failonerror="false" command="sudo systemctl stop wildfly.service"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 failonerror="false"
                                                 command="sudo -u wildfly rm ${unionvms.symlink.wildfly}"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 failonerror="false"
                                                 command="sudo -u wildfly rm -rf ${unionvms.install.path}/${project.artifactId}*"/>

                                        <scp file="target/${project.artifactId}-${project.version}.zip"
                                             todir="${scp.target.server.username}:${scp.target.server.password}@${scp.target.server.hostname}:/tmp"
                                             trust="true"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly unzip /tmp/${project.artifactId}-${project.version}.zip -d ${unionvms.install.path}"/>
                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo rm /tmp/${project.artifactId}-${project.version}.zip"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly chmod a+x ${unionvms.install.path}/${project.artifactId}-${project.version}/unionvms-database-scripts/*.sh"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly sed s/db71u/${unionvms.database.name}/g &lt; ${unionvms.install.path}/${project.artifactId}-${project.version}/unionvms-database-scripts/.pgpass &gt; ~/.pgpass; chmod 600 ~/.pgpass"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly sed -i -r s/-Xmx[0-9]\{4\}m/-Xmx12288m/g ${unionvms.install.path}/${project.artifactId}-${project.version}/bin/standalone.conf"/>
                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly sed -i -r s/-XX:MetaspaceSize=[0-9]\{1,4\}[Mm]/-XX:MetaspaceSize=256m/g ${unionvms.install.path}/${project.artifactId}-${project.version}/bin/standalone.conf"/>
                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly sed -i -r s/-XX:MaxMetaspaceSize=[0-9]\{1,4\}[Mm]/-XX:MaxMetaspaceSize=2048m/g ${unionvms.install.path}/${project.artifactId}-${project.version}/bin/standalone.conf"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly ln -s ${unionvms.install.path}/${project.artifactId}-${project.version} ${unionvms.symlink.wildfly}"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly ${unionvms.symlink.wildfly}/bin/add-user.sh -u '${wildfly.mgmt.console.username}' -p '${wildfly.mgmt.console.password}'"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly ${unionvms.symlink.wildfly}/bin/jboss-cli.sh --file=${unionvms.symlink.wildfly}/cli-scripts/uvms_configuration.cli --properties=${unionvms.symlink.wildfly}/cli-scripts/uvms.properties"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly ${unionvms.symlink.wildfly}/bin/jboss-cli.sh --file=${unionvms.symlink.wildfly}/cli-scripts/uvms_datasources.cli --properties=${unionvms.symlink.wildfly}/cli-scripts/uvms.properties"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo -u wildfly ${unionvms.symlink.wildfly}/bin/jboss-cli.sh --file=${unionvms.symlink.wildfly}/cli-scripts/uvms_messaging.cli --properties=${unionvms.symlink.wildfly}/cli-scripts/uvms.properties"/>

                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>scp-start-server</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>scp-start</id>
                                <phase>verify</phase>
                                <configuration>
                                    <target>
                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                                                 classpathref="maven.plugin.classpath"/>

                                        <sshexec host="${scp.target.server.hostname}"
                                                 username="${scp.target.server.username}"
                                                 password="${scp.target.server.password}" trust="true"
                                                 command="sudo systemctl start wildfly.service"/>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>prod-server</id>
            <properties>
                <scp.target.server.hostname>SET_ME</scp.target.server.hostname>
                <scp.target.server.username>OPTIONAL_SET_ME</scp.target.server.username>
                <scp.target.server.password>OPTIONAL_SET_ME</scp.target.server.password>

                <unionvms.install.path>/opt/wildfly</unionvms.install.path>
                <unionvms.symlink.wildfly>/opt/wildfly/current</unionvms.symlink.wildfly>

                <unionvms.database.name>SET_ME</unionvms.database.name>
                <unionvms.database.host>SET_ME</unionvms.database.host>

                <unionvms.database.username>OPTIONAL_SET_ME</unionvms.database.username>
                <unionvms.database.password>OPTIONAL_SET_ME</unionvms.database.password>

                <unionvms.database.asset.password>OPTIONAL_SET_ME</unionvms.database.asset.password>
                <unionvms.database.audit.password>OPTIONAL_SET_ME</unionvms.database.audit.password>
                <unionvms.database.config.password>OPTIONAL_SET_ME</unionvms.database.config.password>
                <unionvms.database.movement.password>OPTIONAL_SET_ME</unionvms.database.movement.password>
                <unionvms.database.movement.rules.password>OPTIONAL_SET_ME</unionvms.database.movement.rules.password>
                <unionvms.database.exchange.password>OPTIONAL_SET_ME</unionvms.database.exchange.password>
                <unionvms.database.reporting.password>OPTIONAL_SET_ME</unionvms.database.reporting.password>
                <unionvms.database.spatial.password>OPTIONAL_SET_ME</unionvms.database.spatial.password>
                <unionvms.database.usm.password>OPTIONAL_SET_ME</unionvms.database.usm.password>
                <unionvms.database.incident.password>OPTIONAL_SET_ME</unionvms.database.incident.password>
                <unionvms.database.activity.password>OPTIONAL_SET_ME</unionvms.database.activity.password>

                <wildfly.mgmt.console.username>admin</wildfly.mgmt.console.username>
                <wildfly.mgmt.console.password>OPTIONAL_SET_ME</wildfly.mgmt.console.password>

                <unionvms.usm.secret.key>OPTIONAL_SET_ME</unionvms.usm.secret.key>
            </properties>
        </profile>
    </profiles>
</project>
assembly.xml
<assembly>
    <id>unionvmswildflydist</id>
    <formats>
        <format>zip</format>
    </formats>
    <fileSets>
        <fileSet>
            <directory>target/content/wildfly-${unionvms.wildfly.version}/</directory>
            <includes>
                <include>**/*.*</include>
            </includes>
            <excludes>
                <exclude>modules/system/layers/base/org/hibernate/main/*.xml
                </exclude>
                <exclude>modules/system/layers/base/org/apache/activemq/artemis/**/*.xml</exclude>
                <exclude>modules/system/layers/base/org/apache/activemq/artemis/**/artemis-*.jar</exclude>
                <exclude>modules/org/postgresql/main/**/*.*</exclude>
                <exclude>bin/standalone.conf</exclude>
            </excludes>
            <outputDirectory></outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/wildfly-${unionvms.wildfly.version}/</directory>
            <includes>
                <include>**/logging.properties</include>
            </includes>
            <outputDirectory></outputDirectory>
        </fileSet>

        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/</directory>
            <includes>
                <include>*.properties</include>
                <include>server.keystore</include>
                <include>client.truststore</include>
            </includes>
            <outputDirectory>standalone/configuration</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/</directory>
            <includes>
                <include>standalone.conf</include>
            </includes>
            <outputDirectory>bin</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>src/main/assembly/wildfly/bin/init.d</directory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
            <outputDirectory>bin/init.d</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/cli-scripts/
            </directory>
            <includes>
                <include>*.*</include>
            </includes>
            <outputDirectory>cli-scripts</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/hibernate/
            </directory>
            <includes>
                <include>*.*</include>
            </includes>
            <outputDirectory>modules/system/layers/base/org/hibernate/main
            </outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/artemis/
            </directory>
            <includes>
                <include>**/*.*</include>
            </includes>
            <outputDirectory>modules/system/layers/base/org/apache/activemq/artemis</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-base/postgres/
            </directory>
            <includes>
                <include>*.*</include>
            </includes>
            <outputDirectory>modules/org/postgresql/main</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/content/uvms-docker-wildfly-unionvms/deployments/
            </directory>
            <includes>
                <include>*.*</include>
            </includes>
            <outputDirectory>standalone/deployments</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>target/addons/</directory>
            <includes>
                <include>*.*</include>
            </includes>
            <outputDirectory>standalone/deployments</outputDirectory>
        </fileSet>

        <fileSet>
            <directory>target/content/uvms-docker-postgres-release/</directory>
            <includes>
                <include>**/*.*</include>
            </includes>
            <excludes>
                <exclude>liquibase/*.*</exclude>
            </excludes>
            <outputDirectory>unionvms-database-scripts</outputDirectory>
        </fileSet>
    </fileSets>
    <files>
        <file>
            <source>src/main/wf-scripts/uvms.properties</source>
            <outputDirectory>cli-scripts</outputDirectory>
            <filtered>true</filtered>
        </file>
    </files>
</assembly>
uvms.properties
SERVER_CONFIG=standalone-full.xml
# System properties
usm_secretkey="${unionvms.usm.secret.key}"
# Naming
asset_endpoint=http://localhost:8080/unionvms/asset/rest
spatial_endpoint=http://localhost:8080/unionvms/spatial
movementrules_endpoint=http://localhost:8080/unionvms/movement-rules/rest
exchange_endpoint=http://localhost:8080/unionvms/exchange/rest
movement_endpoint=http://localhost:8080/unionvms/movement/rest
user_endpoint=http://localhost:8080/unionvms/user/rest
incident_endpoint=http://localhost:8080/unionvms/incident/rest
cors_allowed_host_regex=.*
# Datasource passwords
db_password_audit=${unionvms.database.audit.password}
db_password_movement=${unionvms.database.movement.password}
db_password_asset=${unionvms.database.asset.password}
db_password_exchange=${unionvms.database.exchange.password}
db_password_usm=${unionvms.database.usm.password}
db_password_spatial=${unionvms.database.spatial.password}
db_password_reporting=${unionvms.database.reporting.password}
db_password_movementrules=${unionvms.database.movement.rules.password}
db_password_incident=${unionvms.database.incident.password}
db_password_config=${unionvms.database.config.password}
db_password_activity=${unionvms.database.activity.password}

Install and Start

The following commands utilizes the pom.xml file above. There are a number of parameters that can either be set through environment variables or changed directly in pom.xml. The following examples opts for an environment variable approach since that lends itself for automation (think CI).

Environment variables
tee -a uvms_environment_variables << 'EOF'
export MAVEN_PROFILE_ENVIRONMENT=prod-server
export UMVS_VERSION=SET_ME

export UVMS_USM_SECRET_KEY=SET_ME

# ssh credentials
export SERVER_USERNAME=SET_ME
export SERVER_PASSWORD=SET_ME

# PostgreSQL (default: postgres/postgres)
export DB_USERNAME=SET_ME
export DB_PASSWORD=SET_ME

# Wildfly management
export WF_MGMT_USERNAME=SET_ME
export WF_MGMT_PASSWORD=SET_ME

# username / password for the PostgreSQL schemas
# Match with what was set in the PostgreSQL setup
export ASSET_PASSWORD=SET_ME
export AUDIT_PASSWORD=SET_ME
export CONFIG_PASSWORD=SET_ME
export MOVEMENT_PASSWORD=SET_ME
export MOVEMENT_RULES_PASSWORD=SET_ME
export EXCHANGE_PASSWORD=SET_ME
export REPORTING_PASSWORD=SET_ME
export SPATIAL_PASSWORD=SET_ME
export USM_PASSWORD=SET_ME
export INCIDENT_PASSWORD=SET_ME
export ACTIVITY_PASSWORD=SET_ME
EOF

source uvms_environment_variables
Stop old instance and install
mvn verify \
    -Pscp-stop-and-install-server,$MAVEN_PROFILE_ENVIRONMENT \
    -Dunionvms.docker.version=$UMVS_VERSION \
    -Dscp.target.server.username=$SERVER_USERNAME \
    -Dscp.target.server.password=$SERVER_PASSWORD \
    -Dunionvms.database.username=$DB_USERNAME \
    -Dunionvms.database.password=$DB_PASSWORD \
    -Dunionvms.database.asset.password=$ASSET_PASSWORD \
    -Dunionvms.database.audit.password=$AUDIT_PASSWORD \
    -Dunionvms.database.config.password=$CONFIG_PASSWORD \
    -Dunionvms.database.movement.password=$MOVEMENT_PASSWORD \
    -Dunionvms.database.movement.rules.password=$MOVEMENT_RULES_PASSWORD \
    -Dunionvms.database.exchange.password=$EXCHANGE_PASSWORD \
    -Dunionvms.database.reporting.password=$REPORTING_PASSWORD \
    -Dunionvms.database.spatial.password=$SPATIAL_PASSWORD \
    -Dunionvms.database.usm.password=$USM_PASSWORD \
    -Dunionvms.database.incident.password=$INCIDENT_PASSWORD \
    -Dunionvms.database.activity.password=$ACTIVITY_PASSWORD \
    -Dwildfly.mgmt.console.username=$WF_MGMT_USERNAME \
    -Dwildfly.mgmt.console.password=$WF_MGMT_PASSWORD \
    -Dunionvms.usm.secret.key=$UVMS_USM_SECRET_KEY \
    -U
Update/Create database schema with Liquibase
mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/asset/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=asset \
    -Dliquibase.username=asset \
    -Dliquibase.password=$ASSET_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/audit/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=audit \
    -Dliquibase.username=audit \
    -Dliquibase.password=$AUDIT_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/config/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=config \
    -Dliquibase.username=config \
    -Dliquibase.password=$CONFIG_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/movement/liquibase/changelog/db-changelog-master-postgres.xml \
    -Dliquibase.defaultSchemaName=movement \
    -Dliquibase.username=movement \
    -Dliquibase.password=$MOVEMENT_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/movement-rules/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=movementrules \
    -Dliquibase.username=movementrules \
    -Dliquibase.password=$MOVEMENT_RULES_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/exchange/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=exchange \
    -Dliquibase.username=exchange \
    -Dliquibase.password=$EXCHANGE_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/reporting/reporting-liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=reporting \
    -Dliquibase.username=reporting \
    -Dliquibase.password=$REPORTING_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/spatial/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=spatial \
    -Dliquibase.username=spatial \
    -Dliquibase.password=$SPATIAL_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/user/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=usm \
    -Dliquibase.username=usm \
    -Dliquibase.password=$USM_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/incident/liquibase/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=incident \
    -Dliquibase.username=incident \
    -Dliquibase.password=$INCIDENT_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT

mvn liquibase:update \
    -Dliquibase.changeLogFile=target/liquibase/activity/liquibase/postgres/changelog/db-changelog-master.xml \
    -Dliquibase.defaultSchemaName=activity \
    -Dliquibase.username=activity \
    -Dliquibase.password=$ACTIVITY_PASSWORD \
    -P$MAVEN_PROFILE_ENVIRONMENT
Start wildfly
mvn clean install -Pscp-start-server,$MAVEN_PROFILE_ENVIRONMENT -Dscp.target.server.username=$SERVER_USERNAME -Dscp.target.server.password=$SERVER_PASSWORD -U