]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/web/recipes/rails.rb
Point rails at the readonly database in readonly mode
[chef.git] / cookbooks / web / recipes / rails.rb
index 8b83a9477d2a05776b169fd39342af5ec6249a7b..59e9abfb8f0479218fd90fcc9d53471a3d05caf4 100644 (file)
@@ -93,6 +93,12 @@ storage = {
   }
 }
 
+db_host = if node[:web][:status] == "database_readonly"
+            node[:web][:readonly_database_host]
+          else
+            node[:web][:database_host]
+          end
+
 rails_port "www.openstreetmap.org" do
   ruby ruby_version
   directory rails_directory
@@ -100,7 +106,7 @@ rails_port "www.openstreetmap.org" do
   group "rails"
   repository "https://git.openstreetmap.org/public/rails.git"
   revision "live"
-  database_host node[:web][:database_host]
+  database_host db_host
   database_name "openstreetmap"
   database_username "rails"
   database_password db_passwords["rails"]
@@ -112,6 +118,7 @@ rails_port "www.openstreetmap.org" do
   memcache_servers node[:web][:memcached_servers]
   potlatch2_key web_passwords["potlatch2_key"]
   id_key web_passwords["id_key"]
+  id_application web_passwords["id_application"]
   oauth_key web_passwords["oauth_key"]
   oauth_application web_passwords["oauth_application"]
   piwik_configuration "location" => piwik[:location],