← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:charm-push-backups-run-one into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:charm-push-backups-run-one into launchpad:master.

Commit message:
charm: Run postgresql-extras push-backups under run-one

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/456086

It's quite plausible for pushing production DB backups to staging to take more than the cron job frequency (an hour), so we should ensure that we don't run multiple copies of this script at once.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-push-backups-run-one into launchpad:master.
diff --git a/charm/launchpad-postgresql-extras/layer.yaml b/charm/launchpad-postgresql-extras/layer.yaml
index 879d9e6..3b21362 100644
--- a/charm/launchpad-postgresql-extras/layer.yaml
+++ b/charm/launchpad-postgresql-extras/layer.yaml
@@ -8,3 +8,4 @@ options:
     packages:
       - launchpad-database-dependencies
       - pgbouncer
+      - run-one
diff --git a/charm/launchpad-postgresql-extras/templates/crontab.j2 b/charm/launchpad-postgresql-extras/templates/crontab.j2
index d9e4d5e..d061b81 100644
--- a/charm/launchpad-postgresql-extras/templates/crontab.j2
+++ b/charm/launchpad-postgresql-extras/templates/crontab.j2
@@ -4,6 +4,6 @@ MAILTO={{ cron_mailto }}
 {% if push_backups_databases and push_backups_destination -%}
 # The PostgreSQL charm handles backups, but on production we also need to
 # push backups to staging for weekly restores.
-22 * * * * postgres	{{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_destination }} {{ push_backups_databases }}
+22 * * * * postgres	run-one {{ scripts_dir }}/push-backups --bwlimit=10m {% if push_backups_private_ssh_key_path %}--ssh-key {{ push_backups_private_ssh_key_path }} {% endif %}{{ push_backups_destination }} {{ push_backups_databases }}
 {% endif %}