Browse Source

[COOK-606] use private IPs by default

Seth Chisamore 13 years ago
parent
commit
f072f87dd0
6 changed files with 11 additions and 11 deletions
  1. 1 1
      recipes/django.rb
  2. 2 2
      recipes/java_webapp.rb
  3. 3 3
      recipes/mod_php_apache2.rb
  4. 3 3
      recipes/passenger_apache2.rb
  5. 1 1
      recipes/php.rb
  6. 1 1
      recipes/rails.rb

+ 1 - 1
recipes/django.rb

@@ -129,7 +129,7 @@ if app["database_master_role"]
       group app["group"]
       mode "644"
       variables(
-        :host => dbm['fqdn'],
+        :host => (dbm.attribute?('cloud') ? dbm['cloud']['local_ipv4'] : dbm['ipaddress']),
         :database => app['databases'][node.chef_environment],
         :django_version => django_version
       )

+ 2 - 2
recipes/java_webapp.rb

@@ -81,7 +81,7 @@ if app["database_master_role"]
       dbm = rows[0]
     end
   end
-  
+
   # Assuming we have one...
   if dbm
     template "#{app['deploy_to']}/shared/#{app['id']}.xml" do
@@ -90,7 +90,7 @@ if app["database_master_role"]
       group app["group"]
       mode "644"
       variables(
-        :host => dbm['fqdn'],
+        :host => (dbm.attribute?('cloud') ? dbm['cloud']['local_ipv4'] : dbm['ipaddress']),
         :app => app['id'],
         :database => app['databases'][node.chef_environment],
         :war => "#{app['deploy_to']}/releases/#{app['war'][node.chef_environment]['checksum']}.war"

+ 3 - 3
recipes/mod_php_apache2.rb

@@ -27,10 +27,10 @@ include_recipe "apache2::mod_deflate"
 include_recipe "apache2::mod_headers"
 include_recipe "apache2::mod_php5"
 
-server_aliases = [ "#{app['id']}.#{node['domain']}", node.fqdn ]
+server_aliases = [ "#{app['id']}.#{node['domain']}", node['fqdn'] ]
 
-if node.has_key?("ec2")
-  server_aliases << node.ec2.public_hostname
+if node.has_key?("cloud")
+  server_aliases << node['cloud']['public_hostname']
 end
 
 web_app app['id'] do

+ 3 - 3
recipes/passenger_apache2.rb

@@ -24,10 +24,10 @@ include_recipe "apache2::mod_ssl"
 include_recipe "apache2::mod_rewrite"
 include_recipe "passenger_apache2::mod_rails"
 
-server_aliases = [ "#{app['id']}.#{node[:domain]}", node.fqdn ]
+server_aliases = [ "#{app['id']}.#{node['domain']}", node['fqdn'] ]
 
-if node.has_key?("ec2")
-  server_aliases << node.ec2.public_hostname
+if node.has_key?("cloud")
+  server_aliases << node['cloud']['public_hostname']
 end
   
 web_app app['id'] do

+ 1 - 1
recipes/php.rb

@@ -115,7 +115,7 @@ if app["database_master_role"]
       mode "644"
       variables(
         :path => "#{app['deploy_to']}/current",
-        :host => dbm['fqdn'],
+        :host => (dbm.attribute?('cloud') ? dbm['cloud']['local_ipv4'] : dbm['ipaddress']),
         :database => app['databases'][node.chef_environment],
         :app => app
       )

+ 1 - 1
recipes/rails.rb

@@ -122,7 +122,7 @@ if app["database_master_role"]
       group app["group"]
       mode "644"
       variables(
-        :host => dbm['fqdn'],
+        :host => (dbm.attribute?('cloud') ? dbm['cloud']['local_ipv4'] : dbm['ipaddress']),
         :databases => app['databases'],
         :rails_env => rails_env
       )