voxpupuli / puppet-confluence

A puppet module to install confluence
https://forge.puppet.com/puppet/confluence
MIT License
21 stars 76 forks source link

Confluence being restarted every puppet run #119

Open andrewwippler opened 7 years ago

andrewwippler commented 7 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

  java::oracle { 'jdk8' :
    ensure  => 'present',
    version => '8',
    java_se => 'jdk',
  }

  class { "confluence":
    version        => '6.0.4',
    javahome       => "/usr/java/jdk1.8.0_51",
    jvm_xms        => '3G',
    jvm_xmx        => '7G',
    jvm_permgen    => '512m',
    tomcat_proxy   => {
      scheme       => 'https',
      proxyName    => 'wiki.domain.org',
      proxyPort    => '443',
    },
  }

Then apply:

  java::oracle { 'jdk8' :
    ensure  => 'present',
    version => '8',
    java_se => 'jdk',
  }

  class { "confluence":
    version        => '6.0.6',
    javahome       => "/usr/java/jdk1.8.0_51",
    jvm_xms        => '3G',
    jvm_xmx        => '7G',
    jvm_permgen    => '512m',
    tomcat_proxy   => {
      scheme       => 'https',
      proxyName    => 'wiki.domain.org',
      proxyPort    => '443',
    },
  }

What are you seeing

Confluence is being restarted every puppet run after an upgrade

What behaviour did you expect instead

Restart only for the upgrade

Output log

notice  Puppet  Attempting to upgrade CONFLUENCE
notice  /Stage[main]/Confluence/Notify[Attempting to upgrade CONFLUENCE]/message    defined 'message' as 'Attempting to upgrade CONFLUENCE'
notice  /Stage[main]/Confluence/Exec[service confluence stop && sleep 15]/returns   executed successfully
notice  /Stage[main]/Confluence::Service/Service[confluence]/ensure     ensure changed 'stopped' to 'running'

Any additional information you'd like to impart

I removed the offending lines locally to bypass the constant restart.

senax commented 7 years ago

We are seeing the same behaviour. It is the fact which picks up the java version instead of the confluence one. To be honest, looking for 'a process with atlassian-confluence in the name and then taking the first thing which looks a bit like a version' is not ideal.

Unfortunately there doesn't seem to be an easy way to get the version from the rest API like in jira.

This might work?

curl -s http://localhost:8090/nonexisting_page |grep ajs-version-number
            <meta name="ajs-version-number" content="6.0.3">

For now I've changed: confluence_process.scan(%r{\d+\.\d+\.\d+}).first to: confluence_process.scan(%r{\d+\.\d+\.\d+}).last

Which does the trick for now

senax commented 7 years ago

I've created pull request #124

oranenj commented 7 years ago

@andrewwippler @senax I merged the PR. Can you confirm that this is now fixed?

wynnsusilo commented 7 years ago

@oranenj, Sorry, I think this still doesn't work. It's still restarting for me. I've confirmed that the version on my machine and the expected version is the same, but it's still restarting.

decibelhertz commented 7 years ago

FWIW, I had this problem with Oracle JDK and v2.3.0 of this module, using commit 64e3d64152a04ae18119a70492401a76b9564162 instead resolved the confluence_version fact incorrectly catching Java's version.

The output of my host's pgrep --list-full --full java.*atlassian-confluence-[0-9].*org.apache.catalina.startup.Bootstrap command looks like:

17945 /usr/java/jdk1.8.0_131/jre/bin/java -Djava.util.logging.config.file=/data/atlassian/confluence/atlassian-confluence-6.1.2/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms4G -Xmx8G -XX:MaxPermSize=512m -XX:+UseLargePages -Dhttp.proxyHost=example.com -Dhttp.proxyPort=3128 -Dhttps.proxyHost=example.com -Dhttps.proxyPort=3128 -Dhttp.nonProxyHosts=localhost|127.*.*.* -Djava.awt.headless=true -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Djava.endorsed.dirs=/data/atlassian/confluence/atlassian-confluence-6.1.2/endorsed -classpath /data/atlassian/confluence/atlassian-confluence-6.1.2/bin/bootstrap.jar:/data/atlassian/confluence/atlassian-confluence-6.1.2/bin/tomcat-juli.jar -Dcatalina.base=/data/atlassian/confluence/atlassian-confluence-6.1.2 -Dcatalina.home=/data/atlassian/confluence/atlassian-confluence-6.1.2 -Djava.io.tmpdir=/data/atlassian/confluence/atlassian-confluence-6.1.2/temp org.apache.catalina.startup.Bootstrap start

As for the fact based on an HTTP call... Why not use curl on the login page to detect the fact perhaps? Confluence has long put the version its running at the bottom of the page...

# curl -s http://localhost:8090/wiki/login.action | grep 'Atlassian Confluence [0-9]\.[0-9]\.[0-9]'
            <li class="print-only">Printed by Atlassian Confluence 6.1.2</li>
waza-ari commented 7 years ago

I see the same behaviour on Debian 9 stretch, Confluence is restarted at every puppet run. Going to give the other commit a shot tomorrow