Make web frontends use backends in the same location
authorTom Hughes <tom@compton.nu>
Sat, 7 May 2016 14:03:20 +0000 (15:03 +0100)
committerTom Hughes <tom@compton.nu>
Sat, 7 May 2016 14:03:20 +0000 (15:03 +0100)
cookbooks/web/templates/default/apache.frontend.erb
roles/bytemark.rb
roles/ic.rb

index b4714c1372abfeabbd36a84bcfc2d2ae39466e50..71d840c34b6cc5a35099fd3d5da4edf40d9c3451 100644 (file)
   #
   <Proxy balancer://backend>
     ProxySet lbmethod=bybusyness
+<% node[:web][:backends].each do |backend| -%>
 <% if port == 443 -%>
-    BalancerMember https://rails1 disablereuse=on
-    BalancerMember https://rails2 disablereuse=on
-    BalancerMember https://rails3 disablereuse=on
+    BalancerMember https://<%= backend %> disablereuse=on
 <% else -%>
-    BalancerMember http://rails1
-    BalancerMember http://rails2
-    BalancerMember http://rails3
+    BalancerMember http://<%= backend %>
+<% end -%>
 <% end -%>
   </Proxy>
 <% if port == 80 -%>
index 7019492e4f8f8fbb5701f04d4e1734b476e34312..d7a5f104e17a7136d176905c341c9ab4bf4c16c8 100644 (file)
@@ -25,6 +25,9 @@ default_attributes(
         }
       }
     }
+  },
+  :web => {
+    :backends => %w(rails4 rails5)
   }
 )
 
index af78c9f2395e0230136d9880153d9c39268c0a50..16ff9ca485942b234d35f8511c73a8f5edcb88cc 100644 (file)
@@ -28,6 +28,9 @@ default_attributes(
         }
       }
     }
+  },
+  :web => {
+    :backends => %w(rails1 rails2 rails3)
   }
 )