miércoles, 4 de febrero de 2015

...How to setup JBoss EAP with RHEL 7 (systemd linuxes)

JBoss EAP (or Wildfly) has an init.d script that does not play well with systemd startup systems. To configure it, it is as easy as following this simple steps.
1- Create a group and user for the JBoss EAP process (username, uid, gid, and home to your preferences)
groupadd -r jboss -g 1000
useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
2- Create the home folder for the user
chown -R jboss:jboss /opt/jboss
3- Create configuration directory for the JBoss EAP instance, create the configuration file for the EAP instance (of course, your values here), and then set appropriate permissions for the used folders.
mkdir /etc/jboss-as

cat > /etc/jboss-as/jboss-as.conf <<EOF

mkdir /var/log/jboss-as
mkdir /var/run/jboss-as
chown -R jboss:jboss /var/log/jboss-as
chown -R jboss:jboss /var/run/jboss-as
4- Create the service file
cat > /etc/systemd/system/jboss-as-standalone.service <<EOF
Description=Jboss Application Server
After=syslog.target network.target

ExecStart=/usr/share/jboss-as/bin/init.d/jboss-as-standalone.sh start
ExecStop=/usr/share/jboss-as/bin/init.d/jboss-as-standalone.sh stop

5- Restart the systemctl daemon, start the service, verify it’s status and enable the service
systemctl daemon-reload
systemctl start jboss-as-standalone.service
systemctl status jboss-as-standalone.service
systemctl enable jboss-as-standalone.service
6- Additionally, if you need to create a firewalld rules for the EAP, do:
cat > /etc/firewalld/services/jboss-as-standalone.xml
<?xml version="1.0" encoding="utf-8"?>
<service version="1.0">
     <port port="8080" protocol="tcp"/>
     <port port="8443" protocol="udp"/>
     <port port="8009" protocol="tcp"/>
     <port port="4447" protocol="tcp"/>
     <port port="9990" protocol="udp"/>
     <port port="9999" protocol="tcp"/>

firewall-cmd --zone=public --add-service=jboss-as-standalone
firewall-cmd --permanent --zone=public --add-service=jboss-as-standalone
firewall-cmd --zone=public --list-services
firewall-cmd --permanent --zone=public --list-services

No hay comentarios: