# add postgres jdbc driver
module add --name=postgres --dependencies=javax.api,javax.transaction.api --resources=wfly-ds/postgresql-42.7.10.jar
/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=postgres,driver-class-name=org.postgresql.Driver)
# create mail session
/subsystem=mail/mail-session="casimail":add(jndi-name="java:/casimail",from="Urbanity")
# create outbound socket
socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mail-smtp-casi/:add(host=smtp.gmail.com,port=465)
# Add Email Sender
/subsystem=mail/mail-session=casimail/server=smtp:add(outbound-socket-binding-ref=mail-smtp-casi, username="sender@core-app.com", password="pujrzongsqfxxswg", outbound-socket-binding-ref="mail-smtp-casi", tls=true)
# set http-listener proxy-address-forwarding to true
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding,value=true)
# undefine redirect socket on http-listener
/subsystem=undertow/server=default-server/http-listener=default:undefine-attribute(name=redirect-socket)
Sample systemd unit file to manage wildfly
Unit]
Description=WildFly Application Server
After=syslog.target network.target
[Service]
# The user and group that will run the WildFly service
User=wildfly
Group=wildfly
# Location of the WildFly installation
Environment="WILDFLY_HOME=/opt/wildfly"
# set the memory options for the java vm
Environment="JAVA_OPTS=-Xms1024m -Xmx4096m "
# Load additional configuration from /etc/sysconfig/wildfly (optional)
# This file can contain settings like WILDFLY_MODE, WILDFLY_CONFIG, WILDFLY_BIND, etc.
#EnvironmentFile=/etc/default/wildfly.conf
# Set an environment variable to launch JBoss in the background
Environment="LAUNCH_JBOSS_IN_BACKGROUND=1"
# The command to start the service
# It uses a launch script provided by WildFly to handle various configurations
#ExecStart=/bin/sh -c '${WILDFLY_HOME}/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND'
ExecStart=/bin/sh -c '${WILDFLY_HOME}/bin/standalone.sh -c standalone.xml -b 172.31.43.22 -Djboss.server.base.dir=./standalone-coresystems -Djboss.server.name=coresystems -Djboss.socket.binding.port-offset=200 -Djboss.bind.address.management=172.31.43.22'
# Ensure the service restarts if it fails
Restart=always
# Delay between restarts
RestartSec=10
# Increase the file descriptor limit
LimitNOFILE=102642
# Set a timeout for service startup
TimeoutSec=600
[Install]
# Specifies the target that should start this service (usually multi-user.target for server systems)
WantedBy=multi-user.target