Commit 3e39c878a41224a8074f48e89d59649ba9c5d059
1 parent
999fbfe3
Exists in
master
and in
90 other branches
Move list of IP addresses inside config/$SPB_ENV as well
Showing
6 changed files
with
18 additions
and
15 deletions
Show diff stats
README.md
@@ -18,9 +18,10 @@ All configuration parameters are defined in `nodes.yaml`, with exception of IP | @@ -18,9 +18,10 @@ All configuration parameters are defined in `nodes.yaml`, with exception of IP | ||
18 | addresses, which are defined in different files: | 18 | addresses, which are defined in different files: |
19 | 19 | ||
20 | - for development, the IP addresses of the Vagrant VMs are defined in | 20 | - for development, the IP addresses of the Vagrant VMs are defined in |
21 | - ips.development.yaml. | 21 | + config/development/ips.yaml. |
22 | 22 | ||
23 | -- for production, you need to create a new file called `ips.production.yaml` | 23 | +- for production, you need to create a new file called |
24 | + `config/production/ips.yaml` | ||
24 | 25 | ||
25 | You will probably not need to change nodes.yaml unless you are developing the | 26 | You will probably not need to change nodes.yaml unless you are developing the |
26 | deployment process. | 27 | deployment process. |
Rakefile
1 | require 'chake' | 1 | require 'chake' |
2 | 2 | ||
3 | $SPB_ENV = ENV.fetch('SPB_ENV', 'development') | 3 | $SPB_ENV = ENV.fetch('SPB_ENV', 'development') |
4 | -$SPB_IPS = "ips.#{$SPB_ENV}.yaml" | ||
5 | 4 | ||
6 | -config = YAML.load_file("config/#{$SPB_ENV}/config.yaml") | ||
7 | -ips = YAML.load_file($SPB_IPS) | 5 | +ips_file = "config/#{$SPB_ENV}/ips.yaml" |
6 | +config_file = "config/#{$SPB_ENV}/config.yaml" | ||
7 | + | ||
8 | +config = YAML.load_file(config_file) | ||
9 | +ips = YAML.load_file(ips_file) | ||
8 | $nodes.each do |node| | 10 | $nodes.each do |node| |
9 | node.data['config'] = config | 11 | node.data['config'] = config |
10 | node.data['peers'] = ips | 12 | node.data['peers'] = ips |
@@ -22,7 +24,7 @@ end | @@ -22,7 +24,7 @@ end | ||
22 | task :default => :test | 24 | task :default => :test |
23 | 25 | ||
24 | file 'ssh_config.erb' | 26 | file 'ssh_config.erb' |
25 | -file '.ssh_config' => ['nodes.yaml', $SPB_IPS,'ssh_config.erb'] do |t| | 27 | +file '.ssh_config' => ['nodes.yaml', ips_file,'ssh_config.erb'] do |t| |
26 | require 'erb' | 28 | require 'erb' |
27 | template = ERB.new(File.read('ssh_config.erb')) | 29 | template = ERB.new(File.read('ssh_config.erb')) |
28 | File.open(t.name, 'w') do |f| | 30 | File.open(t.name, 'w') do |f| |
Vagrantfile
@@ -13,7 +13,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | @@ -13,7 +13,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
13 | config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy] | 13 | config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy] |
14 | end | 14 | end |
15 | 15 | ||
16 | - ips = YAML.load_file('ips.development.yaml') | 16 | + ips = YAML.load_file('config/development/ips.yaml') |
17 | 17 | ||
18 | config.vm.define 'database' do |database| | 18 | config.vm.define 'database' do |database| |
19 | database.vm.network 'private_network', ip: ips['database'] | 19 | database.vm.network 'private_network', ip: ips['database'] |
ips.development.yaml
test/ip_helper.sh
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | # curl http://$reverseproxy | 4 | # curl http://$reverseproxy |
5 | # nmap -p 5423 $database | 5 | # nmap -p 5423 $database |
6 | # | 6 | # |
7 | -# Each entry in ips.${SPB_ENV}.yaml will have its own variable | 7 | +# Each entry in config/${SPB_ENV}/ips.yaml will have its own variable |
8 | # | 8 | # |
9 | 9 | ||
10 | -eval $(sed -E '/[0-9]{1,3}\./!d; s/^ *//; s/: */=/' ${ROOTDIR:-.}/ips.${SPB_ENV:-development}.yaml) | 10 | +eval $(sed -E '/[0-9]{1,3}\./!d; s/^ *//; s/: */=/' ${ROOTDIR:-.}/config/${SPB_ENV:-development}/ips.yaml) |