Showing with 212 additions and 40 deletions.
  1. +3 −2 .fixtures.yml
  2. +60 −15 .github/CONTRIBUTING.md
  3. +1 −1 .msync.yml
  4. +4 −4 .travis.yml
  5. +16 −0 CHANGELOG.md
  6. +1 −2 Gemfile
  7. +7 −0 README.md
  8. +1 −0 manifests/init.pp
  9. +2 −2 metadata.json
  10. +33 −0 spec/classes/confluence_config_spec.rb
  11. +84 −14 templates/setenv.sh.erb
5 changes: 3 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
fixtures:
symlinks:
confluence: "#{source_dir}"
repositories:
archive: "https://github.com/voxpupuli/puppet-archive.git"
staging: "https://github.com/voxpupuli/puppet-staging.git"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
systemd: "https://github.com/camptocamp/puppet-systemd.git"
augeas_core:
repo: https://github.com/puppetlabs/puppetlabs-augeas_core.git
puppet_version: ">= 6.0.0"
75 changes: 60 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.

1. Create a separate branch for your change.

1. Run the tests. We only take pull requests with passing tests, and
documentation.
1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org)
runs the tests for us. You can also execute them locally. This is explained
in a later section.

1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we
use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html).
They provide some guidance for new code that might help you before you submit a pull request.

1. Add a test for your change. Only refactoring and documentation
changes require no new tests. If you are adding functionality
or fixing a bug, please add a test.

1. Squash your commits down into logical components. Make sure to rebase
against the current master.
against our current master.

1. Push the branch to your fork and submit a pull request.

Expand All @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet.
If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

export PUPPET_VERSION="~> 4.2.0"
```sh
export PUPPET_VERSION="~> 5.5.6"
```

You can install all needed gems for spec tests into the modules directory by
running:
Expand All @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
check various syntax and style things. You can run these locally with:

bundle exec rake lint
bundle exec rake validate
```sh
bundle exec rake lint
bundle exec rake validate
```

