Thursday, November 3, 2016

Fuse 6.3.0 Better Way to Start as a Service

With License restrictions around Tanuki Wrapper limiting the memory that can be allocated to Jboss Fuse was limited to more than 4GB.Users adopted a slew of different ways to start Jboss fuse as service but none was provided with the product till now. Fuse 6.3 has now decided to deprecate the wrapper service and has instead provided a set of scripts under $FUSE_HOME/bin/contrib for different operating systems to start and stop the Fuse application as service
For RHEL 7 you can follow the below steps to start stop the Jboss Fuse application as Service
  • Open the file karaf-service-template.systemd
  • Change the filepaths pointing to the server as needed

[Unit]
Description=fuse63
After=syslog.target network.target

[Service]
EnvironmentFile=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/setenv

ExecStart=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/fuse daemon
ExecStop=/home/jboss/jboss-fuse-6.3.0.redhat-187/bin/fuse stop

User=jboss
Group=jboss

SuccessExitStatus=0 143
RestartSec=15
Restart=on-failure

LimitNOFILE=102642

[Install]
WantedBy=multi-user.target


  • Change to root , Move the file to /usr/lib/systemd/system/jbossfuse.service
  • run the command systemctl daemon-reload
  • If you also want Fuse to start on reboot of the servers issue the command systemctl enable jbossfuse
  • now you should be able to run the commands
    • systemctl status jbossfuse
    • systemctl start jbossfuse
    • systemctl stop jbossfuse
  • I had rushed in to create the blog looking at the scripts in the contrib directory , here is the cleaner way to do the above steps with official documentation , however with a little help for child containers.
       

    For RHEL 7 you can follow the below steps to start stop the Jboss Fuse application as Service

    • Navigate to the #FUSE_HOME/bin/contrib directory.
    • Run the script karaf-service.sh with parameters as described here.
      • karaf-service.sh -k $FUSE_HOME -n rootservicename.
    • It generates two files rootservicename.service and rootservicename@.service .
    • The rootservicename@.service is the template for child containers.
    • Suppose you have a child container named child1.
    [ Need to review further , consider this work-around ]
    • Copy the file rootservicename@.service to /etc/systemd/system as rootservicename@child1.service.
    • Edit the file and change the EXEC_START line to point to the admin script as below.  ( the default script somehow does not start the child containers , though all the parameters are set )
      • ExecStart=/home/jboss/fuse/jboss-fuse-6.3.0.redhat-187/bin/admin start %i
      • ExecStart=/home/jboss/fuse/jboss-fuse-6.3.0.redhat-187/bin/admin stop %i
    • Excute the command systemctl daemon-reload ( to apply the changes )
    • Once you enable the service on systemctl , the child container child1 can now be controlled via systemctl commands , the script will restart the root container before the child assuming that the root container is not running .


    No comments:

    Post a Comment