-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
data | ||
.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.define "manager1" do |node| | ||
node.vm.box = "anzz1/boot2docker" | ||
node.vm.box_version = "18.01.0" | ||
node.vm.network :private_network, ip: "10.0.0.10" | ||
node.vm.hostname = "manager1" | ||
|
||
node.vm.synced_folder "./data", "/vagrant_data" | ||
node.vm.provision "shell", path: "wait-for-docker.sh" | ||
node.vm.provision "shell", inline: <<-SHELL | ||
docker swarm init --advertise-addr 10.0.0.10 | ||
docker swarm join-token manager -q > /vagrant_data/swarm-manager-token | ||
docker swarm join-token worker -q > /vagrant_data/swarm-worker-token | ||
SHELL | ||
end | ||
|
||
config.vm.define "manager2" do |node| | ||
node.vm.box = "anzz1/boot2docker" | ||
node.vm.box_version = "18.01.0" | ||
node.vm.network :private_network, ip: "10.0.0.11" | ||
node.vm.hostname = "manager2" | ||
|
||
node.vm.synced_folder "./data", "/vagrant_data" | ||
node.vm.provision "shell", path: "wait-for-docker.sh" | ||
node.vm.provision "shell", inline: <<-SHELL | ||
docker swarm join --token $(cat /vagrant_data/swarm-manager-token) 10.0.0.10:2377 | ||
SHELL | ||
end | ||
|
||
config.vm.define "worker1" do |node| | ||
node.vm.box = "anzz1/boot2docker" | ||
node.vm.box_version = "18.01.0" | ||
node.vm.network :private_network, ip: "10.0.0.21" | ||
node.vm.hostname = "worker1" | ||
|
||
node.vm.synced_folder "./data", "/vagrant_data" | ||
node.vm.provision "shell", path: "wait-for-docker.sh" | ||
node.vm.provision "shell", inline: <<-SHELL | ||
docker swarm join --token $(cat /vagrant_data/swarm-worker-token) 10.0.0.10:2377 | ||
SHELL | ||
end | ||
|
||
config.vm.define "worker2" do |node| | ||
node.vm.box = "anzz1/boot2docker" | ||
node.vm.box_version = "18.01.0" | ||
node.vm.network :private_network, ip: "10.0.0.22" | ||
node.vm.hostname = "worker2" | ||
|
||
node.vm.synced_folder "./data", "/vagrant_data" | ||
node.vm.provision "shell", path: "wait-for-docker.sh" | ||
node.vm.provision "shell", inline: <<-SHELL | ||
docker swarm join --token $(cat /vagrant_data/swarm-worker-token) 10.0.0.10:2377 | ||
SHELL | ||
end | ||
|
||
config.vm.provision "shell", inline: <<-SHELL | ||
echo 'docker:docker' | sudo chpasswd | ||
SHELL | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vagrant up | ||
vagrant ssh manager1 # password: docker | ||
vagrant destroy -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
until docker info > /dev/null | ||
do | ||
echo "waiting for docker info" | ||
sleep 1 | ||
done |