Compare commits
5 commits
1b68766cd6
...
d468e49830
Author | SHA1 | Date | |
---|---|---|---|
Reynir Björnsson | d468e49830 | ||
Reynir Björnsson | ae497f0284 | ||
Reynir Björnsson | ac64706fcb | ||
Reynir Björnsson | 9fb16d3a69 | ||
Reynir Björnsson | 6982d0feaa |
|
@ -50,6 +50,10 @@ services:
|
|||
repository: restic
|
||||
version: "1.7.0"
|
||||
disabled_in_vagrant: true
|
||||
# mail dance
|
||||
domain: "noreply.{{ base_domain }}"
|
||||
allowed_sender_domain: true
|
||||
mail_from: "backup@noreply.{{ base_domain }}"
|
||||
|
||||
docker_registry:
|
||||
domain: "docker.{{ base_domain }}"
|
||||
|
|
|
@ -46,3 +46,19 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
|
||||
- name: Create scripts directory
|
||||
file:
|
||||
path: "{{ services.restic.volume_folder }}/scripts"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
state: directory
|
||||
|
||||
- name: Upload failure.sh script
|
||||
template:
|
||||
src: restic/failure.sh.j2
|
||||
dest: "{{ services.restic.volume_folder }}/scripts/failure.sh"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
|
|
@ -15,6 +15,7 @@ services:
|
|||
--tag datacoop-volumes
|
||||
--exclude '*.tmp'
|
||||
--exclude '/mnt/volumes/mastodon/mastodon_data/cache/'
|
||||
--exclude '/mnt/volumes/restic/'
|
||||
--verbose
|
||||
RESTIC_FORGET_ARGS: >-
|
||||
--keep-last 10
|
||||
|
@ -22,9 +23,13 @@ services:
|
|||
--keep-weekly 5
|
||||
--keep-monthly 12
|
||||
TZ: Europe/Copenhagen
|
||||
POST_COMMANDS_FAILURE: /run/libexec/failure.sh
|
||||
volumes:
|
||||
- "./ssh:/run/secrets/.ssh:ro"
|
||||
- "./scripts:/run/libexec:ro"
|
||||
- "/docker-volumes:/mnt/volumes:ro"
|
||||
networks:
|
||||
- postfix
|
||||
|
||||
prune:
|
||||
image: mazzolino/restic:{{ services.restic.version }}
|
||||
|
@ -36,3 +41,7 @@ services:
|
|||
TZ: Europe/copenhagen
|
||||
volumes:
|
||||
- "./ssh:/run/secrets/.ssh:ro"
|
||||
|
||||
networks:
|
||||
postfix:
|
||||
external: true
|
||||
|
|
14
roles/docker/templates/restic/failure.sh.j2
Normal file
14
roles/docker/templates/restic/failure.sh.j2
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
curl smtp://{{ smtp_host }} --mail-from {{ services.restic.mail_from }} --mail-rcpt admin@data.coop --upload-file . << END_OF_MAIL
|
||||
From: Restic backup <{{ services.restic.mail_from }}>
|
||||
To: admin@data.coop
|
||||
Subject: Restic backup failed
|
||||
Date: $(date)
|
||||
|
||||
Dear sir or madam,
|
||||
|
||||
Tonight's backup failed!
|
||||
|
||||
Best,
|
||||
Your backup software.
|
||||
END_OF_MAIL
|
Loading…
Reference in a new issue