{"id":444,"date":"2014-08-06T20:37:46","date_gmt":"2014-08-06T18:37:46","guid":{"rendered":"http:\/\/blog.johannes-beck.name\/?p=444"},"modified":"2015-02-28T17:28:45","modified_gmt":"2015-02-28T16:28:45","slug":"starting-jboss-wildfly-as-a-service-using-supervisord","status":"publish","type":"post","link":"https:\/\/blog.johannes-beck.name\/?p=444","title":{"rendered":"Starting JBoss Wildfly as a service using supervisord"},"content":{"rendered":"<p>Assuming you have downloaded and installed <a href=\"http:\/\/wildfly.org\">JBoss Wildfly<\/a>, you may want to start the application server as a service. <a href=\"http:\/\/supervisord.org\/\">supervisord<\/a> is a control agent which allows you to start arbitrary programs as a service. In this post I&#8217;ll give a short walkthrough how to install and configure this setup. The setup is based on <a href=\"http:\/\/www.fedoraproject.org\">Fedora Linux<\/a>, but the steps can be adapted easily to different flavors of Linux.<\/p>\n<p>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.<\/p>\n<p><code><br \/>\nyum install java-1.7.0-openjdk supervisor<br \/>\nsystemctl enable supervisord<br \/>\n<\/code><\/p>\n<p>Although Fedora provides a set of RPM packages for Wildfly itself, I&#8217;d like to install it from the original tarball, since you often need to provide your own modules for database drivers etc. I&#8217;ve extracted the the <a href=\"http:\/\/download.jboss.org\/wildfly\/8.1.0.Final\/wildfly-8.1.0.Final.tar.gz\">archive<\/a> to \/opt\/wildfly.<\/p>\n<p>I&#8217;d like to have a separate user:<\/p>\n<p><code>adduser -m jboss<\/code><\/p>\n<p>The user&#8217;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.<\/p>\n<p><code><br \/>\nmkdir \/home\/jboss\/wildfly<br \/>\ncd \/opt\/wildfly\/standalone<br \/>\ntar -cO . | tar -x -C \/home\/jboss\/wildfly<br \/>\nchown -R jboss \/opt\/wildfly\/standalone<br \/>\n<\/code><\/p>\n<p>Also copy the standalone.conf from <code>\/opt\/wildfly\/bin<\/code> to <code>\/home\/jboss\/wildfly<\/code> since you may want to modify it. And finally we provide a control script for the supervisor at <code>\/etc\/supervisord.d\/wildfly.ini<\/code><\/p>\n<p><code><br \/>\n[program:wildfly]<br \/>\ncommand=\/opt\/wildfly\/bin\/standalone.sh -c standalone.xml<br \/>\nstdout_logfile=NONE<br \/>\nstderr_logfile=NONE<br \/>\nautorestart=true<br \/>\nautostart=true<br \/>\nuser=jboss<br \/>\ndirectory=\/home\/jboss\/wildfly<br \/>\nenvironment=JAVA_HOME=\/usr\/lib\/jvm\/java-1.7.0-openjdk,JBOSS_HOME=\/opt\/wildfly,JBOSS_BASE_DIR=\/home\/jboss\/wildfly,RUN_CONF=\/home\/jboss\/wildfly\/standalone.conf<br \/>\nstopasgroup=true<br \/>\n<\/code><\/p>\n<p>Now we will start the supervisord with<\/p>\n<p><code>systemctl start supervisord<\/code><\/p>\n<p>and add the Wildfly server and start it<\/p>\n<p><code><br \/>\nsupervisorctl update<br \/>\nsupervisorctl status wildfly<br \/>\n<\/code><\/p>\n<p>if all goes well, this will fire up the application server. You can check this at the server.log file and using <code>supervisorctl status wildfly<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ll give a short walkthrough how to install and configure this setup. The setup is based on Fedora [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,43,36],"tags":[47,56],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-java","category-jboss-as7","category-linux","tag-jboss-wildfly","tag-supverisord"],"_links":{"self":[{"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=444"}],"version-history":[{"count":5,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/posts\/444\/revisions"}],"predecessor-version":[{"id":475,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=\/wp\/v2\/posts\/444\/revisions\/475"}],"wp:attachment":[{"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.johannes-beck.name\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}