Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,17 @@ Optional. Sets the array of runmodes to apply to the AEM instance. Do not use th
##### `sample_content`
Optional. Sets whether or not to include the sample content (e.g. Geometrixx). Valid options: `true` or `false`. Default: `true`. [AEM Documentation][AEM Sample Content].

##### `service_options`
Optional. Hash. Sets the service options, pretty much only used for the systemd implementation. Default:

```
{
'TimeoutStopSec' => '4min',
'KillSignal' => 'SIGCONT',
'PrivateTmp' => true
}
```

##### `snooze`
Optional. Sets the wait period between checks for installation completion. When monitoring the system for up state, this is the wait period between checks. Value is specified in seconds. Valid options: any number. Default: `10`.

Expand Down
56 changes: 29 additions & 27 deletions manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@
#
#
define aem::instance (
$ensure = 'present',
$context_root = undef,
$debug_port = undef,
$group = 'aem',
$home = undef,
$jvm_mem_opts = '-Xmx1024m',
$jvm_opts = undef,
$manage_group = true,
$manage_home = true,
$manage_user = true,
$osgi_configs = undef,
$crx_packages = undef,
$port = 4502,
$runmodes = [],
$sample_content = true,
$snooze = 10,
$source = undef,
$status = 'enabled',
$timeout = 600,
$type = author,
$user = 'aem',
$version = undef) {
$ensure = 'present',
$context_root = undef,
$debug_port = undef,
$group = 'aem',
$home = undef,
$jvm_mem_opts = '-Xmx1024m',
$jvm_opts = undef,
$manage_group = true,
$manage_home = true,
$manage_user = true,
$osgi_configs = undef,
$crx_packages = undef,
$port = 4502,
$runmodes = [],
$sample_content = true,
$service_options = undef,
$snooze = 10,
$source = undef,
$status = 'enabled',
$timeout = 600,
$type = author,
$user = 'aem',
$version = undef) {

anchor { "aem::${name}::begin": }

Expand Down Expand Up @@ -112,11 +113,12 @@

if $status != 'unmanaged' {
aem::service { $name :
ensure => $ensure,
status => $status,
home => $_home,
user => $user,
group => $group,
ensure => $ensure,
status => $status,
home => $_home,
user => $user,
group => $group,
service_options => $service_options
}
}

Expand Down
1 change: 0 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
$puppetgem = 'puppet_gem'

$xmlsimple_ver = '>=1.1.5'

}
22 changes: 12 additions & 10 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
# Based on Elastic Search service management.
#
define aem::service (
$ensure = 'present',
$group = 'aem',
$home = undef,
$status = 'enabled',
$user = 'aem',
$ensure = 'present',
$group = 'aem',
$home = undef,
$status = 'enabled',
$user = 'aem',
$service_options = { 'TimeoutStopSec' => '4min', 'KillSignal' => 'SIGCONT', 'PrivateTmp' => true }

) {

Expand Down Expand Up @@ -64,11 +65,12 @@
}
'systemd' : {
aem::service::systemd { $name :
ensure => $ensure,
status => $status,
group => $group,
home => $home,
user => $user,
ensure => $ensure,
status => $status,
group => $group,
home => $home,
user => $user,
service_options => $service_options
}
}
default : {
Expand Down
3 changes: 2 additions & 1 deletion manifests/service/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
$status,
$group,
$home,
$user
$user,
$service_options
) {

# Setup the system state.
Expand Down
10 changes: 5 additions & 5 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7.2"
"7.4",
"7.6"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"14.04",
"16.04"
"16.04",
"18.04"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"7",
"8"
"9"
]
}
],
Expand Down
22 changes: 22 additions & 0 deletions spec/acceptance/aem/service_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'systemctl service configs' do

it 'should create systemctl service file' do
shell('test -f /lib/systemd/system/aem-author.service', acceptable_exit_codes: 0)
end

it 'should specify the timeout' do
shell('grep TimeoutStopSec=4min /lib/systemd/system/aem-author.service', acceptable_exit_codes: 0)
end

it 'should specify the kill signal' do
shell('grep KillSignal=SIGCONT /lib/systemd/system/aem-author.service', acceptable_exit_codes: 0)
end

it 'should specify the private tmp' do
shell('grep PrivateTmp=true /lib/systemd/system/aem-author.service', acceptable_exit_codes: 0)
end
end
105 changes: 104 additions & 1 deletion spec/defines/service/systemd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
status: 'enabled',
home: '/opt/aem',
user: 'aem',
group: 'aem'
group: 'aem',
service_options: { 'TimeoutStopSec' => '4min', 'KillSignal' => 'SIGCONT', 'PrivateTmp' => true }
}
end

Expand All @@ -48,4 +49,106 @@

end

describe 'aem-author.service file' do
context 'default contents' do
let(:params) do
default_params
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
%r|PIDFile=/opt/aem/crx-quickstart/conf/cq.pid|
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/User=aem/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/Group=aem/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
%r|ExecStart=/opt/aem/crx-quickstart/bin/start|
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
%r|ExecStop=/opt/aem/crx-quickstart/bin/stop|
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/TimeoutStopSec=4min/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/KillSignal=SIGCONT/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/PrivateTmp=true/
)
end
end

context 'custom properties' do
let(:params) do
{
ensure: 'present',
status: 'enabled',
home: '/opt/aem',
user: 'aem',
group: 'aem',
service_options: {
'TimeoutStopSec' => '10min',
'KillSignal' => 'SIGKILL',
'PrivateTmp' => true
}
}
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/TimeoutStopSec=10min/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/KillSignal=SIGKILL/
)
end
it do
is_expected.to contain_file(
'/lib/systemd/system/aem-aem.service'
).with_content(
/PrivateTmp=true/
)
end
end
end

end
9 changes: 6 additions & 3 deletions spec/defines/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
status: 'enabled',
group: 'aem',
home: '/opt/aem',
user: 'aem'
user: 'aem',
service_options: { 'TimeoutStopSec' => '4min', 'KillSignal' => 'SIGCONT', 'PrivateTmp' => true }
)
end
end
Expand Down Expand Up @@ -125,7 +126,8 @@
status: 'enabled',
group: 'aem',
home: '/opt/aem',
user: 'aem'
user: 'aem',
service_options: { 'TimeoutStopSec' => '4min', 'KillSignal' => 'SIGCONT', 'PrivateTmp' => true }
)
end
end
Expand Down Expand Up @@ -171,7 +173,8 @@
status: 'enabled',
group: 'aem',
home: '/opt/aem',
user: 'aem'
user: 'aem',
service_options: { 'TimeoutStopSec' => '4min', 'KillSignal' => 'SIGCONT', 'PrivateTmp' => true }
)
end
end
Expand Down
9 changes: 5 additions & 4 deletions templates/etc/init.d/systemd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ Type=forking
PIDFile=<%= @home %>/crx-quickstart/conf/cq.pid
User=<%= @user %>
Group=<%= @group %>
ExecStart=<%= @home %>/crx-quickstart/bin/start
ExecStart=<%= @home %>/crx-quickstart/bin/start
ExecStop=<%= @home %>/crx-quickstart/bin/stop
# We want systemd to give aem some time to finish gracefully, but still want
# it to kill aem after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill aem. We are sending useless SIGCONT here to give
# aem time to finish.

TimeoutStopSec=4min
KillSignal=SIGCONT
PrivateTmp=true
<% @service_options.each do |key, value| -%>
<%= key %>=<%= value %>
<% end -%>


[Install]
WantedBy=multi-user.target