Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Nicer names for the nodes, name the DC.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekelkins committed Dec 20, 2014
1 parent fd3b5c4 commit 8ab2b25
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
VAGRANTFILE_API_VERSION = '2'
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker'
N = 4
DC = "dc"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
(1..N).each do |i|
Expand All @@ -15,19 +16,19 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
d.image = 'progrium/consul'
d.remains_running = true
if i == 1 && N > 1 then # start bootstrap server
d.cmd = ['-server', '-bootstrap-expect', "#{N-1}"]
d.cmd = ['-dc', DC, '-node', 'n1', '-server', '-bootstrap-expect', "#{N-1}"]
elsif N == 1 then # single node server
d.ports = ['8400:8400', '8500:8500', '8600:53/udp']
d.cmd = ['-server', '-bootstrap']
d.cmd = ['-dc', DC, '-node', 'n1', '-server', '-bootstrap-expect 1']
elsif i < N then # start servers
d.link('n1:n1')
d.create_args = ['--entrypoint', '/bin/bash']
d.cmd = ['-c', '/bin/start -server -join $N1_PORT_8400_TCP_ADDR']
d.cmd = ['-c', "/bin/start -dc #{DC} -node n#{i} -server -join $N1_PORT_8400_TCP_ADDR"]
else # start client
d.link('n1:n1')
d.ports = ['8400:8400', '8500:8500', '8600:53/udp']
d.create_args = ['--entrypoint', '/bin/bash']
d.cmd = ['-c', '/bin/start -join $N1_PORT_8400_TCP_ADDR']
d.cmd = ['-c', "/bin/start -dc #{DC} -node client -join $N1_PORT_8400_TCP_ADDR"]
end
end
end
Expand Down

0 comments on commit 8ab2b25

Please sign in to comment.