Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warden and zookeeper systemd unit #28

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions recipes/warden.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@
mode '744'
variables(config: node['mapr']['warden']['daemon']['config'])
end

# Replace the default systemd service unit to make it compatible with systemd-219-67
template '/etc/systemd/system/mapr-warden.service' do
source 'systemd_warden.erb'
owner 'root'
group 'root'
mode '0755'
variables(user: node['mapr']['config']['owner'])
end
9 changes: 9 additions & 0 deletions recipes/zookeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@
variables(config: config.hash)
end

# Replace the default systemd service unit to make it compatible with systemd-219-67
template '/etc/systemd/system/mapr-zookeeper.service' do
source 'systemd_zookeeper.erb'
owner 'root'
group 'root'
mode '0755'
variables(user: node['mapr']['config']['owner'])
end

service 'mapr-zookeeper' do
action %w[start enable]
end
Expand Down
3 changes: 3 additions & 0 deletions spec/unit/recipes/warden_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@
},
)
end
it 'should create the warden systemd unit file' do
expect(chef_run).to render_file('/etc/systemd/system/mapr-warden.service').with_content(/User=mapr/)
end
end
end
3 changes: 3 additions & 0 deletions spec/unit/recipes/zookeeper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
it 'should include the recipe default' do
expect(chef_run).to include_recipe('mapr')
end
it 'should create the zookeeper systemd unit file' do
expect(chef_run).to render_file('/etc/systemd/system/mapr-zookeeper.service').with_content(/User=mapr/)
end
end
end
# rubocop: enable BlockLength
21 changes: 21 additions & 0 deletions templates/default/systemd_warden.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=MapR Technologies, Inc. warden services
Requires=multi-user.target

[Service]
User=<%= @user %>
ExecStop=/opt/mapr/initscripts/mapr-warden stop
ExecStart=/opt/mapr/initscripts/mapr-warden start
ExecReload=/opt/mapr/initscripts/mapr-warden reload
PIDFile=/opt/mapr/pid/warden.pid
Restart=on-failure
RestartSec=10
StartLimitBurst=3
StartLimitInterval=60s
TimeoutStopSec=300

SuccessExitStatus=130 143
Type=forking

[Install]
WantedBy=default.target
20 changes: 20 additions & 0 deletions templates/default/systemd_zookeeper.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=MapR Technologies, Inc. zookeeper service
After=rc-local.service
After=network.target syslog.target

[Service]
User=<%= @user %>
ExecStop=/opt/mapr/initscripts/zookeeper stop
ExecStart=/opt/mapr/initscripts/zookeeper start
PIDFile=/opt/mapr/pid/zookeeper.pid
Restart=on-failure
RestartSec=10
StartLimitBurst=3
StartLimitInterval=60s

SuccessExitStatus=9 130 143 SIGKILL
Type=forking

[Install]
WantedBy=default.target