install.fairie/home/dot_config/autorestic/autorestic-system.yml.tmpl

71 lines
5.6 KiB
Cheetah
Raw Normal View History

---
version: 2
extras:
docker: &docker
type: volume
to:
- docker-local
- docker-s3
cron: '0 * * * *'
hooks:
before:
2024-01-01 15:58:07 -08:00
- |
HEALTHCHECK_UUID="$(curl https://healthchecks.{{ .host.domain }}/api/v1/checks/ --header "X-Api-Key: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "HEALTHCHECKS_API_KEY")) }}{{ includeTemplate "secrets/HEALTHCHECKS_API_KEY" | decrypt | trim }}{{ else }}{{ default "" (env "HEALTHCHECKS_API_KEY") }}{{ end }}" --data "{\"name\": \"Autorestic Docker Volume Backup - Volume ${AUTORESTIC_LOCATION} / Host {{ .host.hostname }} / User {{ .user.username }})\", \"channels\": \"*\", \"schedule\": \"50 * * * *\", \"tags\": \"host-{{ .host.hostname }} user-{{ .user.username }} location-${AUTORESTIC_LOCATION} docker-volume\", \"tz\": \"{{ .user.timezone }}\", \"desc\": \"The ${AUTORESTIC_LOCATION} Docker volume on {{ .host.hostname }}\", \"grace\": 3600}" | jq -r '.ping_url' | sed 's/.*\///')"
curl -X POST -H "Content-Type: text/plain" --data "Autorestic Docker Volume ${AUTORESTIC_LOCATION} BEFORE / Host: ${HOST} / User: ${USER} / Home: ${HOME}" "https://healthchecks.{{ .host.domain }}/ping/${HEALTHCHECK_UUID}/start"
failure:
2024-01-01 15:58:07 -08:00
- |
HEALTHCHECK_UUID="$(curl https://healthchecks.{{ .host.domain }}/api/v1/checks/ --header "X-Api-Key: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "HEALTHCHECKS_API_KEY")) }}{{ includeTemplate "secrets/HEALTHCHECKS_API_KEY" | decrypt | trim }}{{ else }}{{ default "" (env "HEALTHCHECKS_API_KEY") }}{{ end }}" --data "{\"name\": \"Autorestic Docker Volume Backup - Volume ${AUTORESTIC_LOCATION} / Host {{ .host.hostname }} / User {{ .user.username }})\", \"channels\": \"*\", \"schedule\": \"50 * * * *\", \"tags\": \"host-{{ .host.hostname }} user-{{ .user.username }} location-${AUTORESTIC_LOCATION} docker-volume\", \"tz\": \"{{ .user.timezone }}\", \"desc\": \"The ${AUTORESTIC_LOCATION} Docker volume on {{ .host.hostname }}\", \"grace\": 3600}" | jq -r '.ping_url' | sed 's/.*\///')"
curl -X POST -H "Content-Type: text/plain" --data "Autorestic Docker Volume ${AUTORESTIC_LOCATION} FAILURE / Host: ${HOST} / User: ${USER} / Home: ${HOME}" "https://healthchecks.{{ .host.domain }}/ping/${HEALTHCHECK_UUID}/fail"
success:
2024-01-01 15:58:07 -08:00
- |
HEALTHCHECK_UUID="$(curl https://healthchecks.{{ .host.domain }}/api/v1/checks/ --header "X-Api-Key: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "HEALTHCHECKS_API_KEY")) }}{{ includeTemplate "secrets/HEALTHCHECKS_API_KEY" | decrypt | trim }}{{ else }}{{ default "" (env "HEALTHCHECKS_API_KEY") }}{{ end }}" --data "{\"name\": \"Autorestic Docker Volume Backup - Volume ${AUTORESTIC_LOCATION} / Host {{ .host.hostname }} / User {{ .user.username }})\", \"channels\": \"*\", \"schedule\": \"50 * * * *\", \"tags\": \"host-{{ .host.hostname }} user-{{ .user.username }} location-${AUTORESTIC_LOCATION} docker-volume\", \"tz\": \"{{ .user.timezone }}\", \"desc\": \"The ${AUTORESTIC_LOCATION} Docker volume on {{ .host.hostname }}\", \"grace\": 3600}" | jq -r '.ping_url' | sed 's/.*\///')"
curl -X POST -H "Content-Type: text/plain" --data "Autorestic Docker Volume ${AUTORESTIC_LOCATION} SUCCESS / Host: ${HOST} / User: ${USER} / Home: ${HOME}" "https://healthchecks.{{ .host.domain }}/ping/${HEALTHCHECK_UUID}"
options:
backup:
exclude:
- .venv
- node_modules
- venv
tag:
- docker
forget:
keep-hourly: 24
keep-daily: 7
keep-weekly: 12
keep-monthly: 8
keep-yearly: 1
locations:
healthchecks_config:
from: healthchecks_config
<<: *docker
healthchecks_postgres:
from: healthchecks_postgres
<<: *docker
rundeck_data:
from: rundeck_data
<<: *docker
portainer_manager_data:
from: portainer_manager_data
<<: *docker
statping_app:
from: statping_app
<<: *docker
statping_postgres:
from: statping_postgres
<<: *docker
backends:
docker-local:
type: local
path: /var/local/backups/docker
2023-12-24 20:31:57 -08:00
key: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "RESTIC_SYSTEM_PASSWORD")) }}{{ includeTemplate "secrets/RESTIC_SYSTEM_PASSWORD" | decrypt | trim }}{{ else }}{{ default "" (env "RESTIC_SYSTEM_PASSWORD") }}{{ end }}
docker-s3:
type: s3
path: {{ .user.cloudflare.r2 }}.r2.cloudflarestorage.com/docker
2023-12-24 20:31:57 -08:00
key: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "RESTIC_SYSTEM_PASSWORD")) }}{{ includeTemplate "secrets/RESTIC_SYSTEM_PASSWORD" | decrypt | trim }}{{ else }}{{ default "" (env "RESTIC_SYSTEM_PASSWORD") }}{{ end }}
env:
2023-12-24 20:31:57 -08:00
AWS_ACCESS_KEY_ID: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_ID")) }}{{ includeTemplate "secrets/CLOUDFLARE_R2_ID" | decrypt | trim }}{{ else }}{{ default "" (env "CLOUDFLARE_R2_ID") }}{{ end }}
AWS_SECRET_ACCESS_KEY: {{ if and (stat (joinPath .host.home ".config" "age" "chezmoi.txt")) (stat (joinPath .chezmoi.sourceDir ".chezmoitemplates" "secrets" "CLOUDFLARE_R2_SECRET")) }}{{ includeTemplate "secrets/CLOUDFLARE_R2_SECRET" | decrypt | trim }}{{ else }}{{ default "" (env "CLOUDFLARE_R2_SECRET") }}{{ end }}