Red Hat Training

A Red Hat training course is available for Red Hat Fuse

2.2. Installing Red Hat JBoss Fuse as a Service in Fabric Mode

Abstract

In fabric mode, you can install Red Hat JBoss Fuse as a system service in either a fabric ensemble container or in a child container. To do so, you must be logged into a running Fuse Fabric. If you have not created a fabric, see chapter "Creating a New Fabric" in "Fabric Guide" for instructions.

2.2.1. Installing JBoss Fuse as a System Service in a Fabric Ensemble Container

Installing JBoss Fuse as a system service in a fabric ensemble container involves performing these tasks in fabric mode:
  • Creating a profile and adding the wrapper feature to it
  • Deploying the wrapper-containing profile to an ensemble container
  • Installing the wrapper
  • Starting/stopping the service

Procedure

Follow this procedure if you are installing JBoss Fuse on the default ensemble container root.
  1. Create a new profile (for example, myWrapper) that will contain the wrapper feature:
    JBossFuse:karaf@root> fabric:profile-create myWrapper
  2. Add the wrapper feature to the new myWrapper profile:
    JBossFuse:karaf@root> fabric:profile-edit --features wrapper/0.0.0 myWrapper
  3. Add the myWrapper profile to the root container:
    JBossFuse:karaf@root> fabric:container-add-profile root myWrapper
  4. Install the wrapper:
    JBossFuse:karaf@root> wrapper:install
    The wrapper:install command generates the following wrapper files:
    • $JBOSS_FUSE/bin/karaf-wrapper[.exe]—executable file for the wrapper
    • $JBOSS_FUSE/bin/karaf-service[.bat]—script for installing/uninstalling the wrapper
    • $JBOSS_FUSE/etc/karaf-wrapper.conf—wrapper's configuration file
    The command also creates the following Libraries that the service wrapper requires:
    • $JBOSS_FUSE/lib/libwrapper.jnilib
    • $JBOSS_FUSE/lib/karaf-wrapper.jar
    • $JBOSS_FUSE/lib/karaf-wrapper-main.jar
  5. Follow the instructions provided by the wrapper:install command to start or stop the service:
    $JBOSS_FUSE/bin/karaf-service start
                     
    $JBOSS_FUSE/bin/karaf-service stop

2.2.2. Installing JBoss Fuse as a System Service in a Child Container

Installing JBoss Fuse as a system service in a child container involves performing these tasks in fabric mode:
  • Creating a profile and adding the wrapper feature to it
  • Creating a child container and deploying the wrapper-containing profile to it
  • Connecting to the child container and installing the wrapper
  • Adding the child container's JVM options to its wrapper configuration file
  • Starting/stopping the service

Procedure

  1. Create a new profile (for example, myWrapper) that will contain the wrapper feature:
    JBossFuse:karaf@root> fabric:profile-create myWrapper
  2. Add the wrapper feature to the new myWrapper profile:
    JBossFuse:karaf@root> fabric:profile-edit --features wrapper/0.0.0 myWrapper
  3. Create a new child container (for example, child1):
    JBossFuse:karaf@root> fabric:container-create-child root child1
  4. Add the myWrapper profile to the new child container:
    JBossFuse:karaf@root> fabric:container-add-profile child1 myWrapper
  5. Connect to the child container:
    JBossFuse:karaf@root> fabric:container-connect child1
    The child container's splash screen opens, giving you administrative access to it:
    Note that the console prompt has changed to JBossFuse:admin@child1>.
  6. Install the wrapper:
    JBossFuse:admin@child1> wrapper:install
    The wrapper:install command generates the following wrapper files:
    • $JBOSS_FUSE/instances/<child1>/bin/karaf-wrapper[.exe]—executable file for the wrapper
    • $JBOSS_FUSE/instances/<child1>/bin/karaf-service[.bat]—script for installing/uninstalling the wrapper
    • $JBOSS_FUSE/instances/<child1>/etc/karaf-wrapper.conf—wrapper's configuration file
    The command also creates the following Libraries that the service wrapper requires:
    • $JBOSS_FUSE/instances/<child1>/lib/libwrapper.jnilib
    • $JBOSS_FUSE/instances/<child1>/lib/karaf-wrapper.jar
    • $JBOSS_FUSE/instances/<child1>/lib/karaf-wrapper-main.jar
    The command also records each child container's JVM and fabric-related options and values in the $JBOSS_FUSE/instances/instance.properties file, in an entry item.#.opts, where # corresponds to a specific child instance (in this example, item.1.opts for child1):
    Note
    The JVM options listed can vary depending on the command used to create the child instance.
  7. Compare the child container's JVM and fabric-related options listed in its item.#.opts entry in the $JBOSS_FUSE/instances/instance.properties file with the JVM and fabric-related options contained in its $JBOSS_FUSE/instances/<child1>/etc/karaf-wrapper.conf file.
  8. Copy to the child container's $JBOSS_FUSE/instances/<child1>/etc/karaf-wrapper.conf configuration file, any missing JVM and fabric-related options listed in its item.#.opts entry in the $JBOSS_FUSE/instances/instance.properties file.
    Make sure your entries conform to the configuration file format; for example:
    # JVM Parameters            
    # note that n is the parameter number starting from 1.
    wrapper.java.additional.1=-Dkaraf.home=%KARAF_HOME%
    wrapper.java.additional.2=-Dkaraf.base=%KARAF_BASE%
    wrapper.java.additional.3=-Dkaraf.data=%KARAF_DATA%
    wrapper.java.additional.4=-Dkaraf.etc=%KARAF_ETC%
    wrapper.java.additional.5=-Dcom.sun.management.jmxremote
    wrapper.java.additional.6=-Dkaraf.startLocalConsole=false
    wrapper.java.additional.7=-Dkaraf.startRemoteShell=true
    ...
  9. Follow the instructions provided by the wrapper:install command to start or stop the service:
    $JBOSS_FUSE/instances/<child1>/bin/karaf-service start
                     
    $JBOSS_FUSE/instances/<child1>/bin/karaf-service stop