coren has submitted this change and it was merged.

Change subject: labstore: add timers for backups
......................................................................


labstore: add timers for backups

Bug: T106474
Change-Id: Ie10622ba825f620240be654798dda763a68129b7
---
M modules/labstore/manifests/fileserver.pp
M modules/labstore/manifests/fileserver/replicate.pp
A modules/labstore/templates/initscripts/replicate.timer.erb
3 files changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Yuvipanda: Looks good to me, but someone else must approve
  Merlijn van Deen: Looks good to me, but someone else must approve
  coren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/labstore/manifests/fileserver.pp 
b/modules/labstore/manifests/fileserver.pp
index 7e1afaf..9a0a856 100644
--- a/modules/labstore/manifests/fileserver.pp
+++ b/modules/labstore/manifests/fileserver.pp
@@ -41,22 +41,28 @@
 
     if $is_active {
         # These should only run on the active host
+
+        # They are staggered by one hour to avoid contention during the 
write-barriers caused
+        # by the creation of snapshots during the backup process.
         labstore::fileserver::replicate { 'tools':
             src_path  => '/srv/project/tools',
             dest_path => '/srv/eqiad/tools',
             dest_host => 'labstore2001.codfw.wmnet',
+            calendar  => '02:00',
         }
 
         labstore::fileserver::replicate { 'others':
             src_path  => '/srv/others',
             dest_path => '/srv/eqiad/others',
             dest_host => 'labstore2001.codfw.wmnet',
+            calendar  => '03:00',
         }
 
         labstore::fileserver::replicate { 'maps':
             src_path  => '/srv/project/maps',
             dest_path => '/srv/eqiad/maps',
             dest_host => 'labstore2001.codfw.wmnet',
+            calendar  => '04:00',
         }
     }
 
diff --git a/modules/labstore/manifests/fileserver/replicate.pp 
b/modules/labstore/manifests/fileserver/replicate.pp
index c516f6e..64b8456 100644
--- a/modules/labstore/manifests/fileserver/replicate.pp
+++ b/modules/labstore/manifests/fileserver/replicate.pp
@@ -1,10 +1,15 @@
 # = Define: labstore::fileserver::replicate
 # Simple systemd based unit to replicate a given volume
 # from current host to destination
+#
+# $calendar is the systemd OnCalendar value for when to
+# schedule the backup.
+
 define labstore::fileserver::replicate(
     $src_path,
     $dest_path,
     $dest_host,
+    $calendar,
 ) {
     base::service_unit { "replicate-${title}":
         template_name   => 'replicate',
@@ -13,6 +18,17 @@
         declare_service => false,
     }
 
+    # labstore::fileserver::replicate can only be applied to
+    # Jessie hosts, so it is perfectly acceptable to presume
+    # systemd.
+    file { "/etc/systemd/system/replicate-${title}.timer":
+        ensure  => present,
+        owner   => "root",
+        group   => "root",
+        mode    => "0444",
+        content => template("labstore/initscripts/replicate.timer.erb"),
+    }
+
     nrpe::monitor_systemd_unit_state { "replicate-${title}":
         description    => "Last backup of the ${title} filesystem",
         expected_state => "periodic 3600",
diff --git a/modules/labstore/templates/initscripts/replicate.timer.erb 
b/modules/labstore/templates/initscripts/replicate.timer.erb
new file mode 100644
index 0000000..9220219
--- /dev/null
+++ b/modules/labstore/templates/initscripts/replicate.timer.erb
@@ -0,0 +1,9 @@
+[Unit]
+Description=Replicate storage between hosts (<%= @title %>)
+
+[Timer]
+OnCalendar=<%= @calendar %>
+Persistent=true
+
+[Install]
+WantedBy=timers.target

-- 
To view, visit https://gerrit.wikimedia.org/r/230569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie10622ba825f620240be654798dda763a68129b7
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: coren <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: coren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to