diff --git a/debian12-forgejo/playbook.yml b/debian12-forgejo/playbook.yml index 3e0d3c6..bb48c1e 100644 --- a/debian12-forgejo/playbook.yml +++ b/debian12-forgejo/playbook.yml @@ -155,4 +155,17 @@ src: app.ini dest: /etc/forgejo/app.ini notify: - - Restart forgejo \ No newline at end of file + - Restart forgejo + + #Backup + - name: backup script + ansible.builtin.template: + src: backup.sh + dest: /usr/local/bin/backup.sh + mode: '0770' + - name: Backup + ansible.builtin.cron: + name: "backup" + minute: "0" + hour: "3" + job: "/usr/local/bin/backup.sh > /dev/null" \ No newline at end of file diff --git a/debian12-forgejo/templates/backup.sh b/debian12-forgejo/templates/backup.sh new file mode 100644 index 0000000..daca041 --- /dev/null +++ b/debian12-forgejo/templates/backup.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set +e +d=$(date +%Y-%m-%d) +cd /tmp +sudo -u git /usr/local/bin/forgejo dump --config /etc/forgejo/app.ini --file /tmp/gitea-dump.zip +/usr/local/bin/b2 upload-file --noProgress --quiet kekskurse-backups /tmp/gitea-dump.zip git.keks.cloud/forgejo/$d.zip +rm /tmp/gitea-dump +curl "{{ monitorurl }}" \ No newline at end of file