From: Tom Hughes Date: Sun, 8 Nov 2020 11:25:35 +0000 (+0000) Subject: Install osmdbt and generate configuration file for it X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/3716ae2b4f11f81c8cd496eadaf2092de66a9ddf?ds=sidebyside Install osmdbt and generate configuration file for it --- diff --git a/cookbooks/planet/recipes/replication.rb b/cookbooks/planet/recipes/replication.rb index 883ab7225..c588de1ae 100644 --- a/cookbooks/planet/recipes/replication.rb +++ b/cookbooks/planet/recipes/replication.rb @@ -17,20 +17,23 @@ # limitations under the License. # +require "yaml" + include_recipe "accounts" include_recipe "osmosis" db_passwords = data_bag_item("db", "passwords") -package "postgresql-client" - -package "ruby" -package "ruby-dev" -package "ruby-libxml" - -package "make" -package "gcc" -package "libpq-dev" +package %w[ + postgresql-client + ruby + ruby-dev + ruby-libxml + make + gcc + libpq-dev + osmdbt +] gem_package "pg" @@ -121,6 +124,25 @@ directory "/store/planet/replication/minute" do mode "755" end +directory "/store/planet/replication/test" do + owner "planet" + group "planet" + mode "755" +end + +directory "/store/planet/replication/test/minute" do + owner "planet" + group "planet" + mode "755" +end + +systemd_tmpfile "/run/replication" do + type "d" + owner "planet" + group "planet" + mode "755" +end + directory "/etc/replication" do owner "root" group "root" @@ -141,6 +163,27 @@ template "/etc/replication/auth.conf" do variables :password => db_passwords["planetdiff"] end +osmdbt_config = { + "database" => { + "host" => node[:web][:database_host], + "dbname" => "openstreetmap", + "user" => "planetdiff", + "password" => db_passwords["planetdiff"], + "replication_slot" => "osmdbt" + }, + "log_dir" => "/var/lib/replication/minute", + "changes_dir" => "/store/planet/replication/test/minute", + "tmp_dir" => "/tmp", + "run_dir" => "/run/replication" +} + +file "/etc/replication/osmdbt-config.yaml" do + user "root" + group "planet" + mode "640" + content YAML.dump(osmdbt_config) +end + template "/etc/replication/changesets.conf" do source "changesets.conf.erb" user "root" @@ -163,6 +206,12 @@ directory "/var/lib/replication" do mode "755" end +directory "/var/lib/replication/minute" do + owner "planet" + group "planet" + mode "755" +end + directory "/var/lib/replication/hour" do owner "planet" group "planet"