Configuring Identity Portal on Wildfly as an RH Linux Service.
Ensure wildfly-portal folder is owned by wildfly user. If not, then set ownership.
# chown -RH wildfly:root /opt/CA/wildfly-portal/
Login as root
$ sudo su -
Create a directory 'wildfly-portal' at /etc which will hold the WildFly configuration file:
# mkdir -p /etc/wildfly-portal
Copy the configuration file 'wildfly.conf' to the /etc/wildfly-portal directory:
# cp -p /opt/CA/wildfly-portal/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly-portal/
Next copy the WildFly 'launch.sh' from /opt/CA/wildfly-portal/docs/contrib/scripts/systemd/ to the /opt/CA/wildfly-portal/bin/ directory as launch-portal.sh:
# cp -p /opt/CA/wildfly-portal/docs/contrib/scripts/systemd/launch.sh /opt/CA/wildfly-portal/bin/launch-portal.sh
Modify launch-portal.sh for WILDFLY_HOME
# vi /opt/CA/wildfly-portal/bin/launch-portal.sh
Before edit file will look like...
#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/opt/wildfly"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
fi
After edit file will look like...
#!/bin/bash
if [ "x$WILDFLY_HOME" = "x" ]; then
WILDFLY_HOME="/opt/CA/wildfly-portal"
fi
if [[ "$1" == "domain" ]]; then
$WILDFLY_HOME/bin/domain.sh -c $2 -b $3
else
$WILDFLY_HOME/bin/standalone.sh -c $2 -b $3
fi
Save and exit file launch.sh (ESC Shift : wq! Enter)
Copy the systemd unit file 'wildfly.service' from /opt/CA/wildfly-portal/docs/contrib/scripts/systemd/ to the /etc/systemd/system/ directory as 'wildfly-portal.service' :
# cp -p /opt/CA/wildfly-portal/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/wildfly-portal.service
Modify the 'wildfly-portal.service' file at /etc/systemd/system/ folder. Provide values for EnvironmentFile & ExecStart
Before edit file will look like...
[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
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null
[Install]
WantedBy=multi-user.target
After edit file will look like...
[Unit]
Description=The wildfly-portal Application Server
After=syslog.target network.target
Before=httpd.service
[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/wildfly-portal/wildfly.conf
User=wildfly
LimitNOFILE=102642
PIDFile=/var/run/wildfly/wildfly.pid
ExecStart=/opt/CA/wildfly-portal/bin/launch-portal.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND
StandardOutput=null
[Install]
WantedBy=multi-user.target
Save and exit file wildfly-portal.service (ESC Shift : wq! Enter)
Notify systemd that we created a new unit file:
# systemctl daemon-reload
Start Wildfly-portal service
# systemctl start wildfly-portal
Enable wildfly-portal service for start on boot
# systemctl enable wildfly-portal
Check status of wildfly-portal service
# systemctl status wildfly-portal