From: Tom Hughes Date: Sun, 20 Feb 2022 19:48:31 +0000 (+0000) Subject: Move the daily statistics to be served from planet.openstreetmap.org X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/0eb2a2b70464e53cd52edcee3b2fa96ac8bc416b Move the daily statistics to be served from planet.openstreetmap.org --- diff --git a/cookbooks/planet/recipes/default.rb b/cookbooks/planet/recipes/default.rb index b99b4ab0b..2a5fdfee1 100644 --- a/cookbooks/planet/recipes/default.rb +++ b/cookbooks/planet/recipes/default.rb @@ -83,6 +83,12 @@ directory "/store/planet/notes" do mode "775" end +directory "/store/planet/statistics" do + owner "www-data" + group "planet" + mode "775" +end + template "/usr/local/bin/apache-latest-planet-filename" do source "apache-latest-planet-filename.erb" owner "root" diff --git a/cookbooks/web/templates/default/apache.frontend.erb b/cookbooks/web/templates/default/apache.frontend.erb index e67961232..528b78fea 100644 --- a/cookbooks/web/templates/default/apache.frontend.erb +++ b/cookbooks/web/templates/default/apache.frontend.erb @@ -139,7 +139,7 @@ SetEnv SECRET_KEY_BASE <%= @secret_key_base %> Alias /favicon.ico <%= node[:web][:base_directory] %>/rails/app/assets/favicons/favicon.ico Alias /openlayers <%= node[:web][:base_directory] %>/static/openlayers - Alias /stats /store/rails/stats + RedirectPermanent /stats https://planet.openstreetmap.org/statistics Alias /user/image /store/rails/user/image Alias /attachments /store/rails/attachments diff --git a/cookbooks/web/templates/default/statistics.erb b/cookbooks/web/templates/default/statistics.erb index a42357ba8..db1fd40ed 100644 --- a/cookbooks/web/templates/default/statistics.erb +++ b/cookbooks/web/templates/default/statistics.erb @@ -10,7 +10,7 @@ export PATH=$PATH:/usr/local/bin <%= @ruby %> -W0 <%= @directory %>/script/statistics > <%= @directory %>/tmp/data_stats.html # Move new statistics into place -mv -f <%= @directory %>/tmp/data_stats.html /store/rails/stats +rsync --quiet <%= @directory %>/tmp/data_stats.html planet.openstreetmap.org::statistics # Mail statistics to Blackadder mail -s "OpenStreetMap Statistics" blackadderajr@gmail.com < /store/rails/stats/data_stats.html diff --git a/roles/planet.rb b/roles/planet.rb index 50ebd4064..78aabf815 100644 --- a/roles/planet.rb +++ b/roles/planet.rb @@ -49,6 +49,17 @@ default_attributes( :ignore_nonreadable => true, :timeout => 3600, :refuse_options => ["checksum"] + }, + :statistics => { + :comment => "Statistics", + :path => "/store/planet/statistics", + :read_only => false, + :write_only => true, + :list => false, + :uid => "planet", + :gid => "planet", + :transfer_logging => false, + :nodes_allow => "roles:web-statistics" } } }