Skip to content

Commit

Permalink
Merge pull request #9 from mydrive/config-dir
Browse files Browse the repository at this point in the history
-config-dir for service definitions
  • Loading branch information
John Bellone committed May 31, 2014
2 parents 870ba34 + 2dcdfee commit 62acd0b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ Ubuntu 12.04, 14.04
<td>Location to store consul's data in</td>
<td><tt>/var/lib/consul</tt></td>
</tr>
<tr>
<td><tt>['consul']['config_dir']</tt></td>
<td>String</td>
<td>Location to read service definitions from (directoy will be created)</td>
<td><tt>/etc/consul.d</tt></td>
</tr>
<tr>
<td><tt>['consul']['servers']</tt></td>
<td>Array Strings</td>
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# Service attributes
default[:consul][:service_mode] = 'bootstrap'
default[:consul][:data_dir] = '/var/lib/consul'
default[:consul][:config_dir] = '/etc/consul.d'
default[:consul][:servers] = []

# UI attributes
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache v2.0'
description 'Installs/Configures consul'
long_description 'Installs/Configures consul'
version '0.2.0'
version '0.2.2'

recipe 'consul', 'Installs and starts consul service.'
recipe 'consul::binary_install', 'Installs consul service from binary.'
Expand Down
3 changes: 3 additions & 0 deletions recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
service_params = "#{service_params} -ui-dir #{node[:consul][:ui_dir]}/consul_ui -client #{node[:consul][:client_addr]}"
end

directory node[:consul][:config_dir]

template '/etc/init.d/consul' do
source 'consul-init.erb'
mode 0755
variables(
consul_binary: "#{node[:consul][:install_dir]}/consul",
data_dir: node[:consul][:data_dir],
config_dir: node[:consul][:config_dir],
service_params: service_params
)
end
Expand Down
2 changes: 1 addition & 1 deletion templates/default/consul-init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# * Multi Datacenter
### END INIT INFO

CMD="<%= @consul_binary %> agent <%= @service_params %> -data-dir <%= @data_dir %>"
CMD="<%= @consul_binary %> agent <%= @service_params %> -data-dir <%= @data_dir %> -config-dir <%= @config_dir %>"
NAME="consul"

PIDFILE="/var/run/$NAME.pid"
Expand Down

0 comments on commit 62acd0b

Please sign in to comment.