Customize WildFly Startup Wrapper

From NovaOrdis Knowledge Base
Revision as of 07:53, 16 February 2016 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

Overview

This procedure is used in both System V and systemd situations, as both setups use the same wrapper scripts. For context, see Start WildFly as a System V Service on Linux and [[]].

Configure the Startup Script from init.d

Add at the top of the file:

JBOSS_HOME=/home/eap/EAP-6.4.0
JBOSS_USER=eap
#
# The amount of time to wait for startup
#
STARTUP_WAIT=30
#
# The amount of time to wait for shutdown
#
SHUTDOWN_WAIT=30
#
# Location to keep the console log
#
JBOSS_CONSOLE_LOG=${JBOSS_HOME}/domain/log/console.log
[ ! -d ${JBOSS_HOME}/domain/log ] && { mkdir -p ${JBOSS_HOME}/domain/log; chown ${JBOSS_USER} ${JBOSS_HOME}/domain/log; chmod a+rx ${JBOSS_HOME}/domain/log; }

Domain Controller High Availability Considerations

If you're building a host controller that is expected to fail over among multiple HA domain controllers, increase the STARTUP_WAIT (see HA Domain Controller Failover Process for details).

Backup Domain Controller Considerations

If you're building a backup domain controller you will need to add this into jboss-host-controller}:

JBOSS_BACKUP_DOMAIN_CONTROLLER=true

and then add this to the start line:

  ...
  local backup_option
  ${JBOSS_BACKUP_DOMAIN_CONTROLLER} && backup_option="--backup"

  if [ ! -z "$JBOSS_USER" ]; then
    if [ -r /etc/rc.d/init.d/functions ]; then
      daemon  [...] --host-config=$JBOSS_HOST_CONFIG ${backup_option} [...]
    else
      su [...] --host-config=$JBOSS_HOST_CONFIG ${backup_option}" [...] 
    fi
  fi
  ...

Optional

If you deleted domain.xml, you will also need to set:

JBOSS_DOMAIN_CONFIG=domain.cached-remote.xml

but this is undocumented, so it's probably best NOT to remove domain.xml and leave JBOSS_DOMAIN_CONFIG definition in jboss-host-controller alone.

Permissions

Then adjust permissions:

chmod a+rx ./jboss
chmod a+rx ./jboss-host-controller