0 Replies Latest reply on Aug 29, 2017 6:37 AM by mqpaul

    Is this a good method to start Jboss on Linux with systemd?

    mqpaul

      This is a copy of Is this a good method to start Jboss on Linux with systemd? However do to lack of reactions I do a re post here.

       

      I have written a systemd service to start Jboss on Linux and I wonder if there is a more elegant solution. Are there any disadvantages for the method I have chosen? The configuration xml secure_eap_1.xml is a copy of the standalone.xml (or a copy of one of the other templates). Every Jboss AS instance has it own Jboss installation tree in this example.

       

      The systemd unit file: secure_eap_1.service

       

      [Unit]

      Description=JBoss AS secure_eap_1

      After=network.target

       

      [Service]

      EnvironmentFile=/appl/jboss/scripts/secure_eap_1.cfg

      ExecStart=/bin/sh -c '${JAVA} ${JBOSS_MODE} ${GC_OPTS} ${JAVA_OPTS} ${JBOSS_OPTS} ${JBOSS_CFG}'

      TimeoutStartSec=120

      TimeoutStopSec=300

      SuccessExitStatus=143

      Type=simple

      User=jboss

      Group=jboss

       

      [Install]

      WantedBy=default.target

       

      The configuration file with the environment settings in /appl/jboss/scripts/secure_eap_1.cfg

       

      # JAVA version

      JAVA_HOME=/usr/lib/jvm/jre-1.8.0

      JAVA=$JAVA_HOME/bin/java

      JBOSS_HOME=/appl/jboss/secure_eap_1/eap64

      JBOSS_SERVER_BASE=/appl/jboss/secure_eap_1/eap64/standalone

      JBOSS_LOG_DIR=/appl/jboss/secure_eap_1/eap64/standalone/log

      JBOSS_CONSOLE_LOG=$JBOSS_LOG_DIR/server.log

      NODE_NAME=system1.example.com.secure_eap_1

       

      # Application server configuration file

      JBOSS_CFG="-c secure_eap_1.xml"

       

      # Port Offset to be incremented by 1000 for every new instance. So value is 1000 for 2nd EAP instance, 2000 for 3rd.

      PORT_OFFSET=0

       

      #IP Address to be used for console access

      MANAGEMENTIP=0.0.0.0

       

      #Generic JVM arguments

      JAVA_OPTS="-Xms256m -Xmx512m -Djava.net.preferIPv4Stack=true"

       

      # Standalone/Domain server/client selection

      JBOSS_MODE="-D[Standalone] -server"

       

      #Garbage collection JVM arguments

      GC_OPTS="-XX:+UseCompressedOops -verbose:gc -Xloggc:$JBOSS_LOG_DIR/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading"

       

      # Jboss properties

      JBOSS_OPTS="-Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.modules.policy-permissions=true -Dorg.jboss.boot.log.file=$JBOSS_CONSOLE_LOG -Dlogging.configuration=file:$JBOSS_SERVER_BASE/configuration/logging.properties -jar $JBOSS_HOME/jboss-modules.jar -mp $JBOSS_HOME/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=$JBOSS_HOME -Djboss.server.base.dir=$JBOSS_SERVER_BASE -Djboss.socket.binding.port-offset=$PORT_OFFSET -Dorg.jboss.as.logging.per-deployment=false -Djboss.node.name=$NODE_NAME -bmanagement $MANAGEMENTIP"