]> git.openstreetmap.org Git - chef.git/commitdiff
Point rails at the readonly database in readonly mode
authorTom Hughes <tom@compton.nu>
Tue, 21 Jun 2022 22:29:27 +0000 (23:29 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 21 Jun 2022 22:29:27 +0000 (23:29 +0100)
cookbooks/web/recipes/rails.rb

index a32b1f582f31523ee7bb12322f209098b25c42ba..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"]