Add backups for taiga.cloud.fp.o.

This commit is contained in:
Ralph Bean 2015-06-29 13:26:41 +00:00
parent eee170b6c9
commit fe5eccd3c7
5 changed files with 30 additions and 14 deletions

View file

@ -21,4 +21,5 @@ copr-be.cloud.fedoraproject.org
copr-fe.cloud.fedoraproject.org copr-fe.cloud.fedoraproject.org
copr-keygen.cloud.fedoraproject.org copr-keygen.cloud.fedoraproject.org
value01.phx2.fedoraproject.org value01.phx2.fedoraproject.org
taiga.cloud.fedoraproject.org
taskotron01.qa.fedoraproject.org taskotron01.qa.fedoraproject.org

View file

@ -13,6 +13,9 @@ public_ip: 209.132.184.50
root_auth_users: ralph maxamillion root_auth_users: ralph maxamillion
description: taiga frontend server description: taiga frontend server
host_backup_targets: ['/backups']
dbs_to_backup: ['taiga']
volumes: volumes:
- volume_id: 4a99a0b3-6812-4c09-af1e-6313a467e3ec - volume_id: 4a99a0b3-6812-4c09-af1e-6313a467e3ec
device: /dev/vdc device: /dev/vdc

View file

@ -0,0 +1,10 @@
#!/bin/bash
# Backup a database *locally* to /backups/.
DB=$1
# Make our latest backup
/usr/bin/pg_dump -C $DB | /usr/bin/xz > /backups/$DB-$(date +%F).dump.xz
# Also, delete the backup from a few days ago.
rm -f /backups/$DB-$(date --date="3 days ago" +%F).dump.xz

View file

@ -56,20 +56,21 @@
# notify: restart postgresql # notify: restart postgresql
# tags: taiga # tags: taiga
## If we want to do backups, we can enable these three tasks - name: Ensure postgres has a place to backup to
#- name: Ensure postgres has a place to backup to file: dest=/backups state=directory owner=postgres
# file: dest=/backups state=directory owner=postgres tags: taiga
# tags: taiga
# - name: Copy over backup scriplet
#- name: Copy over backup scriplet copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755
# copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755 tags: taiga
# tags: taiga
# - name: Set up some cronjobs to backup databases as configured
#- name: Set up some cronjobs to backup databases as configured template: >
# template: > src=cron-backup-database
# src=cron-backup-database dest=/etc/cron.d/cron-backup-database-{{ item }}
# dest=/etc/cron.d/cron-backup-database-taiga with_items:
# tags: taiga - taiga
tags: taiga
- name: Set postgresql-server to run on boot - name: Set postgresql-server to run on boot
service: name=postgresql state=running enabled=yes service: name=postgresql state=running enabled=yes

View file

@ -0,0 +1 @@
0 0 * * * postgres /usr/local/bin/backup-database {{ item }}