voxpupuli / puppet-wildfly

Puppet module to install, configure and manage Wildfly (8/9/10+), JBoss EAP (6.1+/7.0+) and some Wildfly based products like apiman, Keycloak and Infinispan.
Apache License 2.0
29 stars 79 forks source link

Centos7 wildfly service fails for the first time #101

Closed ashish1099 closed 8 years ago

ashish1099 commented 8 years ago

Puppet runs fails for the first time on centos

Notice: /Stage[main]/Apache::Service/Service[httpd]: Triggered 'refresh' from 1 events
Error: Could not start Service[wildfly]: Execution of '/bin/systemctl start wildfly' returned 6: Failed to start wildfly.service: Unit wildfly.service failed to load: No such file or directory.
Error: /Stage[main]/Wildfly::Service/Service[wildfly]/ensure: change from stopped to running failed: Could not start Service[wildfly]: Execution of '/bin/systemctl start wildfly' returned 6: Failed to start wildfly.service: Unit wildfly.service failed to load: No such file or directory.

Manually starting wildly

[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# service wildfly start
Reloading systemd:  Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
                                                           [  OK  ]
Starting wildfly (via systemctl):  Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
                                                           [  OK  ]

And then it works proper,

  1. First I check the status with systemctl command and it reports perfectly fine
  2. Then I stop the wildly with systemctl and works properly.
  3. Then starting the wildly with systemctl works properly.

Looks like first time we have to start the service with manually.

[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# systemctl status wildfly
● wildfly.service - SYSV: WildFly startup script
   Loaded: loaded (/etc/rc.d/init.d/wildfly)
   Active: active (running) since Wed 2015-12-30 03:59:19 UTC; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4473 ExecStart=/etc/rc.d/init.d/wildfly start (code=exited, status=0/SUCCESS)
 Main PID: 4576 (java)
   CGroup: /lxc/beaker/lxc/beaker-role-appeng-wildfly-centos7-mrfkyciu/system.slice/wildfly.service
           ├─4481 /bin/sh /etc/rc.d/init.d/wildfly start
           ├─4484 runuser -s /bin/bash wildfly -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/wildfly/wildfly.pid ...
           ├─4485 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/wildfly/wildfly.pid /opt/wildfly/bin/standal...
           ├─4486 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone-full.xml -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Djbos...
           └─4576 java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.boot...

Dec 30 03:59:03 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Starting SYSV: WildFly startup script...
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu wildfly[4473]: Starting wildfly: [  OK  ]
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: wildfly.service: Supervising process 4576 which is not our child. We'll most ...exits.
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Started SYSV: WildFly startup script.
Hint: Some lines were ellipsized, use -l to show in full.
[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# systemctl stop wildfly
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# systemctl status wildfly
● wildfly.service - SYSV: WildFly startup script
   Loaded: loaded (/etc/rc.d/init.d/wildfly)
   Active: inactive (dead)
     Docs: man:systemd-sysv-generator(8)

Dec 30 03:59:03 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Starting SYSV: WildFly startup script...
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu wildfly[4473]: Starting wildfly: [  OK  ]
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: wildfly.service: Supervising process 4576 which is not our child. We'll most ...exits.
Dec 30 03:59:19 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Started SYSV: WildFly startup script.
Dec 30 03:59:31 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Stopping SYSV: WildFly startup script...
Dec 30 03:59:32 beaker-role-appeng-wildfly-centos7-mrfkyciu wildfly[4745]: Stopping wildfly: [  OK  ]
Dec 30 03:59:32 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Stopped SYSV: WildFly startup script.
Hint: Some lines were ellipsized, use -l to show in full.
[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# systemctl start wildfly
Error getting authority: Error initializing authority: Could not connect: Connection refused (g-io-error-quark, 39)
[root@beaker-role-appeng-wildfly-centos7-mrfkyciu ~]# systemctl status wildfly
● wildfly.service - SYSV: WildFly startup script
   Loaded: loaded (/etc/rc.d/init.d/wildfly)
   Active: active (running) since Wed 2015-12-30 03:59:55 UTC; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4786 ExecStart=/etc/rc.d/init.d/wildfly start (code=exited, status=0/SUCCESS)
 Main PID: 4889 (java)
   CGroup: /lxc/beaker/lxc/beaker-role-appeng-wildfly-centos7-mrfkyciu/system.slice/wildfly.service
           ├─4794 /bin/sh /etc/rc.d/init.d/wildfly start
           ├─4797 runuser -s /bin/bash wildfly -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/wildfly/wildfly.pid ...
           ├─4798 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; LAUNCH_JBOSS_IN_BACKGROUND=1 JBOSS_PIDFILE=/var/run/wildfly/wildfly.pid /opt/wildfly/bin/standal...
           ├─4799 /bin/sh /opt/wildfly/bin/standalone.sh -c standalone-full.xml -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 -Djbos...
           └─4889 java -D[Standalone] -server -XX:+UseCompressedOops -server -XX:+UseCompressedOops -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.boot...

Dec 30 03:59:39 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Starting SYSV: WildFly startup script...
Dec 30 03:59:55 beaker-role-appeng-wildfly-centos7-mrfkyciu wildfly[4786]: Starting wildfly: [  OK  ]
Dec 30 03:59:55 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: wildfly.service: Supervising process 4889 which is not our child. We'll most ...exits.
Dec 30 03:59:55 beaker-role-appeng-wildfly-centos7-mrfkyciu systemd[1]: Started SYSV: WildFly startup script.
Hint: Some lines were ellipsized, use -l to show in full.```
biemond commented 8 years ago

Hi

I also test this module (latest from github) on centos 7 with wildfly 9.0.2 and it works for me

The only bug I got it tries to enable the service in every puppet run like this Notice: /Stage[main]/Wildfly::Service/Service[wildfly]/enable: enable changed 'false' to 'true'

==> default: Notice: /Stage[main]/Wildfly::Prepare/Group[wildfly]/ensure: created
==> default: Notice: /Stage[main]/Wildfly::Prepare/User[wildfly]/ensure: created
==> default: Notice: /Stage[main]/Wildfly::Prepare/File[/opt/wildfly]/ensure: created

==> default: Notice: /Stage[main]/Wildfly::Install/Exec[Download wildfly from http://download.jboss.org/wildfly/9.0.2.Final/wildfly-9.0.2.Final.tar.gz]/returns: executed successfully
==> default: Info: /Stage[main]/Wildfly::Install/Exec[Download wildfly from http://download.jboss.org/wildfly/9.0.2.Final/wildfly-9.0.2.Final.tar.gz]: Scheduling refresh of Exec[untar wildfly-9.0.2.Final.tar.gz]
==> default: Notice: /Stage[main]/Wildfly::Install/Exec[untar wildfly-9.0.2.Final.tar.gz]/returns: executed successfully
==> default: Notice: /Stage[main]/Wildfly::Install/Exec[untar wildfly-9.0.2.Final.tar.gz]: Triggered 'refresh' from 1 events

==> default: Info: Computing checksum on file /opt/wildfly/bin/standalone.conf
==> default: Info: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]: Filebucketed /opt/wildfly/bin/standalone.conf to puppet with sum f87f0b158b9734ca32d7d307d3567ff2
==> default: Notice: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]/content: content changed '{md5}f87f0b158b9734ca32d7d307d3567ff2' to '{md5}30aa047065bc97124716636387d96a8b'
==> default: Notice: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]/seluser: seluser changed 'unconfined_u' to 'system_u'
==> default: Notice: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]/seltype: seltype changed 'usr_t' to 'bin_t'
==> default: Info: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]: Scheduling refresh of Class[Wildfly::Service]
==> default: Info: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]: Scheduling refresh of Class[Wildfly::Service]
==> default: Info: /Stage[main]/Wildfly::Setup/File[/opt/wildfly/bin/standalone.conf]: Scheduling refresh of Class[Wildfly::Service]

==> default: Notice: /Stage[main]/Wildfly::Setup/Wildfly::Config::Mgmt_user[wildfly]/Wildfly::Config::User[wildfly]/File_line[wildfly:ManagementRealm]/ensure: created

==> default: Info: Class[Wildfly::Service]: Scheduling refresh of Service[wildfly]

==> default: Notice: /Stage[main]/Wildfly::Service/File[/etc/default/wildfly.conf]/ensure: defined content as '{md5}76ba1c433ac18364bae42b40d117bb6d'
==> default: Info: /Stage[main]/Wildfly::Service/File[/etc/default/wildfly.conf]: Scheduling refresh of Service[wildfly]
==> default: Notice: /Stage[main]/Wildfly::Service/File[/etc/init.d/wildfly]/ensure: defined content as '{md5}c51849d364e29f46ed3928cf0f598df8'
==> default: Notice: /Stage[main]/Wildfly::Service/Service[wildfly]/ensure: ensure changed 'stopped' to 'running'
==> default: Info: /Stage[main]/Wildfly::Service/Service[wildfly]: Unscheduling refresh on Service[wildfly]

this is the config I used

node default {
  include my_os
  include my_java
  include my_wildfly
}

# Operating Sytem settings
class my_os {

  host{'localhost':
    ip           => "127.0.0.1",
    host_aliases => ['localhost.localdomain',
                     'localhost4',
                     'localhost4.localdomain4'],
  }
  host{'dev.example.com':
    ip           => "10.10.10.10",
    host_aliases => 'dev',
  }

  service { iptables:
    enable    => false,
    ensure    => false,
    hasstatus => true,
  }

  $install = ['binutils.x86_64','wget']

  package { $install:
    ensure  => present,
  }
}

class my_java {
  contain my_os

  class { 'jdk_oracle':
    version        => "8",
    version_update => '60',
    version_build  => '27',
  }
}

class my_wildfly{
  contain my_os, my_java

  class { 'wildfly':
    version           => '9.0.2',
    install_source    => 'http://download.jboss.org/wildfly/9.0.2.Final/wildfly-9.0.2.Final.tar.gz',
    java_home         => '/opt/jdk1.8.0_60',
    dirname           => '/opt/wildfly',
    mode              => 'standalone',
    config            => 'standalone-full-ha.xml',
    users_mgmt        => { 'wildfly' => { password => 'wildfly'}},
  }

}
jairojunior commented 8 years ago

Thank you @ashish1099

First, are you using Safari? He keeps trying to replace wildfly for wildly and it really annoys me hahaha

I was aware of this problem, but was unable to map the cause since it seemed non-deterministic (heisenbug) in my environment

One day I lost about 4-6 hours of my day due to VMWare Fusion slow network when using beaker (hate that I can't use vagrant-cachier with Beaker + Vagrant) and had to give up on this for a while

@biemond This problem that you reported is a constant. At first I thought it was a a problem with service type (he just keeps reporting that it can't enable the service), but lately started to think that I might be missing something about systemd behavior (i.e. Do I really need /etc/systemd/system/wildfly.service file?)

http://www.dmartin.es/2014/07/jboss-eap-6-as-rhel-7-service/

biemond commented 8 years ago

indeed

puppet on rhel 7 checks with systemctl the UnitFileState property for if it is enabled or not. In our case this property is empty. The wildfly service ( <7.0 init.d script ) does not support systemctl is-enabled

But the dmartin solution seems fine. I will take a look at it

jairojunior commented 8 years ago

Just fixed with latest commit. Feel free to test and reopen this if you still having problems with RHEL7 based distros.