Starting JBoss Wildfly as a service using supervisord

Assuming you have downloaded and installed JBoss Wildfly, you may want to start the application server as a service. supervisord is a control agent which allows you to start arbitrary programs as a service. In this post I’ll give a short walkthrough how to install and configure this setup. The setup is based on Fedora Linux, but the steps can be adapted easily to different flavors of Linux.

First you need to install the necessary packages and their dependencies. supervisor itself is a meta daemon, which we configure to control Wildfly, so it needs to be started as a service itself.

yum install java-1.7.0-openjdk supervisor
systemctl enable supervisord

Although Fedora provides a set of RPM packages for Wildfly itself, I’d like to install it from the original tarball, since you often need to provide your own modules for database drivers etc. I’ve extracted the the archive to /opt/wildfly.

I’d like to have a separate user:

adduser -m jboss

The user’s home directory /home/jboss will contain the files which are needed to run the service, so we separate the installation in /opt/wildfly from the execution. For this we need a copy of the files of /opt/wildfly/standalone.

mkdir /home/jboss/wildfly
cd /opt/wildfly/standalone
tar -cO . | tar -x -C /home/jboss/wildfly
chown -R jboss /opt/wildfly/standalone

Also copy the standalone.conf from /opt/wildfly/bin to /home/jboss/wildfly since you may want to modify it. And finally we provide a control script for the supervisor at /etc/supervisord.d/wildfly.ini

command=/opt/wildfly/bin/ -c standalone.xml

Now we will start the supervisord with

systemctl start supervisord

and add the Wildfly server and start it

supervisorctl update
supervisorctl status wildfly

if all goes well, this will fire up the application server. You can check this at the server.log file and using supervisorctl status wildfly

Tagged : ,

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.