3DS Server
Application Topology
The following topology shows an example topology with Apache Http Server at the Web layer and JBoss at the App layer.
Java Installation
Java is downloaded using the wget command.
$ cd /tmp && wget https://download.oracle.com/otn/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz
$ mkdir /usr/java
$ tar -xzvf jdk-8u171-linux-x64.tar.gz –-directory=/usr/java/.
$ sudo update-alternatives –install /usr/bin/java java /usr/java/jdk1.8.0_171/bin/java 1200
$ sudo update-alternatives –install /usr/bin/javac javac /usr/java/jdk1.8.0_171/bin/javac 1200
$ update-alternatives --display java
$ update-alternatives --display javac
$ java -version
Apache Http Server Installation and mod_jk Configuration
Apache and MOD_JK installations should be done on the server.
sudo apt update
sudo apt install apache2
sudo systemctl status apache2
wget https://dlcdn.apache.org/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz
sudo apt install apache2-dev
sudo a2enmod headers
tar xvf tomcat-connectors-1.2.48-src.tar.gz
cd tomcat-connectors-1.2.48-src/native/
./configure -with-apxs=/usr/bin/apxs
which apxs
make
sudo cp mod_jk.so /usr/lib/apache2/modules/
After the installations are done, the mods_jk.conf file should be created under the /etc/apache2/mods-enabled directory as in the example below.
LoadModule jk_module "/usr/lib/apache2/modules/mod_jk.so"
JkWorkersFile /etc/apache2/conf-enabled/workers.properties
#JkShmFile /etc/apache2/logs/mod_jk.shm
JkLogFile /etc/apache2/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +forwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
The workers.properties file should be created under the /etc/apache2/conf-enabled directory as in the following example.
worker.list=tds,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=${PORT}
worker.node1.host=${IP}
worker.node1.type=ajp13
worker.node1.ping_mode=A
worker.node1.lbfactor=1
worker.node1.lbfactor=1
# Load-balancing behavior
worker.tds.type=lb
worker.tds.balance_workers=node1
worker.tds.sticky_session=1
In the standalone.xml file of the relevant application, the ${PORT} information should be updated for the following parameter
<socket-binding name="ajp" port="${jboss.ajp.port:${PORT}}"/>
Apache SSL Connection Configuration
Apache SSL mode must be ENABLED and the sites-available/test.conf file must be edited as follows. Syntax can be checked with the command "sudo apache2ctl configtest".
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName _
SSLEngine on
SSLCertificateFile {fullchain.pem_path}
SSLCertificateKeyFile {privkey.pem_path}
SSLProtocol ALL -SSLv2 -SSLv3
SSLVerifyClient none
SSLVerifyDepth 1
SSLHonorCipherOrder On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
JkMount /tds/* tds
JkMount /tds tds
#JkUnMount /error/* tomcat_1
</VirtualHost>
Wildfly Installation
Ubuntu Installation
sudo apt update -y
sudo apt upgrade -y
cd /3ds2apps && sudo wget https://github.com/wildfly/wildfly/releases/download/26.1.2.Final/wildfly-26.1.2.Final.tar.gz
sudo tar -xzvf wildfly-26.1.2.Final.tar.gz
sudo mv wildfly-26.1.2.Final /3ds2apps/wildfly
sudo groupadd wildfly
sudo useradd -r -g wildfly -d /3ds2apps/wildfly -s /sbin/nologin wildfly
sudo mkdir -p /etc/wildfly
sudo cp /3ds2apps/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
sudo cp /3ds2apps/wildfly/docs/contrib/scripts/systemd/launch.sh /3ds2apps/wildfly/bin/
sudo chown wildfly: /3ds2apps/bin/launch.sh
sudo cp /3ds2apps/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
The Wildfly service is created.
sudo nano /etc/systemd/system/wildfly.service
[Unit]
Description=The WildFly Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
Group=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/3ds2apps/wildfly/standalone/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_MANAGEMENT_CONSOLE_BIND
StandardOutput=null
[Install]
WantedBy=multi-user.target
The wildfly.conf file is created.
sudo nano /etc/wildfly/wildfly.conf
# The configuration you want to run
WILDFLY_CONFIG=standalone.xml
# The mode you want to run
WILDFLY_MODE=standalone
# The address to bind to
WILDFLY_BIND=0.0.0.0
WILDFLY_MANAGEMENT_CONSOLE_BIND=0.0.0.0
launch.sh file is created.
sudo nano /3ds2apps/wildfly/bin/launch.sh
#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/3ds2apps/wildfly"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4
fi
After the changes, the service is "enable" and "started".
sudo systemctl daemon-reload
sudo systemctl enable wildfly
sudo systemctl start wildfly
sudo systemctl status wildfly
If the management gui is to be used, the user is added.
sudo /opt/wildfly/bin/add-user.sh
sudo systemctl restart wildfly
Tomcat Installation
Tomcat is downloaded using the wget command.
$ cd /tmp
$ wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.73/bin/apache-tomcat-9.0.73.tar.gz
$ sudo tar xzvf apache-tomcat-9.0.73.tar.gz -C /3ds2apps/tomcat9 --strip-components=1
$ sudo chown -R tomcat:tomcat /3ds2apps/tomcat/
$ sudo useradd -m -d /3ds2apps/tomcat9 -U -s /bin/false tomcat
$ sudo chmod -R u+x /3ds2apps/tomcat/bin
A Linux service is created for Tomcat.
$ sudo nano /etc/systemd/system/tomcat.service
WantedBy=multi-user.target
[Unit]
Description=Tomcat
After=network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
Environment="JAVA_HOME=/usr/java/jdk1.8.0_171"
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_BASE=/3ds2apps/tomcat"
Environment="CATALINA_HOME=/3ds2apps/tomcat"
Environment="CATALINA_PID=/3ds2apps/tomcat/temp/tomcat.pid"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
ExecStart=/3ds2apps/tomcat/bin/startup.sh
ExecStop=/3ds2apps/tomcat/bin/shutdown.sh
RestartSec=10
Restart=always
[Install]
$ sudo systemctl daemon-reload
$ sudo systemctl start tomcat
$ sudo systemctl status tomcat
$ sudo systemctl enable tomcat
Database Creation - Oracle
The 19C version of Oracle Database is installed on the relevant database server.
setup.sql is used to create a schema.
Application-specific tables and the necessary data in these tables are created by running the following scripts respectively.
01-V1_0_0_0__core_ddl.sql
02-V1_0_0_1__core_dml.sql
03-V1_0_1_1__core_ddl.sql
04-V1_0_2_0__core_dml.sql
05-V1_0_3_0__core_dml.sql
06-V1_0_3_1__core_ddl.sql
07-V1_0_4_0__core_ddl.sql
08-V1_0_5_0__core_dml.sql
09-V1_0_5_1__core_ddl.sql
10-V1_0_6_1__core_ddl.sql
11-V1_0_8_0__core_ddl.sql
12-V1_0_9_3__core_ddl.sql
Database Creation - PostgreSQL
PostgreSQL version 14.3 is installed on the relevant database server.
setup.sql is used to create a schema.
Application-specific tables and the necessary data in these tables are created by running the following scripts respectively.
01-V1_0_0_0__core_ddl.sql
02-V1_0_0_1__core_dml.sql
03-V1_0_1_1__core_ddl.sql
04-V1_0_2_0__core_dml.sql
05-V1_0_3_0__core_dml.sql
06-V1_0_3_1__core_ddl.sql
07-V1_0_4_0__core_ddl.sql
08-V1_0_5_0__core_dml.sql
09-V1_0_5_1__core_ddl.sql
10-V1_0_6_1__core_ddl.sql
11-V1_0_8_0__core_ddl.sql
12-V1_0_9_3__core_ddl.sql
App Installation - Wildfly
The application works with Java 8.
Wildfly Multi Instance Configuration
If you want to run more than one wildfly instance on a single server, the setting should be made as follows.
For example, if you want to run the 3DS Server application as a separate instance:
sudo mkdir -p /3ds2apps/wildfly/instance/tds
sudo cp -a standalone instance/tds
sudo chown -R wildfly:wildfly instance/
In standalone.xml, the management gui and the ports of the application are set.
A linux service is created for the 3DS Server application:
sudo nano tds.service
[Unit]
Description=TDS Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/3ds2apps/wildfly/instance/tds/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_MANAGEMENT_CONSOLE_BIND
StandardOutput=null
[Install]
WantedBy=multi-user.target
launch.sh is created for 3DS Server.
sudo nano /3ds2apps/wildfly/instance/tds/launch.sh
#!/bin/bash
# The configuration you want to run
export JbossNodeName=tds
export JbossBaseDir=instance/$JbossNodeName
export JbossLogDir=/3ds2apps/wildfly/instance/tds/log
export JbossConfigDir=/3ds2apps/wildfly/instance/tds/configuration
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/opt/wildfly"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4 -Djboss.node.name=$JbossNodeName -Djboss.server.base.dir=$JbossBaseDir -Djboss.server.log.dir=$JbossLogDir -Djboss.server.config.dir=$JbossConfigDir
fi
After the changes, the service is "enable" and "started".
sudo systemctl daemon-reload
sudo systemctl enable tds.service
sudo systemctl start tds.service
If you want to run applications with different java versions, /3ds2apps/wildfly/bin/standalone.conf should also be edited.
sudo nano /3ds2apps/wildfly/bin/standalone.conf
if [ "$JbossNodeName" = "tds" ]; then
JAVA_HOME="/usr/java/jdk1.8.0_171"
Datasource Configuration
This section describes the Datasource configuration that the application will use.
OJDBC Jar Module
The Oracle Driver Jar file is downloaded.
wget
https://download.oracle.com/otn-pub/otn_software/jdbc/1917/ojdbc8.jar
/modules/system/layers/base/com/oracle/main/ file is created and the jar file is copied.
The following file is created in /modules/system/layers/base/com/oracle/main/.
module.xml
<module xmlns="urn:jboss:module:1.1" name="oracle.jdbc">
<resources>
<resource-root path="ojdbc[VERSION].jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Jboss JNDI Datasource
Data Source is configured within the standalone.xml.
standalone.xml
...
<subsystem xmlns="urn:jboss:domain:datasources:7.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/{datasource-name}" pool-name="OracleDS" enabled="true"
use-java-context="true"
statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>{db-url}</connection-url>
<driver>oracle</driver>
<security>
<user-name>{db-username}</user-name>
<password>{db-password}</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="oracle.jdbc">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
...
The following is added to standalone.xml
<subsystem xmlns="urn:jboss:domain:ee:6.0">
...
<global-modules>
<module name="oracle.jdbc" slot="main"/>
</global-modules>
...
<default-bindings context-service="java:jboss/ee/concurrency/context/default"
datasource="java:jboss/datasources/{datasource-name}"
managed-executor-service="java:jboss/ee/concurrency/executor/default"
managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default"
managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
...
</subsystem>
Port ve Protocol Configuration
The application will communicate with the ajp protocol. To activate ajp protocol, the following is added to standalone.xml
…
<subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
…
<server name="default-server">
<ajp-listener name="ajp" socket-binding="ajp" max-post-size="1048576000"/>
…
</server>
…
</subsystem>
…
Port/protocol configuration is done within standalone.xml
...
<socket-binding-group name="standard-sockets" default-interface="public"
port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="ajp" port="[port]"/>
...
</socket-binding-group>
...
Uploading the war file
The war file must be uploaded to the /deployments directory.
Uploading the JKS file
The provided jks files must be uploaded to the /3ds2apps/conf/keystore directory.
Application Parameter Configuration
Application parameters must be passed during application execution.
This can be done by either;
Adding JAVA_OPTS="-Dkey1=value1 -Dkey2=value2 ..." to "standalone.sh"
By passing as parameter during the standalone.sh call; sh standalone.sh -Dkey1=value1 -Dkey2=value2
-Dtds.instanceId=1
-DtdsLogFilePath={tdsLogFilePath} -DtdsLogLevel=INFO -DtdsLogLevelSpring=INFO
-DtdsLogMaxHistory=90 -DdatasourceType=jboss
-DdatasourceName=3DSServerOracleDS -Djava.net.preferIPv4Stack=true
-Dhttps.protocols=TLSv1.2,TLSv1.1
It can be defined as system parameters in the "system-properties" section in "standalone.xml".
...
<system-properties>
<property name="tds.instanceId" value="1"/>
<property name="tdsLogFilePath" value="{tdsLogFilePath}"/>
<property name="tdsLogLevel" value="INFO"/>
<property name="tdsLogLevelSpring" value="INFO"/>
<property name="tdsLogMaxHistory" value="90"/>
<property name="datasourceType" value="jboss"/>
<property name="datasourceName" value="3DSServerOracleDS"/>
<property name="java.net.preferIPv4Stack" value="true"/>
<property name="https.protocols" value="TLSv1.2,TLSv1.1"/>
</system-properties>
…
App Installation - Tomcat
The application works with Java 8.
Tomcat Multi Instance Configuration
If you want to run more than one tomcat instance on a single server, the setting should be made as follows.
For example, if you want to run the 3DS Server application as a separate instance
$ sudo mkdir -p /3ds2apps/tomcat9/instance/tds
$ sudo cp -a conf instance/tds
$ sudo chown -R tomcat:tomcat instance/
A linux service is created for the 3DS Server application:
$ sudo nano tds.service
[Unit]
Description=TDS Tomcat Service
[Service]
Type=forking
ExecStart=/3ds2apps/tomcat9/instance/tds/scripts/startup.sh
ExecStop=/3ds2apps/script/killTomcatInstance.sh tds
[Install]
WantedBy=multi-user.target
startup.sh is created.
$ sudo nano /3ds2apps/tomcat9/instance/tds/scripts/startup.sh
#!/bin/sh -
instanceName=tds
export JAVA_OPTS="
-Dcatalina.home=/3ds2apps/tomcat9
-Dcatalina.base=/3ds2apps/tomcat9/instance/$instanceName
-Djava.io.tmpdir=/3ds2apps/tomcat9/temp
-Djava.util.logging.config.file=/3ds2apps/tomcat9/instance/$instanceName/conf/logging.properties
-DtdsLogFilePath=/3ds2apps/logs/tomcat9/$instanceName
-DtdsLogLevel=DEBUG
-DtdsLogLevelSpring=ERROR
-DtdsLogMaxHistory=180 "
export CATALINA_HOME="/3ds2apps/tomcat9"
export CATALINA_BASE="/3ds2apps/tomcat9/instance/$instanceName"
export JAVA_HOME="/usr/java/jdk1.8.0_171"
/3ds2apps/tomcat9/bin/catalina.sh start
After the changes, the service is "enable" and "started".
$ sudo systemctl daemon-reload
$ sudo systemctl enable tds.service
$ sudo systemctl start tds.service
If you want to run applications with different java versions, /3ds2apps/tomcat9/instance/acs/scripts/startup.sh should be edited.
$ sudo nano /3ds2apps/tomcat9/instance/tds/scripts/startup.sh
Export JAVA_HOME="/usr/java/jdk1.8.0_171"
Tomcat Datasource
Data Source is configured within context.xml
context.xml
...
<Context>
...
<Resource name="jdbc/tdsDataSource"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="{db-url}"
username="{db-name}"
password="{db-pass}"
maxTotal="20"
maxIdle="10"
maxWaitMillis="-1"/>
<Parameter name="scm.vault.path" value="{scm-vault-path}" override="false"/>
<Parameter name="tds.instanceId" value="1" override="false"/>
<Parameter name="spring.profiles.active" value="default" override="false"/>
<Parameter name="datasourceType" value="tomcat" override="false"/>
<Parameter name="tds.serverBuildwww" value="2.0.1" override="false" />
<Parameter name="db.type" value="postgresql" override="false"/>
...
</Context>
Port ve Protocol Configuration
The application will communicate with the ajp protocol. To activate ajp protocol, the following is added to server.xml
...
<Service name="Catalina">
...
<Connector port="{app-port}" address="0.0.0.0" protocol="AJP/1.3" secretRequired="false" redirectPort="8443" packetSize="65536" />
...
</Service>
Uploading the war file
The war file must be uploaded to the /webapps directory.
Uploading the JKS file
The provided jks files must be uploaded to the /3ds2apps/conf/keystore directory.
Application Parameter Configuration
Application parameters must be passed during application execution.
This can be done by either;
Adding JAVA_OPTS="-Dkey1=value1 -Dkey2=value2 ..." to startup.sh
By passing as parameter during the startup.sh call; sh standalone.sh -Dkey1=value1 -Dkey2=value2
It can be defined as system parameters in "context.xml".
...
<Parameter name="tds.instanceId" value="1" override="false"/>
<Parameter name="spring.profiles.active" value="default" override="false"/>
<Parameter name="datasourceType" value="tomcat" override="false"/>
<Parameter name="tds.serverBuildwww" value="2.0.1" override="false" />
<Parameter name="db.type" value="postgresql" override="false"/>
<Parameter name="tdsLogFilePath" value="{tdsLogFilePath}" override="false"/>
<Parameter name="tdsLogLevel" value="INFO" override="false"/>
<Parameter name="tdsLogLevelSpring" value="INFO" override="false"/>
<Parameter name="tdsLogMaxHistory" value="90" override="false"/>
...
Last updated