Commit 3e39c878a41224a8074f48e89d59649ba9c5d059

Authored by Antonio Terceiro
1 parent 999fbfe3
Exists in master and in 90 other branches 3.x, add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup, backup_not_prod, cdtc_configuration, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev-lappis, dev_env_minimal, disable_email_dev, docs, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, performance, prezento, r3, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_backup_emails, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, stable-devel, support_docs, syslog, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Move list of IP addresses inside config/$SPB_ENV as well

@@ -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.
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|
@@ -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']
config/development/ips.yaml 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +integration: 10.10.10.2
  2 +email: 10.10.10.3
  3 +social: 10.10.10.4
  4 +database: 10.10.10.5
  5 +reverseproxy: 10.10.10.6
  6 +
ips.development.yaml
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -integration: 10.10.10.2  
2 -email: 10.10.10.3  
3 -social: 10.10.10.4  
4 -database: 10.10.10.5  
5 -reverseproxy: 10.10.10.6  
6 -  
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)