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 for #31 , implements support for bootstrap-expect and now creates the data_dir #39

Merged
merged 7 commits into from
Sep 7, 2014
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
7 changes: 7 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,10 @@ suites:
consul:
serve_ui: true
client_interface: eth0
- name: cluster
run_list:
- recipe[consul::default]
attributes:
consul:
service_mode: cluster
bootstrap_expect: 1
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ Installs and configures [Consul][1].
<tr>
<td><tt>['consul']['service_mode']</tt></td>
<td>String</td>
<td>Mode to run consul as: bootstrap, server, or client</td>
<td>Mode to run consul as: bootstrap, cluster, server, or client</td>
<td><tt>bootstrap</tt></td>
</tr>
<tr>
<td><tt>['consul'][bootstrap_expect]</tt></td>
<td>String</td>
<td>When bootstrapping a cluster, the number of server nodes to expect.</td>
<td><tt>nil</tt></td>
</tr>
<tr>
<td><tt>['consul']['data_dir']</tt></td>
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.4.1'
version '0.4.2'

recipe 'consul', 'Installs and starts consul service.'
recipe 'consul::install_binary', 'Installs consul service from binary.'
Expand Down
9 changes: 9 additions & 0 deletions recipes/_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Configure directories
consul_directories = []
consul_directories << node['consul']['data_dir']
consul_directories << node['consul']['config_dir']
consul_directories << '/var/lib/consul'

Expand Down Expand Up @@ -64,11 +65,19 @@
# Determine service params
service_config = {}
service_config['data_dir'] = node['consul']['data_dir']
num_cluster = node['consul']['bootstrap_expect'].to_i

case node['consul']['service_mode']
when 'bootstrap'
service_config['server'] = true
service_config['bootstrap'] = true
when 'cluster'
service_config['server'] = true
if num_cluster > 1
service_config['bootstrap_expect'] = num_cluster
else
service_config['bootstrap'] = true
end
when 'server'
service_config['server'] = true
service_config['start_join'] = node['consul']['servers']
Expand Down