Skip to content

Commit

Permalink
Merge pull request #188 from joshgarnett/master
Browse files Browse the repository at this point in the history
Adding GOMAXPROCS support for systemd.
  • Loading branch information
johnbellone committed Jun 24, 2015
2 parents 10d582a + 0ef0ea0 commit 1e1e53a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
default['consul']['service_user'] = 'root'
default['consul']['service_group'] = 'root'
end
default['consul']['system_account'] = false

default['consul']['ports'] = {
'dns' => 8600,
Expand Down
8 changes: 8 additions & 0 deletions recipes/_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
username consul_user
home '/dev/null'
shell '/bin/false'
system node['consul']['system_account']
comment 'consul service user'
end

Expand All @@ -46,6 +47,7 @@
not_if { consul_group == 'root' }
group_name consul_group
members consul_user
system node['consul']['system_account']
append true
end

Expand Down Expand Up @@ -248,6 +250,12 @@
reload_command "'#{node['runit']['sv_bin']}' hup consul"
end
when 'systemd'
template node['consul']['etc_config_dir'] do
source 'consul-sysconfig.erb'
mode 0644
notifies :create, "template[/etc/systemd/system/consul.service]", :immediately
end

template '/etc/systemd/system/consul.service' do
source 'consul-systemd.erb'
mode 0644
Expand Down
3 changes: 2 additions & 1 deletion templates/default/consul-systemd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ After=basic.target network.target
[Service]
User=<%= node['consul']['service_user'] %>
Group=<%= node['consul']['service_group'] %>
EnvironmentFile=-<%= node['consul']['etc_config_dir'] %>
ExecStart=<%= Chef::Consul.active_binary(node) %> agent \
-config-dir <%= node['consul']['config_dir'] %>
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
RestartSec=15s

[Install]
WantedBy=multi-user.target

0 comments on commit 1e1e53a

Please sign in to comment.