Add backups for taiga.cloud.fp.o.
This commit is contained in:
parent
eee170b6c9
commit
fe5eccd3c7
5 changed files with 30 additions and 14 deletions
|
@ -21,4 +21,5 @@ copr-be.cloud.fedoraproject.org
|
|||
copr-fe.cloud.fedoraproject.org
|
||||
copr-keygen.cloud.fedoraproject.org
|
||||
value01.phx2.fedoraproject.org
|
||||
taiga.cloud.fedoraproject.org
|
||||
taskotron01.qa.fedoraproject.org
|
||||
|
|
|
@ -13,6 +13,9 @@ public_ip: 209.132.184.50
|
|||
root_auth_users: ralph maxamillion
|
||||
description: taiga frontend server
|
||||
|
||||
host_backup_targets: ['/backups']
|
||||
dbs_to_backup: ['taiga']
|
||||
|
||||
volumes:
|
||||
- volume_id: 4a99a0b3-6812-4c09-af1e-6313a467e3ec
|
||||
device: /dev/vdc
|
||||
|
|
10
roles/taiga/files/backup-database
Normal file
10
roles/taiga/files/backup-database
Normal 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
|
|
@ -56,20 +56,21 @@
|
|||
# notify: restart postgresql
|
||||
# tags: taiga
|
||||
|
||||
## If we want to do backups, we can enable these three tasks
|
||||
#- name: Ensure postgres has a place to backup to
|
||||
# file: dest=/backups state=directory owner=postgres
|
||||
# tags: taiga
|
||||
#
|
||||
#- name: Copy over backup scriplet
|
||||
# copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755
|
||||
# tags: taiga
|
||||
#
|
||||
#- name: Set up some cronjobs to backup databases as configured
|
||||
# template: >
|
||||
# src=cron-backup-database
|
||||
# dest=/etc/cron.d/cron-backup-database-taiga
|
||||
# tags: taiga
|
||||
- name: Ensure postgres has a place to backup to
|
||||
file: dest=/backups state=directory owner=postgres
|
||||
tags: taiga
|
||||
|
||||
- name: Copy over backup scriplet
|
||||
copy: src=backup-database dest=/usr/local/bin/backup-database mode=0755
|
||||
tags: taiga
|
||||
|
||||
- name: Set up some cronjobs to backup databases as configured
|
||||
template: >
|
||||
src=cron-backup-database
|
||||
dest=/etc/cron.d/cron-backup-database-{{ item }}
|
||||
with_items:
|
||||
- taiga
|
||||
tags: taiga
|
||||
|
||||
- name: Set postgresql-server to run on boot
|
||||
service: name=postgresql state=running enabled=yes
|
||||
|
|
1
roles/taiga/templates/cron-backup-database
Normal file
1
roles/taiga/templates/cron-backup-database
Normal file
|
@ -0,0 +1 @@
|
|||
0 0 * * * postgres /usr/local/bin/backup-database {{ item }}
|
Loading…
Add table
Add a link
Reference in a new issue