]> git.openstreetmap.org Git - chef.git/commitdiff
Move log storage to backup server
authorTom Hughes <tom@compton.nu>
Mon, 16 Sep 2024 07:58:09 +0000 (08:58 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 16 Sep 2024 08:03:26 +0000 (09:03 +0100)
cookbooks/backup/recipes/default.rb
cookbooks/planet/templates/default/logrotate.apache.erb
cookbooks/web/templates/default/logrotate.apache.erb
cookbooks/web/templates/default/logrotate.web.erb
roles/backup.rb
roles/ironbelly.rb

index 0999231ef4a9ca7322960a18c732318719cefe71..64e63fdee914c05b41a7d147beebdca06c3f8193 100644 (file)
@@ -32,6 +32,15 @@ directory "/store/backup" do
   recursive true
 end
 
+%w[planet tile www].each do |service|
+  directory "/store/logs/#{service}.openstreetmap.org" do
+    owner "osmbackup"
+    group "osmbackup"
+    mode "2755"
+    recursive true
+  end
+end
+
 cookbook_file "/usr/local/bin/expire-backups" do
   owner "root"
   group "root"
index f1c5dde56843eb164e2562d52813c3ee6eff7f47..69ca79ca1949e527c54153806a18cdff2cdb73c8 100644 (file)
@@ -11,7 +11,7 @@
        sharedscripts
        postrotate
                /etc/init.d/apache2 reload > /dev/null
-               rsync --preallocate /var/log/apache2/planet.openstreetmap.org-access.log.2.gz ironbelly::logs/planet.openstreetmap.org/`date -d "-7 days" +%Y-%m-%d`.gz
+               rsync --preallocate /var/log/apache2/planet.openstreetmap.org-access.log.2.gz backup.openstreetmap.org::logs/planet.openstreetmap.org/`date -d "-7 days" +%Y-%m-%d`.gz
        endscript
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
index b4d171be83a210b32d2f12af2e86349efb6fe5ae..e2870c3b9d50a8f483bb929baff0509a198a9c69 100644 (file)
@@ -11,6 +11,6 @@
   sharedscripts
   postrotate
     /etc/init.d/apache2 reload > /dev/null
-    /usr/bin/rsync --preallocate /var/log/apache2/access.log.2.gz ironbelly::logs/www.openstreetmap.org/<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
+    /usr/bin/rsync --preallocate /var/log/apache2/access.log.2.gz backup.openstreetmap.org::logs/www.openstreetmap.org/<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
   endscript
 }
index 03c3cb08a72b855f10624c963bb14fc19d5b7d0f..82b08c1c0f2da8b659463a15b4f4f0c5e6190093 100644 (file)
@@ -22,7 +22,7 @@
 <% end -%>
 <% if node[:recipes].include?("web::cgimap") -%>
     /bin/systemctl reload cgimap
-    /usr/bin/rsync --preallocate <%= node[:web][:log_directory] %>/cgimap.log.2.gz ironbelly::logs/www.openstreetmap.org/cgimap-<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
+    /usr/bin/rsync --preallocate <%= node[:web][:log_directory] %>/cgimap.log.2.gz backup.openstreetmap.org::logs/www.openstreetmap.org/cgimap-<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
 <% end -%>
   endscript
 }
index 339ba54afc2bcf5ead241fd4815267e56e803756..00c73fd820301427e1b7742d74656e6ff491989e 100644 (file)
@@ -33,6 +33,30 @@ default_attributes(
           "127.0.0.0/8",                         # localhost
           "::1"                                  # localhost
         ]
+      },
+      :logs => {
+        :comment => "Log files",
+        :path => "/store/logs",
+        :read_only => false,
+        :write_only => true,
+        :list => false,
+        :uid => "osmbackup",
+        :gid => "osmbackup",
+        :transfer_logging => false,
+        :hosts_allow => [
+          "193.60.236.0/24",          # ucl external
+          "10.0.48.0/20",             # amsterdam internal
+          "184.104.179.128/27",       # amsterdam external
+          "2001:470:1:fa1::/64",      # amsterdam external
+          "10.0.64.0/20",             # dublin internal
+          "184.104.226.96/27",        # dublin external
+          "2001:470:1:b3b::/64",      # dublin external
+          "10.0.32.0/20",             # bytemark internal
+          "89.16.162.16/28",          # bytemark external
+          "2001:41c9:2:d6::/64",      # bytemark external
+          "127.0.0.0/8",              # localhost
+          "::1"                       # localhost
+        ]
       }
     }
   }
index 696ee3f560fc4dbf3a6f2e1d30651434c234e145..95bfe9e39cf2d7f15bac7847dff4fb175633d694 100644 (file)
@@ -75,34 +75,6 @@ default_attributes(
           :max_size => "51200M"
       }
     }
-  },
-  :rsyncd => {
-    :modules => {
-      :logs => {
-        :comment => "Log files",
-        :path => "/store/logs",
-        :read_only => false,
-        :write_only => true,
-        :list => false,
-        :uid => "www-data",
-        :gid => "www-data",
-        :transfer_logging => false,
-        :hosts_allow => [
-          "193.60.236.0/24",          # ucl external
-          "10.0.48.0/20",             # amsterdam internal
-          "184.104.179.128/27",       # amsterdam external
-          "2001:470:1:fa1::/64",      # amsterdam external
-          "10.0.64.0/20",             # dublin internal
-          "184.104.226.96/27",        # dublin external
-          "2001:470:1:b3b::/64",      # dublin external
-          "10.0.32.0/20",             # bytemark internal
-          "89.16.162.16/28",          # bytemark external
-          "2001:41c9:2:d6::/64",      # bytemark external
-          "127.0.0.0/8",              # localhost
-          "::1"                       # localhost
-        ]
-      }
-    }
   }
 )