diff --git a/README.md b/README.md index 0b395c7..6e308bb 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,10 @@ All configuration parameters are defined in `nodes.yaml`, with exception of IP addresses, which are defined in different files: - for development, the IP addresses of the Vagrant VMs are defined in - ips.development.yaml. + config/development/ips.yaml. -- for production, you need to create a new file called `ips.production.yaml` +- for production, you need to create a new file called + `config/production/ips.yaml` You will probably not need to change nodes.yaml unless you are developing the deployment process. diff --git a/Rakefile b/Rakefile index be26d8a..cfbbfc6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,12 @@ require 'chake' $SPB_ENV = ENV.fetch('SPB_ENV', 'development') -$SPB_IPS = "ips.#{$SPB_ENV}.yaml" -config = YAML.load_file("config/#{$SPB_ENV}/config.yaml") -ips = YAML.load_file($SPB_IPS) +ips_file = "config/#{$SPB_ENV}/ips.yaml" +config_file = "config/#{$SPB_ENV}/config.yaml" + +config = YAML.load_file(config_file) +ips = YAML.load_file(ips_file) $nodes.each do |node| node.data['config'] = config node.data['peers'] = ips @@ -22,7 +24,7 @@ end task :default => :test file 'ssh_config.erb' -file '.ssh_config' => ['nodes.yaml', $SPB_IPS,'ssh_config.erb'] do |t| +file '.ssh_config' => ['nodes.yaml', ips_file,'ssh_config.erb'] do |t| require 'erb' template = ERB.new(File.read('ssh_config.erb')) File.open(t.name, 'w') do |f| diff --git a/Vagrantfile b/Vagrantfile index 12f8966..c4dc1b0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -13,7 +13,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision 'shell', path: 'utils/proxy.sh', args: [proxy] end - ips = YAML.load_file('ips.development.yaml') + ips = YAML.load_file('config/development/ips.yaml') config.vm.define 'database' do |database| database.vm.network 'private_network', ip: ips['database'] diff --git a/config/development/ips.yaml b/config/development/ips.yaml new file mode 100644 index 0000000..8709b17 --- /dev/null +++ b/config/development/ips.yaml @@ -0,0 +1,6 @@ +integration: 10.10.10.2 +email: 10.10.10.3 +social: 10.10.10.4 +database: 10.10.10.5 +reverseproxy: 10.10.10.6 + diff --git a/ips.development.yaml b/ips.development.yaml deleted file mode 100644 index 8709b17..0000000 --- a/ips.development.yaml +++ /dev/null @@ -1,6 +0,0 @@ -integration: 10.10.10.2 -email: 10.10.10.3 -social: 10.10.10.4 -database: 10.10.10.5 -reverseproxy: 10.10.10.6 - diff --git a/test/ip_helper.sh b/test/ip_helper.sh index 1ff29b7..3c85ae5 100644 --- a/test/ip_helper.sh +++ b/test/ip_helper.sh @@ -4,7 +4,7 @@ # curl http://$reverseproxy # nmap -p 5423 $database # -# Each entry in ips.${SPB_ENV}.yaml will have its own variable +# Each entry in config/${SPB_ENV}/ips.yaml will have its own variable # -eval $(sed -E '/[0-9]{1,3}\./!d; s/^ *//; s/: */=/' ${ROOTDIR:-.}/ips.${SPB_ENV:-development}.yaml) +eval $(sed -E '/[0-9]{1,3}\./!d; s/^ *//; s/: */=/' ${ROOTDIR:-.}/config/${SPB_ENV:-development}/ips.yaml) -- libgit2 0.21.2