Merge "Add db backups to gitea"
This commit is contained in:
commit
f25deabf9c
@ -134,3 +134,26 @@
|
||||
minute: 37
|
||||
hour: 12
|
||||
weekday: 0
|
||||
- name: Create db backup dest
|
||||
file:
|
||||
state: directory
|
||||
path: /var/backups/gitea-mariadb
|
||||
mode: 0700
|
||||
owner: root
|
||||
group: root
|
||||
- name: Set up cron job to backup the database
|
||||
cron:
|
||||
name: gitea-db-backup
|
||||
state: present
|
||||
user: root
|
||||
job: >
|
||||
/usr/bin/docker-compose -f /etc/gitea-docker/docker-compose.yaml exec -T mariadb
|
||||
bash -c '/usr/bin/mysqldump --opt --ignore-table mysql.event --all-databases --single-transaction -uroot -p"$MYSQL_ROOT_PASSWORD"' |
|
||||
gzip -9 > /var/backups/gitea-mariadb/gitea-mariadb.sql.gz
|
||||
minute: 42
|
||||
hour: 4
|
||||
- name: Rotate db backups
|
||||
include_role:
|
||||
name: logrotate
|
||||
vars:
|
||||
logrotate_file_name: /var/backups/gitea-mariadb/gitea-mariadb.sql.gz
|
||||
|
Loading…
Reference in New Issue
Block a user