It will also run some [Rubocop](http://batsov.com/rubocop/) tests
against it. You can run those locally ahead of time with:

bundle exec rake rubocop
```sh
bundle exec rake rubocop
```

## Running the unit tests

Expand All @@ -82,15 +93,21 @@ about how best to test your new feature.

To run the linter, the syntax checker and the unit tests:

bundle exec rake test
```sh
bundle exec rake test
```

To run your all the unit tests

bundle exec rake spec SPEC_OPTS='--format documentation'
```sh
bundle exec rake spec
```

To run a specific spec test set the `SPEC` variable:

bundle exec rake spec SPEC=spec/foo_spec.rb
```sh
bundle exec rake spec SPEC=spec/foo_spec.rb
```

## Integration tests

Expand All @@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
simple tests against it after applying the module. You can run this
with:

bundle exec rake acceptance
```sh
bundle exec rake acceptance
```

This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,

BEAKER_set=centos-7-x64 bundle exec rake acceptance
```sh
BEAKER_set=centos-7-x64 bundle exec rake acceptance
```

There are default rake tasks for the various acceptance test modules, e.g.,

bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```sh
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```

If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.

Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
```

You can replace the string `debian9` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* debian8
* debian9
* centos6
* centos7

The easiest way to debug in a docker container is to open a shell:

docker exec -it -u root ${container_id_or_name} bash
```sh
docker exec -it -u root ${container_id_or_name} bash
```

The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
repository.
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.0.0'
modulesync_config_version: '2.1.0'
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ matrix:
env: PUPPET_VERSION="~> 5.0" CHECK=test
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 6.0" CHECK=rubocop
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
branches:
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v3.2.0](https://github.com/voxpupuli/puppet-confluence/tree/v3.2.0) (2018-10-20)

[Full Changelog](https://github.com/voxpupuli/puppet-confluence/compare/v3.1.2...v3.2.0)

**Implemented enhancements:**

- Update setenv.sh to support CATALINA\_OPTS [\#167](https://github.com/voxpupuli/puppet-confluence/pull/167) ([TJM](https://github.com/TJM))

**Fixed bugs:**

- setenv.sh is being broken by the puppet-confluence module [\#155](https://github.com/voxpupuli/puppet-confluence/issues/155)

**Merged pull requests:**

- modulesync 2.1.0 and allow puppet 6.x [\#168](https://github.com/voxpupuli/puppet-confluence/pull/168) ([bastelfreak](https://github.com/bastelfreak))

## [v3.1.2](https://github.com/voxpupuli/puppet-confluence/tree/v3.1.2) (2018-09-07)

[Full Changelog](https://github.com/voxpupuli/puppet-confluence/compare/v3.1.1...v3.1.2)
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 2.6', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ confluence::jvm_xms: '4G'
confluence::jvm_xmx: '8G'
confluence::jvm_permgen: '512m'
confluence::download_url: 'http://webserver.example.co.za/pub/software/development-tools/atlassian'
confluence::catalina_opts:
- -Dconfluence.cluster.node.name=%{hostname}
- -Dconfluence.upgrade.recovery.file.enabled=false
confluence::tomcat_proxy:
scheme: 'https'
proxyName: 'webvip.example.co.za'
Expand Down Expand Up @@ -224,6 +227,10 @@ Increase max permgen size for a Java Virtual Machine. Default: '256m'

Additional java options can be specified here. Default: ''

##### `catalina_opts`

Additional catalina options can be specified either as a simple string or array of strings. Default: ''

#### Tomcat parameters

#### `tomcat_proxy`
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$jvm_xmx = '1024m',
$jvm_permgen = '256m',
$java_opts = '',
Variant[String,Array[String]] $catalina_opts = '',
# Confluence Settings
Pattern[/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)(|[a-z])$/] $version = '5.7.1',
$product = 'confluence',
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-confluence",
"version": "3.1.2",
"version": "3.2.0",
"author": "Vox Pupuli",
"summary": "Install atlassian confluence",
"license": "MIT",
Expand Down Expand Up @@ -29,7 +29,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.10.0 < 6.0.0"
"version_requirement": ">= 4.10.0 < 7.0.0"
}
],
"operatingsystem_support": [
Expand Down
33 changes: 33 additions & 0 deletions spec/classes/confluence_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,39 @@
with_content(%r{<Connector enableLookups="false" URIEncoding="UTF-8"\s+port = "8009"\s+protocol = "AJP/1.3"\s+/>})
end
end

context 'catalina_opts set to a string' do
let(:params) do
{
version: '6.12.0',
javahome: '/opt/java',
catalina_opts: '-Dconfluence.upgrade.recovery.file.enabled=false -Dconfluence.cluster.node.name=myhostname'
}
end

it do
is_expected.to compile.with_all_deps
is_expected.to contain_file('/opt/confluence/atlassian-confluence-6.12.0/bin/setenv.sh').
with_content(%r{CATALINA_OPTS=\"-Dconfluence.upgrade.recovery.file.enabled=false -Dconfluence.cluster.node.name=myhostname \${CATALINA_OPTS}\"})
end
end

context 'catalina_opts set to an array' do
let(:params) do
{
version: '6.12.0',
javahome: '/opt/java',
catalina_opts: ['-Dconfluence.upgrade.recovery.file.enabled=false', '-Dconfluence.cluster.node.name=myhostname']
}
end

it do
is_expected.to compile.with_all_deps
is_expected.to contain_file('/opt/confluence/atlassian-confluence-6.12.0/bin/setenv.sh').
with_content(%r{CATALINA_OPTS=\"-Dconfluence.upgrade.recovery.file.enabled=false \${CATALINA_OPTS}\"}).
with_content(%r{CATALINA_OPTS=\"-Dconfluence.cluster.node.name=myhostname \${CATALINA_OPTS}\"})
end
end
end
end
end
Expand Down
98 changes: 84 additions & 14 deletions templates/setenv.sh.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
#
# The following 2 settings control the minimum and maximum given to the Confluence Java virtual machine. In larger Confluence instances, the maximum amount will need to be increased.
#
JVM_MINIMUM_MEMORY="<%= scope.lookupvar('confluence::jvm_xms') %>"
JVM_MAXIMUM_MEMORY="<%= scope.lookupvar('confluence::jvm_xmx') %>"
JVM_PERMGEN_MEMORY="<%= scope.lookupvar('confluence::jvm_permgen') %>"
### THIS FILE IS MANAGED BY PUPPET - ANY MANUAL CHANGES WILL BE LOST!
<%- version = scope['confluence::version'].split('.').map(&:to_i) # splits version string into integers -%>
# See the CATALINA_OPTS below for tuning the JVM arguments used to start Confluence.

#
# Additional JAVA_OPTS
#
JAVA_OPTS="<%= scope.lookupvar('confluence::java_opts') %> $JAVA_OPTS"
JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} -XX:MaxPermSize=${JVM_PERMGEN_MEMORY} $JAVA_OPTS -Djava.awt.headless=true "
export JAVA_OPTS

echo "If you encounter issues starting up Confluence Standalone, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide"
echo "If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide"

# set the location of the pid file
if [ -z "$CATALINA_PID" ] ; then
Expand Down Expand Up @@ -46,3 +36,83 @@ cd $PUSHED_DIR

echo ""
echo "Server startup logs are located in $LOGBASEABS/logs/catalina.out"
<%- if version[0] >= 6 and version[1] >= 1 # version 6.1 or greater -%>

# IMPORTANT NOTE: Only set JAVA_HOME or JRE_HOME above this line
# Get standard Java environment variables
if $os400; then
# -r will Only work on the os400 if the files are:
# 1. owned by the user
# 2. owned by the PRIMARY group of the user
# this will not work if the user belongs in secondary groups
. "$CATALINA_HOME"/bin/setjre.sh
else
if [ -r "$CATALINA_HOME"/bin/setjre.sh ]; then
. "$CATALINA_HOME"/bin/setjre.sh
else
echo "Cannot find $CATALINA_HOME/bin/setjre.sh"
echo "This file is needed to run this program"
exit 1
fi
fi

echo "---------------------------------------------------------------------------"
echo "Using Java: $JRE_HOME/bin/java"
CONFLUENCE_CONTEXT_PATH=`$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/confluence-context-path-extractor.jar $CATALINA_HOME`
export CONFLUENCE_CONTEXT_PATH
$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/synchrony-proxy-watchdog.jar $CATALINA_HOME
echo "---------------------------------------------------------------------------"
<%- end -%>
<%- if version[0] < 5 # prior to version 5.x? -%>

# The following 2 settings control the minimum and maximum given to the Confluence Java virtual machine. In larger Confluence instances, the maximum amount will need to be increased.
#
JVM_MINIMUM_MEMORY="<%= scope['confluence::jvm_xms'] %>"
JVM_MAXIMUM_MEMORY="<%= scope['confluence::jvm_xmx'] %>"
JVM_PERMGEN_MEMORY="<%= scope['confluence::jvm_permgen'] %>"

#
# Additional JAVA_OPTS
#
JAVA_OPTS="<%= scope['confluence::java_opts'] %> $JAVA_OPTS"
export JAVA_OPTS
<%- end -%>
<%- if version[0] >= 5 -%>

# Set the JVM arguments used to start Confluence. For a description of the options, see
# http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
CATALINA_OPTS="-XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}"
CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}"
CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}"
CATALINA_OPTS="-Xms<%= scope['confluence::jvm_xms'] %> -Xmx<%= scope['confluence::jvm_xmx'] %> -XX:+UseG1GC ${CATALINA_OPTS}"
<%- if version[0] >= 6 # 6.x.x or higher -%>
<%- if version[1] >= 1 # 6.1.x or higher -%>
CATALINA_OPTS="-Dsynchrony.enable.xhr.fallback=true ${CATALINA_OPTS}"
<%- end -%>
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 ${CATALINA_OPTS}"
<%- if version[1] >= 1 # 6.1.x or higher -%>
CATALINA_OPTS="${START_CONFLUENCE_JAVA_OPTS} ${CATALINA_OPTS}"
<%- end -%>
CATALINA_OPTS="-Dconfluence.context.path=${CONFLUENCE_CONTEXT_PATH} ${CATALINA_OPTS}"
<%- if version[1] >= 8 # 6.8.x or higher -%>
CATALINA_OPTS="-XX:ReservedCodeCacheSize=256m -XX:+UseCodeCacheFlushing ${CATALINA_OPTS}"
<%- end -%>
<%- end -%>
<%- if version[0] == 5 and version[1] <= 7 # 5.7.x and below -%>
CATALINA_OPTS="-XX:MaxPermSize=<%= scope['confluence::jvm_permgen'] %> ${CATALINA_OPTS}"
<%- end -%>
<%- catalina_opts = scope['confluence::catalina_opts'] -%>
<%- if catalina_opts.is_a?(Array) # add each option as its own line -%>
<%- catalina_opts.each do |opt| -%>
CATALINA_OPTS="<%= opt %> ${CATALINA_OPTS}"
<%- end -%>
<%- elsif catalina_opts.is_a?(String) && !catalina_opts.empty? # add catalina_opts -%>
CATALINA_OPTS="<%= catalina_opts %> ${CATALINA_OPTS}"
<%- end -%>


export CATALINA_OPTS
<%- end # if version[0] >= 5 -%>