ome / infrastructure

A repository containing scripts for managing infrastructure
BSD 2-Clause "Simplified" License
20 stars 19 forks source link

ome-dundeeomero backup script Fix: can't use sudo from /etc/cron #279

Closed kennethgillen closed 7 years ago

kennethgillen commented 7 years ago

An update to address the fact that the nightly backup was failing, though testing at the shell was successful.

Check mode against ome-dundeeomero: ansible_run-backup-script-CHECK-ome-dundeeomero_20170704-120625Z.txt

Live run against ome-dundeeomero: ansible_run-backup-script-UPDATE-ome-dundeeomero_20170704-120909Z.txt

Without this PR

[root@ome-dundeeomero cron.daily]# run-parts  /etc/cron.daily/ -v
[root@ome-dundeeomero cron.daily]# du -sh /backups/*
64K    /backups/nightly-pg_dump_omero.dir

With this PR

[root@ome-dundeeomero cron.daily]# run-parts  /etc/cron.daily/ -v
[root@ome-dundeeomero cron.daily]# du -sh /backups/*
1.7G    /backups/nightly-pg_dump_omero.dir
joshmoore commented 7 years ago

Oh, I'm glad this got caught earlier rather than later!

kennethgillen commented 7 years ago

Yep, agree with those sentiments for sure. I'd dallied adding the backup file size/age monitoring - that's still not in place, I prioritised omero-user-sessions (unique users and total sessions), but on the server upgrades running manual dumps I noticed the du was off.

kennethgillen commented 7 years ago

Can confirm:

[root@ome-dundeeomero ~]# date && du -sh /backups/*
Wed  5 Jul 09:35:50 BST 2017
1.7G    /backups/nightly-pg_dump_omero.dir
manics commented 7 years ago

Code looks fine, can't actually see it in action though.

There's a mysql-backup role: https://github.com/openmicroscopy/ansible-role-mysql-backup If you create something similar for postgres it'll be easier to deploy on other servers.

kennethgillen commented 7 years ago

@manics - if you're happy with https://github.com/openmicroscopy/infrastructure/pull/279#issuecomment-313039103 showing it works, care to merge, or 👍 for merge?

joshmoore commented 7 years ago

cF. https://github.com/openmicroscopy/ansible-role-mysql-backup/blob/master/templates/etc-crond-mysql-backup.j2

Agreed that that looks like a good solution, but additionally :+1: for this being fixed and getting it in ASAP.